Commit Graph

276 Commits

Author SHA1 Message Date
Thomas Zimmermann
eb8fc500c5 Bug 1173802: Store global NFC service in ref-counted variable, r=allstars.chh
|ClearOnShutdown| deletes pointers by assigning |nullptr|. This
patch converts |gNfcService| to a smart pointer, so that cleaning
its value during shutdown will actually destruct the instance.
2015-07-31 10:07:25 +02:00
Thomas Zimmermann
d79778ce4e Bug 1173802: Replace |assertIsNfcServiceThread| with thread-safe checks, r=allstars.chh
The main thread writes the NFC thread's field in the NFC service
instance, but the function |assertIsNfcServiceThread| uses this
value on the NFC worker thread itself. Also clearing this value
happens on main, while the NFC thread still executes code. Calls
to |assertIsNfcServiceThread| can therefore fail if they occur
during an NFC shutdown.

This patch replaces the unsafe and racy |assertIsNfcServiceThread|
with the much simpler |NfcConsumer::IsNfcServiceThread|. The new
method tests the current thread against a thread pointer that has
been stored in |NfcConsumer|.
2015-07-31 10:07:25 +02:00
Thomas Zimmermann
7faf0f34f9 Bug 1173802: Clean up |NfcEventDispatcher|, r=allstars.chh
This patch moves |NfcEventDispatcher| to the namespace of |NfcConsumer|
and renames it to |DispatchNfcEventRunnable|. The NFC service is stored
in the runnable itself.
2015-07-31 10:07:25 +02:00
Thomas Zimmermann
eb9063da67 Bug 1173802: Run |NfcConsumer| on NFC thread, r=allstars.chh
This patch moves NFC thread onto the NFC service thread by applying
the following changes:

 * The methods |Start| and |Shutdown| now send runnables to the NFC
   thread that start or stop an NFC consumer. After shutting down a
   cleanu-up runnable frees all resources on the main thread.

 * Received messages are forwarded directly from the I/O thread to
   the NFC thread and unpacked there. There's no intermediate hop
   over the main thread any more.

 * Similarly to receiving, packed massages are forwarded directly
   from the NFC thread to the I/O thread. No intermediate hop over
   main is required.

 * On connection errors, |NfcConsumer| sends a runnable to the main
   thread to shutdown NFC.
2015-07-31 10:07:25 +02:00
Thomas Zimmermann
4936d29059 Bug 1173802: Move NFC socket and messaging code into |NfcConsumer|, r=allstars.chh
|NfcConsumer| will encapsulates all NFC socket and messaging code. It
wil be able to run solely on the NFC worker thread.
2015-07-31 10:07:25 +02:00
Birunthan Mohanathas
a8939590de Bug 1182996 - Fix and add missing namespace comments. rs=ehsan
The bulk of this commit was generated by running:

  run-clang-tidy.py \
    -checks='-*,llvm-namespace-comment' \
    -header-filter=^/.../mozilla-central/.* \
    -fix
2015-07-13 08:25:42 -07:00
Juan Gomez
258ad59e3f Bug 1171931 - Refactor duplicated code using XRE_IsParent/ContentProcess. r=froydnj 2015-07-03 18:29:00 -07:00
Thomas Zimmermann
c9da785375 Bug 1173334: Open nfcd connections with socket type SOCK_SEQPACKET, allstars.chh
NFC requires sequential transfer of individual messages. Using the
socket type SOCK_SEQPACKET guarantees these properties.
2015-06-25 08:29:04 -07:00
Wes Kocher
a2e492f760 Merge m-c to inbound, a=merge 2015-06-16 16:53:03 -07:00
Boris Zbarsky
bdea574c3c Bug 1174954 part 1. Stop throwing DOMErrors from JS-implemented webidl, since we can now throw content-side Errors instead. r=bholley 2015-06-16 16:44:10 -04:00
Krzysztof Mioduszewski
3c1d89ebea Bug 1172159 - [NFC] Introduce getFocusTabId function. r=allstars.chh 2015-06-16 04:06:00 -04:00
Wes Kocher
cf559bd6b2 Merge m-c to inbound, a=merge CLOSED TREE 2015-06-10 18:38:28 -07:00
Birunthan Mohanathas
94f1cfa658 Bug 968520 - Add mozilla::fallible to more FallibleTArray calls. r=froydnj
This calls were already fallible due to their type (FallibleTArray). This
commit merely makes that fact visible at the call site.
2015-06-10 14:30:41 -07:00
Krzysztof Mioduszewski
3a7aff3110 Bug 1165340 - Part 3: Update xpcshell tests. r=allstars.chh 2015-06-03 05:06:00 -04:00
Krzysztof Mioduszewski
697c39de7e Bug 1165340 - Part 2: Consult ACE before dispatching HCI system message. r=allstars.chh 2015-06-01 10:39:00 -04:00
Krzysztof Mioduszewski
f7964e044b Bug 1165340 - Part 1: Use SEUtils and se_consts in HCI system message configurator. r=allstars.chh 2015-06-01 10:38:00 -04:00
Dimi Lee
7c669065f4 Bug 1170053 - [Aries] Not able to share a picture using NFC. r=yoshi 2015-06-03 15:54:55 +08:00
Yoshi Huang
9fd2252c1f Bug 1168292 - Part 3: add tabId in notifyUserAccepted. r=dimi 2015-05-27 18:10:37 +08:00
Yoshi Huang
8b715c98df Bug 1168292 - Part 2: notify listener with correct tabId. r=dimi 2015-05-27 17:31:43 +08:00
Yoshi Huang
4985be2c61 Bug 1168292 - Part 1: update SYSTEM_APP_ID. r=dimi 2015-05-27 11:50:14 +08:00
Thomas Zimmermann
f9ce4741fd Bug 1166638: Use |ListenSocketConsumer| in |ListenSocket|, r=kmachulis, dlee, chucklee, shuang
This patch converts |ListenSocket| to forward events to an instance
of |ListenSocketConsumer|. All users are converted and the related
listener and consumer classes are removed.
2015-05-26 13:24:20 +02:00
Thomas Zimmermann
d24dddee86 Bug 1166638: Use |StreamSocketConsumer| in |StreamSocket|, r=kmachulis, dlee, chucklee, htsai
This patch converts |StreamSocket| to forward events and data to an
instance of |StreamSocketConsumer|. All users are converted and the
related listener and consumer classes are removed.
2015-05-26 13:24:20 +02:00
Yoshi Huang
6833ac19f0 Bug 1165841 - Part 5: remove listener when window is destroyed. r=dimi 2015-05-20 15:01:16 +08:00
Yoshi Huang
38d524d9fe Bug 1165841 - Part 4: using eventListeners. r=dimi 2015-05-20 10:45:30 +08:00
Yoshi Huang
c1ccc522ea Bug 1165841 - Part 3: remove _rfState and init from NfcContentHelper. r=dimi 2015-05-20 17:10:17 +08:00
Yoshi Huang
2338dbd5cc Bug 1165841 - Part 2: move window-related code to nsNfc.js. r=dimi 2015-05-20 17:06:38 +08:00
Yoshi Huang
8d2f50875a Bug 1165841 - Part 1: add window into nsINfcEventListener. r=dimi 2015-05-20 16:36:16 +08:00
Dimi Lee
225aad3115 Bug 1162836 - Fix NFC marionette testcase fail. r=yoshi
--HG--
extra : rebase_source : f2d6affd0c6fb42805ad9e3220532399cb9f6322
2015-05-19 20:29:25 +08:00
Thomas Zimmermann
840f154d6b Bug 1164425: Cleanup interfaces of |ListenSocket|, r=kmachulis
This patch removes |ListenSocket::GetSocketAddr|, which is unused
and not thread-safe. The |Listen| methods now return error codes.
2015-05-20 10:50:43 +02:00
Carsten "Tomcat" Book
1a15bd1430 Backed out changeset 17bd0777339a (bug 1164425) 2015-05-20 10:30:55 +02:00
Thomas Zimmermann
6a46c5c7cf Bug 1164425: Cleanup interfaces of |ListenSocket|, r=kmachulis
This patch removes |ListenSocket::GetSocketAddr|, which is unused
and not thread-safe. The |Listen| methods now return error codes.
2015-05-20 09:54:27 +02:00
Thomas Zimmermann
62b1926054 Bug 1161020: Implement new socket-connector interface for NFC, r=allstars.chh
This patch moves |NfcConnector| into its own file and implements
the new socket-connector interface.
2015-05-19 13:28:46 +02:00
Andrea Marchesini
3aa189b5ff Bug 1163388 - patch 2 - get rid of nsIDOMFile, r=ehsan
--HG--
rename : dom/base/nsIDOMFile.idl => dom/base/nsIDOMBlob.idl
2015-05-18 14:52:26 +01:00
Andrew McCreight
9e8f4b219e Bug 1152551, part 2 - Fix mode lines in dom/. r=jst 2015-05-03 15:32:37 -04:00
Thomas Zimmermann
7f554d1a7f Bug 1156352: Remove |UnixSocketRawData| from NFC interfaces, r=allstars.chh 2015-04-23 13:48:48 +02:00
Andrea Marchesini
789ad8312d Bug 1156632 - Remove unused forward class declarations - patch 3 - dom/{events,xbl,xslt,xul} and others, r=ehsan 2015-04-22 08:29:18 +02:00
Thomas Zimmermann
bfbe1d4602 Bug 1154281: Don't include UnixSocket.h in NFC, r=allstars.chh
NFC only requires |UnixSocketRawData|, which is defined in SocketBase.h.
2015-04-21 10:33:06 +02:00
Yoshi Huang
f04dbfcc12 Bug 1156208 - this.nfc.getErrorMessage is not a function. r=dimi
From 810bdc26b4f20b448212f32458fa43b7a5e573bf Mon Sep 17 00:00:00 2001
---
 dom/nfc/gonk/Nfc.js | 4 ++++
 1 file changed, 4 insertions(+)
2015-04-20 17:47:24 +08:00
Yoshi Huang
0a6632197d Bug 1152667 - Remove NfcGonkMessage.h r=dimi
From 391484fa778ea08a5041bece49ef4ee14e13c7a4 Mon Sep 17 00:00:00 2001
---
 dom/nfc/gonk/NfcGonkMessage.h      | 44 --------------------------------------
 dom/nfc/gonk/NfcMessageHandler.cpp |  8 ++++---
 dom/nfc/gonk/NfcService.cpp        |  1 -
 3 files changed, 5 insertions(+), 48 deletions(-)
 delete mode 100644 dom/nfc/gonk/NfcGonkMessage.h
2015-04-09 15:54:02 +08:00
Yoshi Huang
1c8a65a91a Bug 1127735 - Update TechDiscoveredNotication. r=smaug, dimi 2015-03-25 11:16:42 +08:00
Yoshi Huang
a4d03f3431 Bug 1146270 - Move HCI Event Origin into NfcOptions.webidl. r=smaug, dimi 2015-03-24 17:19:48 +08:00
Andrea Marchesini
e6f385fb3d Bug 1148527 - Indentation fix after bug 1145631, r=ehsan 2015-03-27 18:52:19 +00:00
Ehsan Akhgari
883849ee32 Bug 1145631 - Part 1: Replace MOZ_OVERRIDE and MOZ_FINAL with override and final in the tree; r=froydnj
This patch was automatically generated using the following script:

function convert() {
echo "Converting $1 to $2..."
find . \
       ! -wholename "*/.git*" \
       ! -wholename "obj-ff-dbg*" \
         -type f \
      \( -iname "*.cpp" \
         -o -iname "*.h" \
         -o -iname "*.c" \
         -o -iname "*.cc" \
         -o -iname "*.idl" \
         -o -iname "*.ipdl" \
         -o -iname "*.ipdlh" \
         -o -iname "*.mm" \) | \
    xargs -n 1 sed -i -e "s/\b$1\b/$2/g"
}

convert MOZ_OVERRIDE override
convert MOZ_FINAL final
2015-03-21 12:28:04 -04:00
Boris Zbarsky
dc24477d79 Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp.  The
rest of this diff was generated by running the following commands:

  find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'

  find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'

  find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'

  find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'

  find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'

  find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 10:13:33 -04:00
Thomas Zimmermann
1ce878358e Bug 1109592 - Listen for connections from NFC daemon. r=allstars.chh
This patch inverses the connection setup procedure between Gecko
and nfcd. Gecko now installs a listen socket and starts nfcd from
the init scripts. Nfcd establishes the connection by connecting
to Gecko's socket.

As a side effect of this patch, nfcd only runs while NFC is switched
on. This saves ~1.6 MiB os memory with contemporary NFC drivers on
flame-kk.
2015-03-11 03:38:00 -04:00
Thomas Zimmermann
7c78ff1393 Bug 1109592 - Forward socket state from |NfcSocketListener|. r=allstars.chh
This patch allows to handle changes to the socket state at a higher
level than |NfcSocketListener|.
2015-03-09 03:27:00 -04:00
Thomas Zimmermann
cf680688ae Bug 1109592 - Only open connection to nfcd while NFC is switched on. r=allstars.chh
With this patch Gecko only creates a connection to nfcd while NFC is
switched on, and closes the connection after NFC has been switched off.

While the connection is being opened, commands to nfcd are held in a
waiting queue. Gecko flushes the queue after it connected successfully
to nfcd.

As a side effect of this patch, the NFC thread only exists while NFC
is switched on.
2015-03-12 07:43:00 -04:00
Yoshi Huang
0c1fbb4d87 Bug 1141457 - Part 3: add a CommandMsgTable. r=dimi
From 7650a8e6a0ab634b90c85c0fa85a096e7d0f4ec9 Mon Sep 17 00:00:00 2001
---
 dom/nfc/gonk/Nfc.js | 36 +++++++++++++-----------------------
 1 file changed, 13 insertions(+), 23 deletions(-)
2015-03-10 17:06:56 +08:00
Yoshi Huang
36a9d0e2e1 Bug 1141457 - Part 2: add isP2P for writeNDEF. r=dimi
From 35af6fe22fa075ecef92cd84e2ce22357c9c395f Mon Sep 17 00:00:00 2001
---
 dom/nfc/NfcContentHelper.js     | 5 +++--
 dom/nfc/gonk/Nfc.js             | 1 -
 dom/nfc/nsINfcContentHelper.idl | 5 ++++-
 dom/nfc/nsNfc.js                | 4 ++--
 4 files changed, 9 insertions(+), 6 deletions(-)
2015-03-10 16:49:08 +08:00
Yoshi Huang
45d8dca2a9 Bug 1141457 - Part 1: Move SendFile to gMessageManager. r=dimi
From 4bb362a58ce6fb1bf32efd8a5202f28aa909f5f1 Mon Sep 17 00:00:00 2001
---
 dom/nfc/gonk/Nfc.js | 31 +++++++++++++++----------------
 1 file changed, 15 insertions(+), 16 deletions(-)
2015-03-05 17:43:43 +08:00