diff --git a/b2g/config/aries/sources.xml b/b2g/config/aries/sources.xml
index bc94958d768f..3b2187275192 100644
--- a/b2g/config/aries/sources.xml
+++ b/b2g/config/aries/sources.xml
@@ -15,7 +15,7 @@
-
+
@@ -23,7 +23,7 @@
-
+
diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml
index dce16271042e..d48f94c62e1c 100644
--- a/b2g/config/dolphin/sources.xml
+++ b/b2g/config/dolphin/sources.xml
@@ -15,7 +15,7 @@
-
+
@@ -23,7 +23,7 @@
-
+
diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml
index c7b669f4c491..1af74874b996 100644
--- a/b2g/config/emulator-ics/sources.xml
+++ b/b2g/config/emulator-ics/sources.xml
@@ -19,7 +19,7 @@
-
+
diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml
index 570051f5ca88..3993242918be 100644
--- a/b2g/config/emulator-jb/sources.xml
+++ b/b2g/config/emulator-jb/sources.xml
@@ -17,10 +17,10 @@
-
+
-
+
diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml
index 7d6eb5d12e44..b875bab79e60 100644
--- a/b2g/config/emulator-kk/sources.xml
+++ b/b2g/config/emulator-kk/sources.xml
@@ -15,7 +15,7 @@
-
+
@@ -23,7 +23,7 @@
-
+
diff --git a/b2g/config/emulator-l/sources.xml b/b2g/config/emulator-l/sources.xml
index a3f56a7f25e1..aff841d147a7 100644
--- a/b2g/config/emulator-l/sources.xml
+++ b/b2g/config/emulator-l/sources.xml
@@ -15,7 +15,7 @@
-
+
@@ -23,7 +23,7 @@
-
+
diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml
index c7b669f4c491..1af74874b996 100644
--- a/b2g/config/emulator/sources.xml
+++ b/b2g/config/emulator/sources.xml
@@ -19,7 +19,7 @@
-
+
diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml
index e6b3987b4b27..6969f7c43495 100644
--- a/b2g/config/flame-kk/sources.xml
+++ b/b2g/config/flame-kk/sources.xml
@@ -15,7 +15,7 @@
-
+
@@ -23,7 +23,7 @@
-
+
diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json
index 8ccff79591aa..d7adb25ad8ff 100644
--- a/b2g/config/gaia.json
+++ b/b2g/config/gaia.json
@@ -1,9 +1,9 @@
{
"git": {
- "git_revision": "b441bde54293bea5254dc340845effe951fa3906",
+ "git_revision": "a8a462ab783a5bbab508d3c29483cff260672e3c",
"remote": "https://git.mozilla.org/releases/gaia.git",
"branch": ""
},
- "revision": "f1a55165dcd312394c553f763defd95b4b166b12",
+ "revision": "4470d59428b583f2a393ecec55c192a3b2e3a40e",
"repo_path": "integration/gaia-central"
}
diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml
index 7a9a58754d2a..d069e130b424 100644
--- a/b2g/config/nexus-4/sources.xml
+++ b/b2g/config/nexus-4/sources.xml
@@ -17,10 +17,10 @@
-
+
-
+
diff --git a/b2g/config/nexus-5-l/sources.xml b/b2g/config/nexus-5-l/sources.xml
index 6a7ae2b3a2dc..490649bb0c9f 100644
--- a/b2g/config/nexus-5-l/sources.xml
+++ b/b2g/config/nexus-5-l/sources.xml
@@ -15,7 +15,7 @@
-
+
@@ -23,7 +23,7 @@
-
+
diff --git a/browser/components/privatebrowsing/content/aboutPrivateBrowsing.css b/browser/components/privatebrowsing/content/aboutPrivateBrowsing.css
index 18a2111ca1f9..2e9dce924e90 100644
--- a/browser/components/privatebrowsing/content/aboutPrivateBrowsing.css
+++ b/browser/components/privatebrowsing/content/aboutPrivateBrowsing.css
@@ -19,6 +19,9 @@ body[tpEnabled] .showTpDisabled,
body:not([tpEnabled]) .showTpEnabled {
display: none !important;
}
+body[globalTpEnabled] .showGlobalTpDisabled {
+ display: none !important;
+}
@media screen and (min-width: 1200px) and (min-height: 700px) {
body.private {
diff --git a/browser/components/privatebrowsing/content/aboutPrivateBrowsing.js b/browser/components/privatebrowsing/content/aboutPrivateBrowsing.js
index 079216d02dc5..c728d13b9b23 100644
--- a/browser/components/privatebrowsing/content/aboutPrivateBrowsing.js
+++ b/browser/components/privatebrowsing/content/aboutPrivateBrowsing.js
@@ -14,18 +14,25 @@ const FAVICON_PRIVACY = "chrome://browser/skin/Privacy-16.png";
let stringBundle = Services.strings.createBundle(
"chrome://browser/locale/aboutPrivateBrowsing.properties");
-let prefBranch = Services.prefs.getBranch("privacy.trackingprotection.pbmode.");
+let prefBranch = Services.prefs.getBranch("privacy.trackingprotection.");
let prefObserver = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
Ci.nsISupportsWeakReference]),
observe: function () {
if (prefBranch.getBoolPref("enabled")) {
+ document.body.setAttribute("globalTpEnabled", "true");
+ } else {
+ document.body.removeAttribute("globalTpEnabled");
+ }
+ if (prefBranch.getBoolPref("pbmode.enabled") ||
+ prefBranch.getBoolPref("enabled")) {
document.body.setAttribute("tpEnabled", "true");
} else {
document.body.removeAttribute("tpEnabled");
}
},
};
+prefBranch.addObserver("pbmode.enabled", prefObserver, true);
prefBranch.addObserver("enabled", prefObserver, true);
function setFavIcon(url) {
diff --git a/browser/components/privatebrowsing/content/aboutPrivateBrowsing.xhtml b/browser/components/privatebrowsing/content/aboutPrivateBrowsing.xhtml
index 0a108bedbc9a..c6590a1d4706 100644
--- a/browser/components/privatebrowsing/content/aboutPrivateBrowsing.xhtml
+++ b/browser/components/privatebrowsing/content/aboutPrivateBrowsing.xhtml
@@ -73,11 +73,11 @@
&trackingProtection.startTour1;
diff --git a/browser/devtools/netmonitor/netmonitor-view.js b/browser/devtools/netmonitor/netmonitor-view.js
index 9face7aac87d..ee52e335cdf7 100644
--- a/browser/devtools/netmonitor/netmonitor-view.js
+++ b/browser/devtools/netmonitor/netmonitor-view.js
@@ -1612,6 +1612,7 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
}
let nameWithQuery = this._getUriNameWithQuery(uri);
let hostPort = this._getUriHostPort(uri);
+ let host = this._getUriHost(uri);
let unicodeUrl = NetworkHelper.convertToUnicode(unescape(uri.spec));
let file = $(".requests-menu-file", target);
@@ -1621,6 +1622,27 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
let domain = $(".requests-menu-domain", target);
domain.setAttribute("value", hostPort);
domain.setAttribute("tooltiptext", hostPort);
+
+ // Mark local hosts specially, where "local" is as defined in the W3C
+ // spec for secure contexts.
+ // http://www.w3.org/TR/powerful-features/
+ //
+ // * If the name falls under 'localhost'
+ // * If the name is an IPv4 address within 127.0.0.0/8
+ // * If the name is an IPv6 address within ::1/128
+ //
+ // IPv6 parsing is a little sloppy; it assumes that the address has
+ // been validated before it gets here.
+ let icon = $(".requests-security-state-icon", target);
+ icon.classList.remove("security-state-local");
+ if (host.match(/(.+\.)?localhost$/) ||
+ host.match(/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}/) ||
+ host.match(/\[[0:]+1\]/)) {
+ let tooltip = L10N.getStr("netmonitor.security.state.secure");
+ icon.classList.add("security-state-local");
+ icon.setAttribute("tooltiptext", tooltip);
+ }
+
break;
}
case "remoteAddress":
@@ -1630,12 +1652,17 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
domain.setAttribute("tooltiptext", tooltip);
break;
case "securityState": {
- let tooltip = L10N.getStr("netmonitor.security.state." + aValue);
let icon = $(".requests-security-state-icon", target);
+ this.attachSecurityIconClickListener(aItem);
+
+ // Security icon for local hosts is set in the "url" branch
+ if (icon.classList.contains("security-state-local")) {
+ break;
+ }
+
+ let tooltip = L10N.getStr("netmonitor.security.state." + aValue);
icon.classList.add("security-state-" + aValue);
icon.setAttribute("tooltiptext", tooltip);
-
- this.attachSecurityIconClickListener(aItem);
break;
}
case "status": {
@@ -2113,6 +2140,9 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
}
return NetworkHelper.convertToUnicode(unescape(aUrl.hostPort));
},
+ _getUriHost: function(aUrl) {
+ return this._getUriHostPort(aUrl).replace(/:\d+$/, "");
+ },
/**
* Helper for getting an abbreviated string for a mime type.
diff --git a/browser/devtools/netmonitor/test/browser_net_security-state.js b/browser/devtools/netmonitor/test/browser_net_security-state.js
index ae32473e6704..1b50719fa71a 100644
--- a/browser/devtools/netmonitor/test/browser_net_security-state.js
+++ b/browser/devtools/netmonitor/test/browser_net_security-state.js
@@ -14,6 +14,7 @@ add_task(function* () {
"example.com": "security-state-secure",
"nocert.example.com": "security-state-broken",
"rc4.example.com": "security-state-weak",
+ "localhost": "security-state-local",
};
yield new promise(resolve => {
@@ -50,6 +51,8 @@ add_task(function* () {
* - https://nocert.example.com (broken)
* - https://example.com (secure)
* - http://test1.example.com (insecure)
+ * - https://rc4.example.com (partly secure)
+ * - http://localhost (local)
* and waits until NetworkMonitor has handled all packets sent by the server.
*/
function* performRequests() {
@@ -82,14 +85,19 @@ add_task(function* () {
debuggee.performRequests(1, "https://rc4.example.com" + CORS_SJS_PATH);
yield done;
- is(RequestsMenu.itemCount, 4, "Four events logged.");
+ done = waitForSecurityBrokenNetworkEvent(true);
+ info("Requesting a resource over HTTP to localhost.");
+ debuggee.performRequests(1, "http://localhost" + CORS_SJS_PATH);
+ yield done;
+
+ is(RequestsMenu.itemCount, 5, "Five events logged.");
}
/**
* Returns a promise that's resolved once a request with security issues is
* completed.
*/
- function waitForSecurityBrokenNetworkEvent() {
+ function waitForSecurityBrokenNetworkEvent(networkError) {
let awaitedEvents = [
"UPDATING_REQUEST_HEADERS",
"RECEIVED_REQUEST_HEADERS",
@@ -102,6 +110,12 @@ add_task(function* () {
"RECEIVED_EVENT_TIMINGS",
];
+ // If the reason for breakage is a network error, then the
+ // STARTED_RECEIVING_RESPONSE event does not fire.
+ if (networkError) {
+ awaitedEvents.splice(4, 1);
+ }
+
let promises = awaitedEvents.map((event) => {
return monitor.panelWin.once(EVENTS[event]);
});
diff --git a/browser/devtools/performance/test/browser.ini b/browser/devtools/performance/test/browser.ini
index 684cad2dbba2..f3dc2c55e1e0 100644
--- a/browser/devtools/performance/test/browser.ini
+++ b/browser/devtools/performance/test/browser.ini
@@ -76,6 +76,7 @@ skip-if = os == 'linux' # Bug 1172120
[browser_perf-overview-render-02.js]
[browser_perf-overview-render-03.js]
[browser_perf-overview-render-04.js]
+skip-if = os == 'linux' # bug 1186322
[browser_perf-overview-selection-01.js]
[browser_perf-overview-selection-02.js]
[browser_perf-overview-selection-03.js]
diff --git a/browser/themes/shared/devtools/netmonitor.css b/browser/themes/shared/devtools/netmonitor.css
index 8fedc7c03ce5..a871cde5e1d5 100644
--- a/browser/themes/shared/devtools/netmonitor.css
+++ b/browser/themes/shared/devtools/netmonitor.css
@@ -142,25 +142,27 @@
width: 16px;
height: 16px;
-moz-margin-end: 4px;
+ cursor: pointer;
}
.security-state-insecure {
- list-style-image: url(chrome://browser/skin/identity-not-secure.svg);
+ list-style-image: url(chrome://browser/skin/identity-mixed-active-loaded.svg);
}
.security-state-secure {
- cursor: pointer;
list-style-image: url(chrome://browser/skin/identity-secure.svg);
}
.security-state-weak {
- cursor: pointer;
list-style-image: url(chrome://browser/skin/identity-mixed-passive-loaded.svg);
}
.security-state-broken {
- cursor: pointer;
- list-style-image: url(chrome://browser/skin/identity-mixed-active-loaded.svg);
+ list-style-image: url(chrome://browser/skin/controlcenter/warning-gray.svg);
+}
+
+.security-state-local {
+ list-style-image: url(chrome://browser/skin/identity-not-secure.svg);
}
.requests-menu-type {
@@ -196,7 +198,8 @@ label.requests-menu-status-code {
}
box.requests-menu-status:not([code]) {
- background-color: var(--theme-content-color2);
+ background-color: var(--theme-highlight-red);
+ border-radius: 0; /* squares */
}
box.requests-menu-status[code="cached"] {
diff --git a/configure.in b/configure.in
index 522a81c23eb2..65f6977d1bb3 100644
--- a/configure.in
+++ b/configure.in
@@ -767,8 +767,6 @@ See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
fi
AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
- # Definitions matching sdkddkver.h
- AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
AC_DEFINE_UNQUOTED(MOZ_WINSDK_MAXVER,$MOZ_WINSDK_MAXVER)
AC_SUBST(MOZ_WINSDK_MAXVER)
;;
diff --git a/dom/apps/Webapps.jsm b/dom/apps/Webapps.jsm
index b78377505e56..2c40970a460e 100644
--- a/dom/apps/Webapps.jsm
+++ b/dom/apps/Webapps.jsm
@@ -860,6 +860,10 @@ this.DOMApplicationRegistry = {
if (!root.messages || !Array.isArray(root.messages) ||
root.messages.length == 0) {
+ dump("Could not register invalid system message entry\n");
+ try {
+ dump(JSON.stringify(root.messages) + "\n");
+ } catch(e) {}
return;
}
@@ -869,28 +873,32 @@ this.DOMApplicationRegistry = {
root.messages.forEach(function registerPages(aMessage) {
let handlerPageURI = launchPathURI;
let messageName;
- if (typeof(aMessage) === "object" && Object.keys(aMessage).length === 1) {
- messageName = Object.keys(aMessage)[0];
- let handlerPath = aMessage[messageName];
- // Resolve the handler path from origin. If |handler_path| is absent,
- // simply skip.
- let fullHandlerPath;
+ if (typeof(aMessage) !== "object" || Object.keys(aMessage).length !== 1) {
+ dump("Could not register invalid system message entry\n");
try {
- if (handlerPath && handlerPath.trim()) {
- fullHandlerPath = manifest.resolveURL(handlerPath);
- } else {
- throw new Error("Empty or blank handler path.");
- }
- } catch(e) {
- debug("system message handler path (" + handlerPath + ") is " +
- "invalid, skipping. Error is: " + e);
- return;
- }
- handlerPageURI = Services.io.newURI(fullHandlerPath, null, null);
- } else {
- messageName = aMessage;
+ dump(JSON.stringify(aMessage) + "\n");
+ } catch(e) {}
+ return;
}
+ messageName = Object.keys(aMessage)[0];
+ let handlerPath = aMessage[messageName];
+ // Resolve the handler path from origin. If |handler_path| is absent,
+ // simply skip.
+ let fullHandlerPath;
+ try {
+ if (handlerPath && handlerPath.trim()) {
+ fullHandlerPath = manifest.resolveURL(handlerPath);
+ } else {
+ throw new Error("Empty or blank handler path.");
+ }
+ } catch(e) {
+ debug("system message handler path (" + handlerPath + ") is " +
+ "invalid, skipping. Error is: " + e);
+ return;
+ }
+ handlerPageURI = Services.io.newURI(fullHandlerPath, null, null);
+
if (SystemMessagePermissionsChecker
.isSystemMessagePermittedToRegister(messageName,
aApp.manifestURL,
diff --git a/dom/bluetooth/BluetoothCommon.h b/dom/bluetooth/BluetoothCommon.h
index eb4ef05632cf..b1473fb760ce 100644
--- a/dom/bluetooth/BluetoothCommon.h
+++ b/dom/bluetooth/BluetoothCommon.h
@@ -17,25 +17,6 @@ extern bool gBluetoothDebugFlag;
#define SWITCH_BT_DEBUG(V) (gBluetoothDebugFlag = V)
-#if MOZ_IS_GCC
-# if MOZ_GCC_VERSION_AT_LEAST(4, 7, 0)
-/* use designated array initializers if supported */
-# define INIT_ARRAY_AT(in_, out_) \
- [in_] = out_
-# else
-/* otherwise init array element by position */
-# define INIT_ARRAY_AT(in_, out_) \
- out_
-# endif
-#else
-/* otherwise init array element by position */
-#define INIT_ARRAY_AT(in_, out_) \
- out_
-#endif
-
-#define CONVERT(in_, out_) \
- INIT_ARRAY_AT(in_, out_)
-
#undef BT_LOG
#if defined(MOZ_WIDGET_GONK)
#include
diff --git a/dom/bluetooth/BluetoothUtils.cpp b/dom/bluetooth/BluetoothUtils.cpp
index 5b7ba4a8affc..78de4df1f00d 100644
--- a/dom/bluetooth/BluetoothUtils.cpp
+++ b/dom/bluetooth/BluetoothUtils.cpp
@@ -215,8 +215,10 @@ BroadcastSystemMessage(const nsAString& aType,
return false;
}
+ nsCOMPtr promise;
systemMessenger->BroadcastMessage(aType, value,
- JS::UndefinedHandleValue);
+ JS::UndefinedHandleValue,
+ getter_AddRefs(promise));
return true;
}
@@ -245,8 +247,10 @@ BroadcastSystemMessage(const nsAString& aType,
NS_ENSURE_TRUE(systemMessenger, false);
JS::Rooted value(cx, JS::ObjectValue(*obj));
+ nsCOMPtr promise;
systemMessenger->BroadcastMessage(aType, value,
- JS::UndefinedHandleValue);
+ JS::UndefinedHandleValue,
+ getter_AddRefs(promise));
return true;
}
diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonA2dpInterface.cpp b/dom/bluetooth/bluedroid/BluetoothDaemonA2dpInterface.cpp
index 577d318c3d5d..de4553af2733 100644
--- a/dom/bluetooth/bluedroid/BluetoothDaemonA2dpInterface.cpp
+++ b/dom/bluetooth/bluedroid/BluetoothDaemonA2dpInterface.cpp
@@ -47,8 +47,8 @@ BluetoothDaemonA2dpModule::HandleSvc(const DaemonSocketPDUHeader& aHeader,
{
static void (BluetoothDaemonA2dpModule::* const HandleOp[])(
const DaemonSocketPDUHeader&, DaemonSocketPDU&, void*) = {
- INIT_ARRAY_AT(0, &BluetoothDaemonA2dpModule::HandleRsp),
- INIT_ARRAY_AT(1, &BluetoothDaemonA2dpModule::HandleNtf),
+ [0] = &BluetoothDaemonA2dpModule::HandleRsp,
+ [1] = &BluetoothDaemonA2dpModule::HandleNtf
};
MOZ_ASSERT(!NS_IsMainThread());
@@ -145,12 +145,9 @@ BluetoothDaemonA2dpModule::HandleRsp(
const DaemonSocketPDUHeader&,
DaemonSocketPDU&,
BluetoothA2dpResultHandler*) = {
- INIT_ARRAY_AT(OPCODE_ERROR,
- &BluetoothDaemonA2dpModule::ErrorRsp),
- INIT_ARRAY_AT(OPCODE_CONNECT,
- &BluetoothDaemonA2dpModule::ConnectRsp),
- INIT_ARRAY_AT(OPCODE_DISCONNECT,
- &BluetoothDaemonA2dpModule::DisconnectRsp),
+ [OPCODE_ERROR] = &BluetoothDaemonA2dpModule::ErrorRsp,
+ [OPCODE_CONNECT] = &BluetoothDaemonA2dpModule::ConnectRsp,
+ [OPCODE_DISCONNECT] = &BluetoothDaemonA2dpModule::DisconnectRsp
};
MOZ_ASSERT(!NS_IsMainThread()); // I/O thread
@@ -322,10 +319,10 @@ BluetoothDaemonA2dpModule::HandleNtf(
{
static void (BluetoothDaemonA2dpModule::* const HandleNtf[])(
const DaemonSocketPDUHeader&, DaemonSocketPDU&) = {
- INIT_ARRAY_AT(0, &BluetoothDaemonA2dpModule::ConnectionStateNtf),
- INIT_ARRAY_AT(1, &BluetoothDaemonA2dpModule::AudioStateNtf),
+ [0] = &BluetoothDaemonA2dpModule::ConnectionStateNtf,
+ [1] = &BluetoothDaemonA2dpModule::AudioStateNtf,
#if ANDROID_VERSION >= 21
- INIT_ARRAY_AT(2, &BluetoothDaemonA2dpModule::AudioConfigNtf),
+ [2] = &BluetoothDaemonA2dpModule::AudioConfigNtf
#endif
};
diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonAvrcpInterface.cpp b/dom/bluetooth/bluedroid/BluetoothDaemonAvrcpInterface.cpp
index da7432c937c1..80fc14282f61 100644
--- a/dom/bluetooth/bluedroid/BluetoothDaemonAvrcpInterface.cpp
+++ b/dom/bluetooth/bluedroid/BluetoothDaemonAvrcpInterface.cpp
@@ -47,8 +47,8 @@ BluetoothDaemonAvrcpModule::HandleSvc(const DaemonSocketPDUHeader& aHeader,
{
static void (BluetoothDaemonAvrcpModule::* const HandleOp[])(
const DaemonSocketPDUHeader&, DaemonSocketPDU&, void*) = {
- INIT_ARRAY_AT(0, &BluetoothDaemonAvrcpModule::HandleRsp),
- INIT_ARRAY_AT(1, &BluetoothDaemonAvrcpModule::HandleNtf),
+ [0] = &BluetoothDaemonAvrcpModule::HandleRsp,
+ [1] = &BluetoothDaemonAvrcpModule::HandleNtf
};
MOZ_ASSERT(!NS_IsMainThread());
@@ -427,28 +427,28 @@ BluetoothDaemonAvrcpModule::HandleRsp(
const DaemonSocketPDUHeader&,
DaemonSocketPDU&,
BluetoothAvrcpResultHandler*) = {
- INIT_ARRAY_AT(OPCODE_ERROR,
- &BluetoothDaemonAvrcpModule::ErrorRsp),
- INIT_ARRAY_AT(OPCODE_GET_PLAY_STATUS_RSP,
- &BluetoothDaemonAvrcpModule::GetPlayStatusRspRsp),
- INIT_ARRAY_AT(OPCODE_LIST_PLAYER_APP_ATTR_RSP,
- &BluetoothDaemonAvrcpModule::ListPlayerAppAttrRspRsp),
- INIT_ARRAY_AT(OPCODE_LIST_PLAYER_APP_VALUE_RSP,
- &BluetoothDaemonAvrcpModule::ListPlayerAppValueRspRsp),
- INIT_ARRAY_AT(OPCODE_GET_PLAYER_APP_VALUE_RSP,
- &BluetoothDaemonAvrcpModule::GetPlayerAppValueRspRsp),
- INIT_ARRAY_AT(OPCODE_GET_PLAYER_APP_ATTR_TEXT_RSP,
- &BluetoothDaemonAvrcpModule::GetPlayerAppAttrTextRspRsp),
- INIT_ARRAY_AT(OPCODE_GET_PLAYER_APP_VALUE_TEXT_RSP,
- &BluetoothDaemonAvrcpModule::GetPlayerAppValueTextRspRsp),
- INIT_ARRAY_AT(OPCODE_GET_ELEMENT_ATTR_RSP,
- &BluetoothDaemonAvrcpModule::GetElementAttrRspRsp),
- INIT_ARRAY_AT(OPCODE_SET_PLAYER_APP_VALUE_RSP,
- &BluetoothDaemonAvrcpModule::SetPlayerAppValueRspRsp),
- INIT_ARRAY_AT(OPCODE_REGISTER_NOTIFICATION_RSP,
- &BluetoothDaemonAvrcpModule::RegisterNotificationRspRsp),
- INIT_ARRAY_AT(OPCODE_SET_VOLUME,
- &BluetoothDaemonAvrcpModule::SetVolumeRsp)
+ [OPCODE_ERROR] =
+ &BluetoothDaemonAvrcpModule::ErrorRsp,
+ [OPCODE_GET_PLAY_STATUS_RSP] =
+ &BluetoothDaemonAvrcpModule::GetPlayStatusRspRsp,
+ [OPCODE_LIST_PLAYER_APP_ATTR_RSP] =
+ &BluetoothDaemonAvrcpModule::ListPlayerAppAttrRspRsp,
+ [OPCODE_LIST_PLAYER_APP_VALUE_RSP] =
+ &BluetoothDaemonAvrcpModule::ListPlayerAppValueRspRsp,
+ [OPCODE_GET_PLAYER_APP_VALUE_RSP] =
+ &BluetoothDaemonAvrcpModule::GetPlayerAppValueRspRsp,
+ [OPCODE_GET_PLAYER_APP_ATTR_TEXT_RSP] =
+ &BluetoothDaemonAvrcpModule::GetPlayerAppAttrTextRspRsp,
+ [OPCODE_GET_PLAYER_APP_VALUE_TEXT_RSP] =
+ &BluetoothDaemonAvrcpModule::GetPlayerAppValueTextRspRsp,
+ [OPCODE_GET_ELEMENT_ATTR_RSP]=
+ &BluetoothDaemonAvrcpModule::GetElementAttrRspRsp,
+ [OPCODE_SET_PLAYER_APP_VALUE_RSP] =
+ &BluetoothDaemonAvrcpModule::SetPlayerAppValueRspRsp,
+ [OPCODE_REGISTER_NOTIFICATION_RSP] =
+ &BluetoothDaemonAvrcpModule::RegisterNotificationRspRsp,
+ [OPCODE_SET_VOLUME] =
+ &BluetoothDaemonAvrcpModule::SetVolumeRsp
};
MOZ_ASSERT(!NS_IsMainThread()); // I/O thread
@@ -797,28 +797,28 @@ BluetoothDaemonAvrcpModule::HandleNtf(
static void (BluetoothDaemonAvrcpModule::* const HandleNtf[])(
const DaemonSocketPDUHeader&, DaemonSocketPDU&) = {
#if ANDROID_VERSION >= 19
- INIT_ARRAY_AT(0, &BluetoothDaemonAvrcpModule::RemoteFeatureNtf),
- INIT_ARRAY_AT(1, &BluetoothDaemonAvrcpModule::GetPlayStatusNtf),
- INIT_ARRAY_AT(2, &BluetoothDaemonAvrcpModule::ListPlayerAppAttrNtf),
- INIT_ARRAY_AT(3, &BluetoothDaemonAvrcpModule::ListPlayerAppValuesNtf),
- INIT_ARRAY_AT(4, &BluetoothDaemonAvrcpModule::GetPlayerAppValueNtf),
- INIT_ARRAY_AT(5, &BluetoothDaemonAvrcpModule::GetPlayerAppAttrsTextNtf),
- INIT_ARRAY_AT(6, &BluetoothDaemonAvrcpModule::GetPlayerAppValuesTextNtf),
- INIT_ARRAY_AT(7, &BluetoothDaemonAvrcpModule::SetPlayerAppValueNtf),
- INIT_ARRAY_AT(8, &BluetoothDaemonAvrcpModule::GetElementAttrNtf),
- INIT_ARRAY_AT(9, &BluetoothDaemonAvrcpModule::RegisterNotificationNtf),
- INIT_ARRAY_AT(10, &BluetoothDaemonAvrcpModule::VolumeChangeNtf),
- INIT_ARRAY_AT(11, &BluetoothDaemonAvrcpModule::PassthroughCmdNtf)
+ [0] = &BluetoothDaemonAvrcpModule::RemoteFeatureNtf,
+ [1] = &BluetoothDaemonAvrcpModule::GetPlayStatusNtf,
+ [2] = &BluetoothDaemonAvrcpModule::ListPlayerAppAttrNtf,
+ [3] = &BluetoothDaemonAvrcpModule::ListPlayerAppValuesNtf,
+ [4] = &BluetoothDaemonAvrcpModule::GetPlayerAppValueNtf,
+ [5] = &BluetoothDaemonAvrcpModule::GetPlayerAppAttrsTextNtf,
+ [6] = &BluetoothDaemonAvrcpModule::GetPlayerAppValuesTextNtf,
+ [7] = &BluetoothDaemonAvrcpModule::SetPlayerAppValueNtf,
+ [8] = &BluetoothDaemonAvrcpModule::GetElementAttrNtf,
+ [9] = &BluetoothDaemonAvrcpModule::RegisterNotificationNtf,
+ [10] = &BluetoothDaemonAvrcpModule::VolumeChangeNtf,
+ [11] = &BluetoothDaemonAvrcpModule::PassthroughCmdNtf
#else
- INIT_ARRAY_AT(0, &BluetoothDaemonAvrcpModule::GetPlayStatusNtf),
- INIT_ARRAY_AT(1, &BluetoothDaemonAvrcpModule::ListPlayerAppAttrNtf),
- INIT_ARRAY_AT(2, &BluetoothDaemonAvrcpModule::ListPlayerAppValuesNtf),
- INIT_ARRAY_AT(3, &BluetoothDaemonAvrcpModule::GetPlayerAppValueNtf),
- INIT_ARRAY_AT(4, &BluetoothDaemonAvrcpModule::GetPlayerAppAttrsTextNtf),
- INIT_ARRAY_AT(5, &BluetoothDaemonAvrcpModule::GetPlayerAppValuesTextNtf),
- INIT_ARRAY_AT(6, &BluetoothDaemonAvrcpModule::SetPlayerAppValueNtf),
- INIT_ARRAY_AT(7, &BluetoothDaemonAvrcpModule::GetElementAttrNtf),
- INIT_ARRAY_AT(8, &BluetoothDaemonAvrcpModule::RegisterNotificationNtf)
+ [0] = &BluetoothDaemonAvrcpModule::GetPlayStatusNtf,
+ [1] = &BluetoothDaemonAvrcpModule::ListPlayerAppAttrNtf,
+ [2] = &BluetoothDaemonAvrcpModule::ListPlayerAppValuesNtf,
+ [3] = &BluetoothDaemonAvrcpModule::GetPlayerAppValueNtf,
+ [4] = &BluetoothDaemonAvrcpModule::GetPlayerAppAttrsTextNtf,
+ [5] = &BluetoothDaemonAvrcpModule::GetPlayerAppValuesTextNtf,
+ [6] = &BluetoothDaemonAvrcpModule::SetPlayerAppValueNtf,
+ [7] = &BluetoothDaemonAvrcpModule::GetElementAttrNtf,
+ [8] = &BluetoothDaemonAvrcpModule::RegisterNotificationNtf
#endif
};
diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonGattInterface.cpp b/dom/bluetooth/bluedroid/BluetoothDaemonGattInterface.cpp
index a6c0446075a5..9023409a297c 100644
--- a/dom/bluetooth/bluedroid/BluetoothDaemonGattInterface.cpp
+++ b/dom/bluetooth/bluedroid/BluetoothDaemonGattInterface.cpp
@@ -47,8 +47,8 @@ BluetoothDaemonGattModule::HandleSvc(const DaemonSocketPDUHeader& aHeader,
{
static void (BluetoothDaemonGattModule::* const HandleOp[])(
const DaemonSocketPDUHeader&, DaemonSocketPDU&, void*) = {
- INIT_ARRAY_AT(0, &BluetoothDaemonGattModule::HandleRsp),
- INIT_ARRAY_AT(1, &BluetoothDaemonGattModule::HandleNtf),
+ [0] = &BluetoothDaemonGattModule::HandleRsp,
+ [1] = &BluetoothDaemonGattModule::HandleNtf
};
MOZ_ASSERT(!NS_IsMainThread());
@@ -1411,78 +1411,78 @@ BluetoothDaemonGattModule::HandleRsp(
const DaemonSocketPDUHeader&,
DaemonSocketPDU&,
BluetoothGattResultHandler*) = {
- INIT_ARRAY_AT(OPCODE_ERROR,
- &BluetoothDaemonGattModule::ErrorRsp),
- INIT_ARRAY_AT(OPCODE_CLIENT_REGISTER,
- &BluetoothDaemonGattModule::ClientRegisterRsp),
- INIT_ARRAY_AT(OPCODE_CLIENT_UNREGISTER,
- &BluetoothDaemonGattModule::ClientUnregisterRsp),
- INIT_ARRAY_AT(OPCODE_CLIENT_SCAN,
- &BluetoothDaemonGattModule::ClientScanRsp),
- INIT_ARRAY_AT(OPCODE_CLIENT_CONNECT,
- &BluetoothDaemonGattModule::ClientConnectRsp),
- INIT_ARRAY_AT(OPCODE_CLIENT_DISCONNECT,
- &BluetoothDaemonGattModule::ClientDisconnectRsp),
- INIT_ARRAY_AT(OPCODE_CLIENT_LISTEN,
- &BluetoothDaemonGattModule::ClientListenRsp),
- INIT_ARRAY_AT(OPCODE_CLIENT_REFRESH,
- &BluetoothDaemonGattModule::ClientRefreshRsp),
- INIT_ARRAY_AT(OPCODE_CLIENT_SEARCH_SERVICE,
- &BluetoothDaemonGattModule::ClientSearchServiceRsp),
- INIT_ARRAY_AT(OPCODE_CLIENT_GET_INCLUDED_SERVICE,
- &BluetoothDaemonGattModule::ClientGetIncludedServiceRsp),
- INIT_ARRAY_AT(OPCODE_CLIENT_GET_CHARACTERISTIC,
- &BluetoothDaemonGattModule::ClientGetCharacteristicRsp),
- INIT_ARRAY_AT(OPCODE_CLIENT_GET_DESCRIPTOR,
- &BluetoothDaemonGattModule::ClientGetDescriptorRsp),
- INIT_ARRAY_AT(OPCODE_CLIENT_READ_CHARACTERISTIC,
- &BluetoothDaemonGattModule::ClientReadCharacteristicRsp),
- INIT_ARRAY_AT(OPCODE_CLIENT_WRITE_CHARACTERISTIC,
- &BluetoothDaemonGattModule::ClientWriteCharacteristicRsp),
- INIT_ARRAY_AT(OPCODE_CLIENT_READ_DESCRIPTOR,
- &BluetoothDaemonGattModule::ClientReadDescriptorRsp),
- INIT_ARRAY_AT(OPCODE_CLIENT_WRITE_DESCRIPTOR,
- &BluetoothDaemonGattModule::ClientWriteDescriptorRsp),
- INIT_ARRAY_AT(OPCODE_CLIENT_EXECUTE_WRITE,
- &BluetoothDaemonGattModule::ClientExecuteWriteRsp),
- INIT_ARRAY_AT(OPCODE_CLIENT_REGISTER_NOTIFICATION,
- &BluetoothDaemonGattModule::ClientRegisterNotificationRsp),
- INIT_ARRAY_AT(OPCODE_CLIENT_DEREGISTER_NOTIFICATION,
- &BluetoothDaemonGattModule::ClientDeregisterNotificationRsp),
- INIT_ARRAY_AT(OPCODE_CLIENT_READ_REMOTE_RSSI,
- &BluetoothDaemonGattModule::ClientReadRemoteRssiRsp),
- INIT_ARRAY_AT(OPCODE_CLIENT_GET_DEVICE_TYPE,
- &BluetoothDaemonGattModule::ClientGetDeviceTypeRsp),
- INIT_ARRAY_AT(OPCODE_CLIENT_SET_ADV_DATA,
- &BluetoothDaemonGattModule::ClientSetAdvDataRsp),
- INIT_ARRAY_AT(OPCODE_CLIENT_TEST_COMMAND,
- &BluetoothDaemonGattModule::ClientTestCommandRsp),
- INIT_ARRAY_AT(OPCODE_SERVER_REGISTER,
- &BluetoothDaemonGattModule::ServerRegisterRsp),
- INIT_ARRAY_AT(OPCODE_SERVER_UNREGISTER,
- &BluetoothDaemonGattModule::ServerUnregisterRsp),
- INIT_ARRAY_AT(OPCODE_SERVER_CONNECT_PERIPHERAL,
- &BluetoothDaemonGattModule::ServerConnectPeripheralRsp),
- INIT_ARRAY_AT(OPCODE_SERVER_DISCONNECT_PERIPHERAL,
- &BluetoothDaemonGattModule::ServerDisconnectPeripheralRsp),
- INIT_ARRAY_AT(OPCODE_SERVER_ADD_SERVICE,
- &BluetoothDaemonGattModule::ServerAddServiceRsp),
- INIT_ARRAY_AT(OPCODE_SERVER_ADD_INCLUDED_SERVICE,
- &BluetoothDaemonGattModule::ServerAddIncludedServiceRsp),
- INIT_ARRAY_AT(OPCODE_SERVER_ADD_CHARACTERISTIC,
- &BluetoothDaemonGattModule::ServerAddCharacteristicRsp),
- INIT_ARRAY_AT(OPCODE_SERVER_ADD_DESCRIPTOR,
- &BluetoothDaemonGattModule::ServerAddDescriptorRsp),
- INIT_ARRAY_AT(OPCODE_SERVER_START_SERVICE,
- &BluetoothDaemonGattModule::ServerStartServiceRsp),
- INIT_ARRAY_AT(OPCODE_SERVER_STOP_SERVICE,
- &BluetoothDaemonGattModule::ServerStopServiceRsp),
- INIT_ARRAY_AT(OPCODE_SERVER_DELETE_SERVICE,
- &BluetoothDaemonGattModule::ServerDeleteServiceRsp),
- INIT_ARRAY_AT(OPCODE_SERVER_SEND_INDICATION,
- &BluetoothDaemonGattModule::ServerSendIndicationRsp),
- INIT_ARRAY_AT(OPCODE_SERVER_SEND_RESPONSE,
- &BluetoothDaemonGattModule::ServerSendResponseRsp)
+ [OPCODE_ERROR] =
+ &BluetoothDaemonGattModule::ErrorRsp,
+ [OPCODE_CLIENT_REGISTER] =
+ &BluetoothDaemonGattModule::ClientRegisterRsp,
+ [OPCODE_CLIENT_UNREGISTER] =
+ &BluetoothDaemonGattModule::ClientUnregisterRsp,
+ [OPCODE_CLIENT_SCAN] =
+ &BluetoothDaemonGattModule::ClientScanRsp,
+ [OPCODE_CLIENT_CONNECT] =
+ &BluetoothDaemonGattModule::ClientConnectRsp,
+ [OPCODE_CLIENT_DISCONNECT] =
+ &BluetoothDaemonGattModule::ClientDisconnectRsp,
+ [OPCODE_CLIENT_LISTEN] =
+ &BluetoothDaemonGattModule::ClientListenRsp,
+ [OPCODE_CLIENT_REFRESH] =
+ &BluetoothDaemonGattModule::ClientRefreshRsp,
+ [OPCODE_CLIENT_SEARCH_SERVICE] =
+ &BluetoothDaemonGattModule::ClientSearchServiceRsp,
+ [OPCODE_CLIENT_GET_INCLUDED_SERVICE] =
+ &BluetoothDaemonGattModule::ClientGetIncludedServiceRsp,
+ [OPCODE_CLIENT_GET_CHARACTERISTIC] =
+ &BluetoothDaemonGattModule::ClientGetCharacteristicRsp,
+ [OPCODE_CLIENT_GET_DESCRIPTOR] =
+ &BluetoothDaemonGattModule::ClientGetDescriptorRsp,
+ [OPCODE_CLIENT_READ_CHARACTERISTIC] =
+ &BluetoothDaemonGattModule::ClientReadCharacteristicRsp,
+ [OPCODE_CLIENT_WRITE_CHARACTERISTIC] =
+ &BluetoothDaemonGattModule::ClientWriteCharacteristicRsp,
+ [OPCODE_CLIENT_READ_DESCRIPTOR] =
+ &BluetoothDaemonGattModule::ClientReadDescriptorRsp,
+ [OPCODE_CLIENT_WRITE_DESCRIPTOR] =
+ &BluetoothDaemonGattModule::ClientWriteDescriptorRsp,
+ [OPCODE_CLIENT_EXECUTE_WRITE] =
+ &BluetoothDaemonGattModule::ClientExecuteWriteRsp,
+ [OPCODE_CLIENT_REGISTER_NOTIFICATION] =
+ &BluetoothDaemonGattModule::ClientRegisterNotificationRsp,
+ [OPCODE_CLIENT_DEREGISTER_NOTIFICATION] =
+ &BluetoothDaemonGattModule::ClientDeregisterNotificationRsp,
+ [OPCODE_CLIENT_READ_REMOTE_RSSI] =
+ &BluetoothDaemonGattModule::ClientReadRemoteRssiRsp,
+ [OPCODE_CLIENT_GET_DEVICE_TYPE] =
+ &BluetoothDaemonGattModule::ClientGetDeviceTypeRsp,
+ [OPCODE_CLIENT_SET_ADV_DATA] =
+ &BluetoothDaemonGattModule::ClientSetAdvDataRsp,
+ [OPCODE_CLIENT_TEST_COMMAND] =
+ &BluetoothDaemonGattModule::ClientTestCommandRsp,
+ [OPCODE_SERVER_REGISTER] =
+ &BluetoothDaemonGattModule::ServerRegisterRsp,
+ [OPCODE_SERVER_UNREGISTER] =
+ &BluetoothDaemonGattModule::ServerUnregisterRsp,
+ [OPCODE_SERVER_CONNECT_PERIPHERAL] =
+ &BluetoothDaemonGattModule::ServerConnectPeripheralRsp,
+ [OPCODE_SERVER_DISCONNECT_PERIPHERAL] =
+ &BluetoothDaemonGattModule::ServerDisconnectPeripheralRsp,
+ [OPCODE_SERVER_ADD_SERVICE] =
+ &BluetoothDaemonGattModule::ServerAddServiceRsp,
+ [OPCODE_SERVER_ADD_INCLUDED_SERVICE] =
+ &BluetoothDaemonGattModule::ServerAddIncludedServiceRsp,
+ [OPCODE_SERVER_ADD_CHARACTERISTIC] =
+ &BluetoothDaemonGattModule::ServerAddCharacteristicRsp,
+ [OPCODE_SERVER_ADD_DESCRIPTOR] =
+ &BluetoothDaemonGattModule::ServerAddDescriptorRsp,
+ [OPCODE_SERVER_START_SERVICE] =
+ &BluetoothDaemonGattModule::ServerStartServiceRsp,
+ [OPCODE_SERVER_STOP_SERVICE] =
+ &BluetoothDaemonGattModule::ServerStopServiceRsp,
+ [OPCODE_SERVER_DELETE_SERVICE] =
+ &BluetoothDaemonGattModule::ServerDeleteServiceRsp,
+ [OPCODE_SERVER_SEND_INDICATION] =
+ &BluetoothDaemonGattModule::ServerSendIndicationRsp,
+ [OPCODE_SERVER_SEND_RESPONSE] =
+ &BluetoothDaemonGattModule::ServerSendResponseRsp
};
MOZ_ASSERT(!NS_IsMainThread()); // I/O thread
@@ -2156,37 +2156,37 @@ BluetoothDaemonGattModule::HandleNtf(
{
static void (BluetoothDaemonGattModule::* const HandleNtf[])(
const DaemonSocketPDUHeader&, DaemonSocketPDU&) = {
- INIT_ARRAY_AT(0, &BluetoothDaemonGattModule::ClientRegisterNtf),
- INIT_ARRAY_AT(1, &BluetoothDaemonGattModule::ClientScanResultNtf),
- INIT_ARRAY_AT(2, &BluetoothDaemonGattModule::ClientConnectNtf),
- INIT_ARRAY_AT(3, &BluetoothDaemonGattModule::ClientDisconnectNtf),
- INIT_ARRAY_AT(4, &BluetoothDaemonGattModule::ClientSearchCompleteNtf),
- INIT_ARRAY_AT(5, &BluetoothDaemonGattModule::ClientSearchResultNtf),
- INIT_ARRAY_AT(6, &BluetoothDaemonGattModule::ClientGetCharacteristicNtf),
- INIT_ARRAY_AT(7, &BluetoothDaemonGattModule::ClientGetDescriptorNtf),
- INIT_ARRAY_AT(8, &BluetoothDaemonGattModule::ClientGetIncludedServiceNtf),
- INIT_ARRAY_AT(9, &BluetoothDaemonGattModule::ClientRegisterNotificationNtf),
- INIT_ARRAY_AT(10, &BluetoothDaemonGattModule::ClientNotifyNtf),
- INIT_ARRAY_AT(11, &BluetoothDaemonGattModule::ClientReadCharacteristicNtf),
- INIT_ARRAY_AT(12, &BluetoothDaemonGattModule::ClientWriteCharacteristicNtf),
- INIT_ARRAY_AT(13, &BluetoothDaemonGattModule::ClientReadDescriptorNtf),
- INIT_ARRAY_AT(14, &BluetoothDaemonGattModule::ClientWriteDescriptorNtf),
- INIT_ARRAY_AT(15, &BluetoothDaemonGattModule::ClientExecuteWriteNtf),
- INIT_ARRAY_AT(16, &BluetoothDaemonGattModule::ClientReadRemoteRssiNtf),
- INIT_ARRAY_AT(17, &BluetoothDaemonGattModule::ClientListenNtf),
- INIT_ARRAY_AT(18, &BluetoothDaemonGattModule::ServerRegisterNtf),
- INIT_ARRAY_AT(19, &BluetoothDaemonGattModule::ServerConnectionNtf),
- INIT_ARRAY_AT(20, &BluetoothDaemonGattModule::ServerServiceAddedNtf),
- INIT_ARRAY_AT(21, &BluetoothDaemonGattModule::ServerIncludedServiceAddedNtf),
- INIT_ARRAY_AT(22, &BluetoothDaemonGattModule::ServerCharacteristicAddedNtf),
- INIT_ARRAY_AT(23, &BluetoothDaemonGattModule::ServerDescriptorAddedNtf),
- INIT_ARRAY_AT(24, &BluetoothDaemonGattModule::ServerServiceStartedNtf),
- INIT_ARRAY_AT(25, &BluetoothDaemonGattModule::ServerServiceStoppedNtf),
- INIT_ARRAY_AT(26, &BluetoothDaemonGattModule::ServerServiceDeletedNtf),
- INIT_ARRAY_AT(27, &BluetoothDaemonGattModule::ServerRequestReadNtf),
- INIT_ARRAY_AT(28, &BluetoothDaemonGattModule::ServerRequestWriteNtf),
- INIT_ARRAY_AT(29, &BluetoothDaemonGattModule::ServerRequestExecuteWriteNtf),
- INIT_ARRAY_AT(30, &BluetoothDaemonGattModule::ServerResponseConfirmationNtf)
+ [0] = &BluetoothDaemonGattModule::ClientRegisterNtf,
+ [1] = &BluetoothDaemonGattModule::ClientScanResultNtf,
+ [2] = &BluetoothDaemonGattModule::ClientConnectNtf,
+ [3] = &BluetoothDaemonGattModule::ClientDisconnectNtf,
+ [4] = &BluetoothDaemonGattModule::ClientSearchCompleteNtf,
+ [5] = &BluetoothDaemonGattModule::ClientSearchResultNtf,
+ [6] = &BluetoothDaemonGattModule::ClientGetCharacteristicNtf,
+ [7] = &BluetoothDaemonGattModule::ClientGetDescriptorNtf,
+ [8] = &BluetoothDaemonGattModule::ClientGetIncludedServiceNtf,
+ [9] = &BluetoothDaemonGattModule::ClientRegisterNotificationNtf,
+ [10] = &BluetoothDaemonGattModule::ClientNotifyNtf,
+ [11] = &BluetoothDaemonGattModule::ClientReadCharacteristicNtf,
+ [12] = &BluetoothDaemonGattModule::ClientWriteCharacteristicNtf,
+ [13] = &BluetoothDaemonGattModule::ClientReadDescriptorNtf,
+ [14] = &BluetoothDaemonGattModule::ClientWriteDescriptorNtf,
+ [15] = &BluetoothDaemonGattModule::ClientExecuteWriteNtf,
+ [16] = &BluetoothDaemonGattModule::ClientReadRemoteRssiNtf,
+ [17] = &BluetoothDaemonGattModule::ClientListenNtf,
+ [18] = &BluetoothDaemonGattModule::ServerRegisterNtf,
+ [19] = &BluetoothDaemonGattModule::ServerConnectionNtf,
+ [20] = &BluetoothDaemonGattModule::ServerServiceAddedNtf,
+ [21] = &BluetoothDaemonGattModule::ServerIncludedServiceAddedNtf,
+ [22] = &BluetoothDaemonGattModule::ServerCharacteristicAddedNtf,
+ [23] = &BluetoothDaemonGattModule::ServerDescriptorAddedNtf,
+ [24] = &BluetoothDaemonGattModule::ServerServiceStartedNtf,
+ [25] = &BluetoothDaemonGattModule::ServerServiceStoppedNtf,
+ [26] = &BluetoothDaemonGattModule::ServerServiceDeletedNtf,
+ [27] = &BluetoothDaemonGattModule::ServerRequestReadNtf,
+ [28] = &BluetoothDaemonGattModule::ServerRequestWriteNtf,
+ [29] = &BluetoothDaemonGattModule::ServerRequestExecuteWriteNtf,
+ [30] = &BluetoothDaemonGattModule::ServerResponseConfirmationNtf
};
MOZ_ASSERT(!NS_IsMainThread());
diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonHandsfreeInterface.cpp b/dom/bluetooth/bluedroid/BluetoothDaemonHandsfreeInterface.cpp
index a01ce556c21b..67ef9ff39dae 100644
--- a/dom/bluetooth/bluedroid/BluetoothDaemonHandsfreeInterface.cpp
+++ b/dom/bluetooth/bluedroid/BluetoothDaemonHandsfreeInterface.cpp
@@ -50,8 +50,8 @@ BluetoothDaemonHandsfreeModule::HandleSvc(
{
static void (BluetoothDaemonHandsfreeModule::* const HandleOp[])(
const DaemonSocketPDUHeader&, DaemonSocketPDU&, void*) = {
- INIT_ARRAY_AT(0, &BluetoothDaemonHandsfreeModule::HandleRsp),
- INIT_ARRAY_AT(1, &BluetoothDaemonHandsfreeModule::HandleNtf),
+ [0] = &BluetoothDaemonHandsfreeModule::HandleRsp,
+ [1] = &BluetoothDaemonHandsfreeModule::HandleNtf
};
MOZ_ASSERT(!NS_IsMainThread());
@@ -685,38 +685,38 @@ BluetoothDaemonHandsfreeModule::HandleRsp(
const DaemonSocketPDUHeader&,
DaemonSocketPDU&,
BluetoothHandsfreeResultHandler*) = {
- INIT_ARRAY_AT(OPCODE_ERROR,
- &BluetoothDaemonHandsfreeModule::ErrorRsp),
- INIT_ARRAY_AT(OPCODE_CONNECT,
- &BluetoothDaemonHandsfreeModule::ConnectRsp),
- INIT_ARRAY_AT(OPCODE_DISCONNECT,
- &BluetoothDaemonHandsfreeModule::DisconnectRsp),
- INIT_ARRAY_AT(OPCODE_CONNECT_AUDIO,
- &BluetoothDaemonHandsfreeModule::ConnectAudioRsp),
- INIT_ARRAY_AT(OPCODE_DISCONNECT_AUDIO,
- &BluetoothDaemonHandsfreeModule::DisconnectAudioRsp),
- INIT_ARRAY_AT(OPCODE_START_VOICE_RECOGNITION,
- &BluetoothDaemonHandsfreeModule::StartVoiceRecognitionRsp),
- INIT_ARRAY_AT(OPCODE_STOP_VOICE_RECOGNITION,
- &BluetoothDaemonHandsfreeModule::StopVoiceRecognitionRsp),
- INIT_ARRAY_AT(OPCODE_VOLUME_CONTROL,
- &BluetoothDaemonHandsfreeModule::VolumeControlRsp),
- INIT_ARRAY_AT(OPCODE_DEVICE_STATUS_NOTIFICATION,
- &BluetoothDaemonHandsfreeModule::DeviceStatusNotificationRsp),
- INIT_ARRAY_AT(OPCODE_COPS_RESPONSE,
- &BluetoothDaemonHandsfreeModule::CopsResponseRsp),
- INIT_ARRAY_AT(OPCODE_CIND_RESPONSE,
- &BluetoothDaemonHandsfreeModule::CindResponseRsp),
- INIT_ARRAY_AT(OPCODE_FORMATTED_AT_RESPONSE,
- &BluetoothDaemonHandsfreeModule::FormattedAtResponseRsp),
- INIT_ARRAY_AT(OPCODE_AT_RESPONSE,
- &BluetoothDaemonHandsfreeModule::AtResponseRsp),
- INIT_ARRAY_AT(OPCODE_CLCC_RESPONSE,
- &BluetoothDaemonHandsfreeModule::ClccResponseRsp),
- INIT_ARRAY_AT(OPCODE_PHONE_STATE_CHANGE,
- &BluetoothDaemonHandsfreeModule::PhoneStateChangeRsp),
- INIT_ARRAY_AT(OPCODE_CONFIGURE_WBS,
- &BluetoothDaemonHandsfreeModule::ConfigureWbsRsp)
+ [OPCODE_ERROR] =
+ &BluetoothDaemonHandsfreeModule::ErrorRsp,
+ [OPCODE_CONNECT] =
+ &BluetoothDaemonHandsfreeModule::ConnectRsp,
+ [OPCODE_DISCONNECT] =
+ &BluetoothDaemonHandsfreeModule::DisconnectRsp,
+ [OPCODE_CONNECT_AUDIO] =
+ &BluetoothDaemonHandsfreeModule::ConnectAudioRsp,
+ [OPCODE_DISCONNECT_AUDIO] =
+ &BluetoothDaemonHandsfreeModule::DisconnectAudioRsp,
+ [OPCODE_START_VOICE_RECOGNITION] =
+ &BluetoothDaemonHandsfreeModule::StartVoiceRecognitionRsp,
+ [OPCODE_STOP_VOICE_RECOGNITION] =
+ &BluetoothDaemonHandsfreeModule::StopVoiceRecognitionRsp,
+ [OPCODE_VOLUME_CONTROL] =
+ &BluetoothDaemonHandsfreeModule::VolumeControlRsp,
+ [OPCODE_DEVICE_STATUS_NOTIFICATION] =
+ &BluetoothDaemonHandsfreeModule::DeviceStatusNotificationRsp,
+ [OPCODE_COPS_RESPONSE] =
+ &BluetoothDaemonHandsfreeModule::CopsResponseRsp,
+ [OPCODE_CIND_RESPONSE] =
+ &BluetoothDaemonHandsfreeModule::CindResponseRsp,
+ [OPCODE_FORMATTED_AT_RESPONSE] =
+ &BluetoothDaemonHandsfreeModule::FormattedAtResponseRsp,
+ [OPCODE_AT_RESPONSE] =
+ &BluetoothDaemonHandsfreeModule::AtResponseRsp,
+ [OPCODE_CLCC_RESPONSE] =
+ &BluetoothDaemonHandsfreeModule::ClccResponseRsp,
+ [OPCODE_PHONE_STATE_CHANGE] =
+ &BluetoothDaemonHandsfreeModule::PhoneStateChangeRsp,
+ [OPCODE_CONFIGURE_WBS] =
+ &BluetoothDaemonHandsfreeModule::ConfigureWbsRsp
};
MOZ_ASSERT(!NS_IsMainThread()); // I/O thread
@@ -1426,22 +1426,22 @@ BluetoothDaemonHandsfreeModule::HandleNtf(
{
static void (BluetoothDaemonHandsfreeModule::* const HandleNtf[])(
const DaemonSocketPDUHeader&, DaemonSocketPDU&) = {
- INIT_ARRAY_AT(0, &BluetoothDaemonHandsfreeModule::ConnectionStateNtf),
- INIT_ARRAY_AT(1, &BluetoothDaemonHandsfreeModule::AudioStateNtf),
- INIT_ARRAY_AT(2, &BluetoothDaemonHandsfreeModule::VoiceRecognitionNtf),
- INIT_ARRAY_AT(3, &BluetoothDaemonHandsfreeModule::AnswerCallNtf),
- INIT_ARRAY_AT(4, &BluetoothDaemonHandsfreeModule::HangupCallNtf),
- INIT_ARRAY_AT(5, &BluetoothDaemonHandsfreeModule::VolumeNtf),
- INIT_ARRAY_AT(6, &BluetoothDaemonHandsfreeModule::DialCallNtf),
- INIT_ARRAY_AT(7, &BluetoothDaemonHandsfreeModule::DtmfNtf),
- INIT_ARRAY_AT(8, &BluetoothDaemonHandsfreeModule::NRECNtf),
- INIT_ARRAY_AT(9, &BluetoothDaemonHandsfreeModule::CallHoldNtf),
- INIT_ARRAY_AT(10, &BluetoothDaemonHandsfreeModule::CnumNtf),
- INIT_ARRAY_AT(11, &BluetoothDaemonHandsfreeModule::CindNtf),
- INIT_ARRAY_AT(12, &BluetoothDaemonHandsfreeModule::CopsNtf),
- INIT_ARRAY_AT(13, &BluetoothDaemonHandsfreeModule::ClccNtf),
- INIT_ARRAY_AT(14, &BluetoothDaemonHandsfreeModule::UnknownAtNtf),
- INIT_ARRAY_AT(15, &BluetoothDaemonHandsfreeModule::KeyPressedNtf)
+ [0] = &BluetoothDaemonHandsfreeModule::ConnectionStateNtf,
+ [1] = &BluetoothDaemonHandsfreeModule::AudioStateNtf,
+ [2] = &BluetoothDaemonHandsfreeModule::VoiceRecognitionNtf,
+ [3] = &BluetoothDaemonHandsfreeModule::AnswerCallNtf,
+ [4] = &BluetoothDaemonHandsfreeModule::HangupCallNtf,
+ [5] = &BluetoothDaemonHandsfreeModule::VolumeNtf,
+ [6] = &BluetoothDaemonHandsfreeModule::DialCallNtf,
+ [7] = &BluetoothDaemonHandsfreeModule::DtmfNtf,
+ [8] = &BluetoothDaemonHandsfreeModule::NRECNtf,
+ [9] = &BluetoothDaemonHandsfreeModule::CallHoldNtf,
+ [10] = &BluetoothDaemonHandsfreeModule::CnumNtf,
+ [11] = &BluetoothDaemonHandsfreeModule::CindNtf,
+ [12] = &BluetoothDaemonHandsfreeModule::CopsNtf,
+ [13] = &BluetoothDaemonHandsfreeModule::ClccNtf,
+ [14] = &BluetoothDaemonHandsfreeModule::UnknownAtNtf,
+ [15] = &BluetoothDaemonHandsfreeModule::KeyPressedNtf
};
MOZ_ASSERT(!NS_IsMainThread());
diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.cpp b/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.cpp
index 0403e3529361..af3a291c047f 100644
--- a/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.cpp
+++ b/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.cpp
@@ -22,8 +22,8 @@ nsresult
Convert(bool aIn, BluetoothScanMode& aOut)
{
static const BluetoothScanMode sScanMode[] = {
- CONVERT(false, SCAN_MODE_CONNECTABLE),
- CONVERT(true, SCAN_MODE_CONNECTABLE_DISCOVERABLE)
+ [false] = SCAN_MODE_CONNECTABLE,
+ [true] = SCAN_MODE_CONNECTABLE_DISCOVERABLE
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sScanMode))) {
aOut = SCAN_MODE_NONE; // silences compiler warning
@@ -37,10 +37,10 @@ nsresult
Convert(int32_t aIn, BluetoothTypeOfDevice& aOut)
{
static const BluetoothTypeOfDevice sTypeOfDevice[] = {
- CONVERT(0x00, static_cast(0)), // invalid, required by gcc
- CONVERT(0x01, TYPE_OF_DEVICE_BREDR),
- CONVERT(0x02, TYPE_OF_DEVICE_BLE),
- CONVERT(0x03, TYPE_OF_DEVICE_DUAL)
+ [0x00] = static_cast(0), // invalid, required by gcc
+ [0x01] = TYPE_OF_DEVICE_BREDR,
+ [0x02] = TYPE_OF_DEVICE_BLE,
+ [0x03] = TYPE_OF_DEVICE_DUAL
};
if (NS_WARN_IF(!aIn) ||
NS_WARN_IF(static_cast(aIn) >= MOZ_ARRAY_LENGTH(sTypeOfDevice))) {
@@ -54,9 +54,9 @@ nsresult
Convert(int32_t aIn, BluetoothScanMode& aOut)
{
static const BluetoothScanMode sScanMode[] = {
- CONVERT(0x00, SCAN_MODE_NONE),
- CONVERT(0x01, SCAN_MODE_CONNECTABLE),
- CONVERT(0x02, SCAN_MODE_CONNECTABLE_DISCOVERABLE)
+ [0x00] = SCAN_MODE_NONE,
+ [0x01] = SCAN_MODE_CONNECTABLE,
+ [0x02] = SCAN_MODE_CONNECTABLE_DISCOVERABLE
};
if (NS_WARN_IF(aIn < 0) ||
NS_WARN_IF(static_cast(aIn) >= MOZ_ARRAY_LENGTH(sScanMode))) {
@@ -70,9 +70,9 @@ nsresult
Convert(uint8_t aIn, BluetoothA2dpAudioState& aOut)
{
static const BluetoothA2dpAudioState sAudioState[] = {
- CONVERT(0x00, A2DP_AUDIO_STATE_REMOTE_SUSPEND),
- CONVERT(0x01, A2DP_AUDIO_STATE_STOPPED),
- CONVERT(0x02, A2DP_AUDIO_STATE_STARTED)
+ [0x00] = A2DP_AUDIO_STATE_REMOTE_SUSPEND,
+ [0x01] = A2DP_AUDIO_STATE_STOPPED,
+ [0x02] = A2DP_AUDIO_STATE_STARTED
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sAudioState))) {
return NS_ERROR_ILLEGAL_VALUE;
@@ -85,10 +85,10 @@ nsresult
Convert(uint8_t aIn, BluetoothA2dpConnectionState& aOut)
{
static const BluetoothA2dpConnectionState sConnectionState[] = {
- CONVERT(0x00, A2DP_CONNECTION_STATE_DISCONNECTED),
- CONVERT(0x01, A2DP_CONNECTION_STATE_CONNECTING),
- CONVERT(0x02, A2DP_CONNECTION_STATE_CONNECTED),
- CONVERT(0x03, A2DP_CONNECTION_STATE_DISCONNECTING)
+ [0x00] = A2DP_CONNECTION_STATE_DISCONNECTED,
+ [0x01] = A2DP_CONNECTION_STATE_CONNECTING,
+ [0x02] = A2DP_CONNECTION_STATE_CONNECTED,
+ [0x03] = A2DP_CONNECTION_STATE_DISCONNECTING
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sConnectionState))) {
return NS_ERROR_ILLEGAL_VALUE;
@@ -101,8 +101,8 @@ nsresult
Convert(uint8_t aIn, BluetoothAclState& aOut)
{
static const BluetoothAclState sAclState[] = {
- CONVERT(0x00, ACL_STATE_CONNECTED),
- CONVERT(0x01, ACL_STATE_DISCONNECTED),
+ [0x00] = ACL_STATE_CONNECTED,
+ [0x01] = ACL_STATE_DISCONNECTED
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sAclState))) {
return NS_ERROR_ILLEGAL_VALUE;
@@ -115,15 +115,15 @@ nsresult
Convert(uint8_t aIn, BluetoothAvrcpEvent& aOut)
{
static const BluetoothAvrcpEvent sAvrcpEvent[] = {
- CONVERT(0x00, static_cast(0)),
- CONVERT(0x01, AVRCP_EVENT_PLAY_STATUS_CHANGED),
- CONVERT(0x02, AVRCP_EVENT_TRACK_CHANGE),
- CONVERT(0x03, AVRCP_EVENT_TRACK_REACHED_END),
- CONVERT(0x04, AVRCP_EVENT_TRACK_REACHED_START),
- CONVERT(0x05, AVRCP_EVENT_PLAY_POS_CHANGED),
- CONVERT(0x06, static_cast(0)),
- CONVERT(0x07, static_cast(0)),
- CONVERT(0x08, AVRCP_EVENT_APP_SETTINGS_CHANGED)
+ [0x00] = static_cast(0),
+ [0x01] = AVRCP_EVENT_PLAY_STATUS_CHANGED,
+ [0x02] = AVRCP_EVENT_TRACK_CHANGE,
+ [0x03] = AVRCP_EVENT_TRACK_REACHED_END,
+ [0x04] = AVRCP_EVENT_TRACK_REACHED_START,
+ [0x05] = AVRCP_EVENT_PLAY_POS_CHANGED,
+ [0x06] = static_cast(0),
+ [0x07] = static_cast(0),
+ [0x08] = AVRCP_EVENT_APP_SETTINGS_CHANGED
};
if (NS_WARN_IF(!aIn) ||
NS_WARN_IF(aIn == 0x06) ||
@@ -140,14 +140,14 @@ nsresult
Convert(uint8_t aIn, BluetoothAvrcpMediaAttribute& aOut)
{
static const BluetoothAvrcpMediaAttribute sAvrcpMediaAttribute[] = {
- CONVERT(0x00, static_cast(0)),
- CONVERT(0x01, AVRCP_MEDIA_ATTRIBUTE_TITLE),
- CONVERT(0x02, AVRCP_MEDIA_ATTRIBUTE_ARTIST),
- CONVERT(0x03, AVRCP_MEDIA_ATTRIBUTE_ALBUM),
- CONVERT(0x04, AVRCP_MEDIA_ATTRIBUTE_TRACK_NUM),
- CONVERT(0x05, AVRCP_MEDIA_ATTRIBUTE_NUM_TRACKS),
- CONVERT(0x06, AVRCP_MEDIA_ATTRIBUTE_GENRE),
- CONVERT(0x07, AVRCP_MEDIA_ATTRIBUTE_PLAYING_TIME)
+ [0x00] = static_cast(0),
+ [0x01] = AVRCP_MEDIA_ATTRIBUTE_TITLE,
+ [0x02] = AVRCP_MEDIA_ATTRIBUTE_ARTIST,
+ [0x03] = AVRCP_MEDIA_ATTRIBUTE_ALBUM,
+ [0x04] = AVRCP_MEDIA_ATTRIBUTE_TRACK_NUM,
+ [0x05] = AVRCP_MEDIA_ATTRIBUTE_NUM_TRACKS,
+ [0x06] = AVRCP_MEDIA_ATTRIBUTE_GENRE,
+ [0x07] = AVRCP_MEDIA_ATTRIBUTE_PLAYING_TIME
};
if (NS_WARN_IF(!aIn) ||
NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sAvrcpMediaAttribute))) {
@@ -163,11 +163,11 @@ nsresult
Convert(uint8_t aIn, BluetoothAvrcpPlayerAttribute& aOut)
{
static const BluetoothAvrcpPlayerAttribute sAvrcpPlayerAttribute[] = {
- CONVERT(0x00, static_cast(0)),
- CONVERT(0x01, AVRCP_PLAYER_ATTRIBUTE_EQUALIZER),
- CONVERT(0x02, AVRCP_PLAYER_ATTRIBUTE_REPEAT),
- CONVERT(0x03, AVRCP_PLAYER_ATTRIBUTE_SHUFFLE),
- CONVERT(0x04, AVRCP_PLAYER_ATTRIBUTE_SCAN)
+ [0x00] = static_cast(0),
+ [0x01] = AVRCP_PLAYER_ATTRIBUTE_EQUALIZER,
+ [0x02] = AVRCP_PLAYER_ATTRIBUTE_REPEAT,
+ [0x03] = AVRCP_PLAYER_ATTRIBUTE_SHUFFLE,
+ [0x04] = AVRCP_PLAYER_ATTRIBUTE_SCAN
};
if (NS_WARN_IF(!aIn) ||
NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sAvrcpPlayerAttribute))) {
@@ -183,10 +183,10 @@ nsresult
Convert(uint8_t aIn, BluetoothAvrcpRemoteFeature& aOut)
{
static const BluetoothAvrcpRemoteFeature sAvrcpRemoteFeature[] = {
- CONVERT(0x00, AVRCP_REMOTE_FEATURE_NONE),
- CONVERT(0x01, AVRCP_REMOTE_FEATURE_METADATA),
- CONVERT(0x02, AVRCP_REMOTE_FEATURE_ABSOLUTE_VOLUME),
- CONVERT(0x03, AVRCP_REMOTE_FEATURE_BROWSE)
+ [0x00] = AVRCP_REMOTE_FEATURE_NONE,
+ [0x01] = AVRCP_REMOTE_FEATURE_METADATA,
+ [0x02] = AVRCP_REMOTE_FEATURE_ABSOLUTE_VOLUME,
+ [0x03] = AVRCP_REMOTE_FEATURE_BROWSE
};
if (NS_WARN_IF(!aIn) ||
NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sAvrcpRemoteFeature))) {
@@ -202,9 +202,9 @@ nsresult
Convert(uint8_t aIn, BluetoothBondState& aOut)
{
static const BluetoothBondState sBondState[] = {
- CONVERT(0x00, BOND_STATE_NONE),
- CONVERT(0x01, BOND_STATE_BONDING),
- CONVERT(0x02, BOND_STATE_BONDED)
+ [0x00] = BOND_STATE_NONE,
+ [0x01] = BOND_STATE_BONDING,
+ [0x02] = BOND_STATE_BONDED
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sBondState))) {
return NS_ERROR_ILLEGAL_VALUE;
@@ -217,10 +217,10 @@ nsresult
Convert(uint8_t aIn, BluetoothHandsfreeAudioState& aOut)
{
static const BluetoothHandsfreeAudioState sAudioState[] = {
- CONVERT(0x00, HFP_AUDIO_STATE_DISCONNECTED),
- CONVERT(0x01, HFP_AUDIO_STATE_CONNECTING),
- CONVERT(0x02, HFP_AUDIO_STATE_CONNECTED),
- CONVERT(0x03, HFP_AUDIO_STATE_DISCONNECTING)
+ [0x00] = HFP_AUDIO_STATE_DISCONNECTED,
+ [0x01] = HFP_AUDIO_STATE_CONNECTING,
+ [0x02] = HFP_AUDIO_STATE_CONNECTED,
+ [0x03] = HFP_AUDIO_STATE_DISCONNECTING
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sAudioState))) {
return NS_ERROR_ILLEGAL_VALUE;
@@ -233,10 +233,10 @@ nsresult
Convert(uint8_t aIn, BluetoothHandsfreeCallHoldType& aOut)
{
static const BluetoothHandsfreeCallHoldType sCallHoldType[] = {
- CONVERT(0x00, HFP_CALL_HOLD_RELEASEHELD),
- CONVERT(0x01, HFP_CALL_HOLD_RELEASEACTIVE_ACCEPTHELD),
- CONVERT(0x02, HFP_CALL_HOLD_HOLDACTIVE_ACCEPTHELD),
- CONVERT(0x03, HFP_CALL_HOLD_ADDHELDTOCONF)
+ [0x00] = HFP_CALL_HOLD_RELEASEHELD,
+ [0x01] = HFP_CALL_HOLD_RELEASEACTIVE_ACCEPTHELD,
+ [0x02] = HFP_CALL_HOLD_HOLDACTIVE_ACCEPTHELD,
+ [0x03] = HFP_CALL_HOLD_ADDHELDTOCONF
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sCallHoldType))) {
return NS_ERROR_ILLEGAL_VALUE;
@@ -249,11 +249,11 @@ nsresult
Convert(uint8_t aIn, BluetoothHandsfreeConnectionState& aOut)
{
static const BluetoothHandsfreeConnectionState sConnectionState[] = {
- CONVERT(0x00, HFP_CONNECTION_STATE_DISCONNECTED),
- CONVERT(0x01, HFP_CONNECTION_STATE_CONNECTING),
- CONVERT(0x02, HFP_CONNECTION_STATE_CONNECTED),
- CONVERT(0x03, HFP_CONNECTION_STATE_SLC_CONNECTED),
- CONVERT(0x04, HFP_CONNECTION_STATE_DISCONNECTING)
+ [0x00] = HFP_CONNECTION_STATE_DISCONNECTED,
+ [0x01] = HFP_CONNECTION_STATE_CONNECTING,
+ [0x02] = HFP_CONNECTION_STATE_CONNECTED,
+ [0x03] = HFP_CONNECTION_STATE_SLC_CONNECTED,
+ [0x04] = HFP_CONNECTION_STATE_DISCONNECTING
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sConnectionState))) {
return NS_ERROR_ILLEGAL_VALUE;
@@ -266,8 +266,8 @@ nsresult
Convert(uint8_t aIn, BluetoothHandsfreeNRECState& aOut)
{
static const BluetoothHandsfreeNRECState sNRECState[] = {
- CONVERT(0x00, HFP_NREC_STOPPED),
- CONVERT(0x01, HFP_NREC_STARTED)
+ [0x00] = HFP_NREC_STOPPED,
+ [0x01] = HFP_NREC_STARTED
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sNRECState))) {
return NS_ERROR_ILLEGAL_VALUE;
@@ -280,8 +280,8 @@ nsresult
Convert(uint8_t aIn, BluetoothHandsfreeVoiceRecognitionState& aOut)
{
static const BluetoothHandsfreeVoiceRecognitionState sState[] = {
- CONVERT(0x00, HFP_VOICE_RECOGNITION_STOPPED),
- CONVERT(0x01, HFP_VOICE_RECOGNITION_STOPPED)
+ [0x00] = HFP_VOICE_RECOGNITION_STOPPED,
+ [0x01] = HFP_VOICE_RECOGNITION_STARTED
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sState))) {
return NS_ERROR_ILLEGAL_VALUE;
@@ -294,8 +294,8 @@ nsresult
Convert(uint8_t aIn, BluetoothHandsfreeVolumeType& aOut)
{
static const BluetoothHandsfreeVolumeType sVolumeType[] = {
- CONVERT(0x00, HFP_VOLUME_TYPE_SPEAKER),
- CONVERT(0x01, HFP_VOLUME_TYPE_MICROPHONE)
+ [0x00] = HFP_VOLUME_TYPE_SPEAKER,
+ [0x01] = HFP_VOLUME_TYPE_MICROPHONE
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sVolumeType))) {
return NS_ERROR_ILLEGAL_VALUE;
@@ -308,9 +308,9 @@ nsresult
Convert(uint8_t aIn, BluetoothHandsfreeWbsConfig& aOut)
{
static const BluetoothHandsfreeWbsConfig sWbsConfig[] = {
- CONVERT(0x00, HFP_WBS_NONE),
- CONVERT(0x01, HFP_WBS_NO),
- CONVERT(0x02, HFP_WBS_YES)
+ [0x00] = HFP_WBS_NONE,
+ [0x01] = HFP_WBS_NO,
+ [0x02] = HFP_WBS_YES
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sWbsConfig))) {
return NS_ERROR_ILLEGAL_VALUE;
@@ -329,19 +329,19 @@ nsresult
Convert(uint8_t aIn, BluetoothPropertyType& aOut)
{
static const BluetoothPropertyType sPropertyType[] = {
- CONVERT(0x00, static_cast(0)), // invalid, required by gcc
- CONVERT(0x01, PROPERTY_BDNAME),
- CONVERT(0x02, PROPERTY_BDADDR),
- CONVERT(0x03, PROPERTY_UUIDS),
- CONVERT(0x04, PROPERTY_CLASS_OF_DEVICE),
- CONVERT(0x05, PROPERTY_TYPE_OF_DEVICE),
- CONVERT(0x06, PROPERTY_SERVICE_RECORD),
- CONVERT(0x07, PROPERTY_ADAPTER_SCAN_MODE),
- CONVERT(0x08, PROPERTY_ADAPTER_BONDED_DEVICES),
- CONVERT(0x09, PROPERTY_ADAPTER_DISCOVERY_TIMEOUT),
- CONVERT(0x0a, PROPERTY_REMOTE_FRIENDLY_NAME),
- CONVERT(0x0b, PROPERTY_REMOTE_RSSI),
- CONVERT(0x0c, PROPERTY_REMOTE_VERSION_INFO)
+ [0x00] = static_cast(0), // invalid, required by gcc
+ [0x01] = PROPERTY_BDNAME,
+ [0x02] = PROPERTY_BDADDR,
+ [0x03] = PROPERTY_UUIDS,
+ [0x04] = PROPERTY_CLASS_OF_DEVICE,
+ [0x05] = PROPERTY_TYPE_OF_DEVICE,
+ [0x06] = PROPERTY_SERVICE_RECORD,
+ [0x07] = PROPERTY_ADAPTER_SCAN_MODE,
+ [0x08] = PROPERTY_ADAPTER_BONDED_DEVICES,
+ [0x09] = PROPERTY_ADAPTER_DISCOVERY_TIMEOUT,
+ [0x0a] = PROPERTY_REMOTE_FRIENDLY_NAME,
+ [0x0b] = PROPERTY_REMOTE_RSSI,
+ [0x0c] = PROPERTY_REMOTE_VERSION_INFO
};
if (aIn == 0xff) {
/* This case is handled separately to not populate
@@ -361,10 +361,10 @@ nsresult
Convert(BluetoothSocketType aIn, uint8_t& aOut)
{
static const uint8_t sSocketType[] = {
- CONVERT(0, 0), // silences compiler warning
- CONVERT(BluetoothSocketType::RFCOMM, 0x01),
- CONVERT(BluetoothSocketType::SCO, 0x02),
- CONVERT(BluetoothSocketType::L2CAP, 0x03)
+ [0] = 0, // silences compiler warning
+ [BluetoothSocketType::RFCOMM] = 0x01,
+ [BluetoothSocketType::SCO] = 0x02,
+ [BluetoothSocketType::L2CAP] = 0x03
// EL2CAP not supported
};
if (NS_WARN_IF(aIn == BluetoothSocketType::EL2CAP) ||
@@ -381,10 +381,10 @@ nsresult
Convert(uint8_t aIn, BluetoothSspVariant& aOut)
{
static const BluetoothSspVariant sSspVariant[] = {
- CONVERT(0x00, SSP_VARIANT_PASSKEY_CONFIRMATION),
- CONVERT(0x01, SSP_VARIANT_PASSKEY_ENTRY),
- CONVERT(0x02, SSP_VARIANT_CONSENT),
- CONVERT(0x03, SSP_VARIANT_PASSKEY_NOTIFICATION)
+ [0x00] = SSP_VARIANT_PASSKEY_CONFIRMATION,
+ [0x01] = SSP_VARIANT_PASSKEY_ENTRY,
+ [0x02] = SSP_VARIANT_CONSENT,
+ [0x03] = SSP_VARIANT_PASSKEY_NOTIFICATION
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sSspVariant))) {
return NS_ERROR_ILLEGAL_VALUE;
@@ -397,17 +397,17 @@ nsresult
Convert(uint8_t aIn, BluetoothStatus& aOut)
{
static const BluetoothStatus sStatus[] = {
- CONVERT(0x00, STATUS_SUCCESS),
- CONVERT(0x01, STATUS_FAIL),
- CONVERT(0x02, STATUS_NOT_READY),
- CONVERT(0x03, STATUS_NOMEM),
- CONVERT(0x04, STATUS_BUSY),
- CONVERT(0x05, STATUS_DONE),
- CONVERT(0x06, STATUS_UNSUPPORTED),
- CONVERT(0x07, STATUS_PARM_INVALID),
- CONVERT(0x08, STATUS_UNHANDLED),
- CONVERT(0x09, STATUS_AUTH_FAILURE),
- CONVERT(0x0a, STATUS_RMT_DEV_DOWN)
+ [0x00] = STATUS_SUCCESS,
+ [0x01] = STATUS_FAIL,
+ [0x02] = STATUS_NOT_READY,
+ [0x03] = STATUS_NOMEM,
+ [0x04] = STATUS_BUSY,
+ [0x05] = STATUS_DONE,
+ [0x06] = STATUS_UNSUPPORTED,
+ [0x07] = STATUS_PARM_INVALID,
+ [0x08] = STATUS_UNHANDLED,
+ [0x09] = STATUS_AUTH_FAILURE,
+ [0x0a] = STATUS_RMT_DEV_DOWN
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sStatus))) {
return NS_ERROR_ILLEGAL_VALUE;
@@ -421,24 +421,24 @@ Convert(int32_t aIn, BluetoothGattStatus& aOut)
{
/* Reference: $B2G/external/bluetooth/bluedroid/stack/include/gatt_api.h */
static const BluetoothGattStatus sGattStatus[] = {
- CONVERT(0x0000, GATT_STATUS_SUCCESS),
- CONVERT(0x0001, GATT_STATUS_INVALID_HANDLE),
- CONVERT(0x0002, GATT_STATUS_READ_NOT_PERMITTED),
- CONVERT(0x0003, GATT_STATUS_WRITE_NOT_PERMITTED),
- CONVERT(0x0004, GATT_STATUS_INVALID_PDU),
- CONVERT(0x0005, GATT_STATUS_INSUFFICIENT_AUTHENTICATION),
- CONVERT(0x0006, GATT_STATUS_REQUEST_NOT_SUPPORTED),
- CONVERT(0x0007, GATT_STATUS_INVALID_OFFSET),
- CONVERT(0x0008, GATT_STATUS_INSUFFICIENT_AUTHORIZATION),
- CONVERT(0x0009, GATT_STATUS_PREPARE_QUEUE_FULL),
- CONVERT(0x000a, GATT_STATUS_ATTRIBUTE_NOT_FOUND),
- CONVERT(0x000b, GATT_STATUS_ATTRIBUTE_NOT_LONG),
- CONVERT(0x000c, GATT_STATUS_INSUFFICIENT_ENCRYPTION_KEY_SIZE),
- CONVERT(0x000d, GATT_STATUS_INVALID_ATTRIBUTE_LENGTH),
- CONVERT(0x000e, GATT_STATUS_UNLIKELY_ERROR),
- CONVERT(0x000f, GATT_STATUS_INSUFFICIENT_ENCRYPTION),
- CONVERT(0x0010, GATT_STATUS_UNSUPPORTED_GROUP_TYPE),
- CONVERT(0x0011, GATT_STATUS_INSUFFICIENT_RESOURCES)
+ [0x0000] = GATT_STATUS_SUCCESS,
+ [0x0001] = GATT_STATUS_INVALID_HANDLE,
+ [0x0002] = GATT_STATUS_READ_NOT_PERMITTED,
+ [0x0003] = GATT_STATUS_WRITE_NOT_PERMITTED,
+ [0x0004] = GATT_STATUS_INVALID_PDU,
+ [0x0005] = GATT_STATUS_INSUFFICIENT_AUTHENTICATION,
+ [0x0006] = GATT_STATUS_REQUEST_NOT_SUPPORTED,
+ [0x0007] = GATT_STATUS_INVALID_OFFSET,
+ [0x0008] = GATT_STATUS_INSUFFICIENT_AUTHORIZATION,
+ [0x0009] = GATT_STATUS_PREPARE_QUEUE_FULL,
+ [0x000a] = GATT_STATUS_ATTRIBUTE_NOT_FOUND,
+ [0x000b] = GATT_STATUS_ATTRIBUTE_NOT_LONG,
+ [0x000c] = GATT_STATUS_INSUFFICIENT_ENCRYPTION_KEY_SIZE,
+ [0x000d] = GATT_STATUS_INVALID_ATTRIBUTE_LENGTH,
+ [0x000e] = GATT_STATUS_UNLIKELY_ERROR,
+ [0x000f] = GATT_STATUS_INSUFFICIENT_ENCRYPTION,
+ [0x0010] = GATT_STATUS_UNSUPPORTED_GROUP_TYPE,
+ [0x0011] = GATT_STATUS_INSUFFICIENT_RESOURCES
};
if (NS_WARN_IF(aIn < 0) ||
NS_WARN_IF(aIn >= static_cast(MOZ_ARRAY_LENGTH(sGattStatus)))) {
@@ -541,8 +541,8 @@ nsresult
Convert(BluetoothAclState aIn, bool& aOut)
{
static const bool sBool[] = {
- CONVERT(ACL_STATE_CONNECTED, true),
- CONVERT(ACL_STATE_DISCONNECTED, false)
+ [ACL_STATE_CONNECTED] = true,
+ [ACL_STATE_DISCONNECTED] = false
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sBool))) {
return NS_ERROR_ILLEGAL_VALUE;
@@ -578,12 +578,12 @@ nsresult
Convert(BluetoothAvrcpEvent aIn, uint8_t& aOut)
{
static const uint8_t sValue[] = {
- CONVERT(AVRCP_EVENT_PLAY_STATUS_CHANGED, 0x01),
- CONVERT(AVRCP_EVENT_TRACK_CHANGE, 0x02),
- CONVERT(AVRCP_EVENT_TRACK_REACHED_END, 0x03),
- CONVERT(AVRCP_EVENT_TRACK_REACHED_START, 0x04),
- CONVERT(AVRCP_EVENT_PLAY_POS_CHANGED, 0x05),
- CONVERT(AVRCP_EVENT_APP_SETTINGS_CHANGED, 0x08)
+ [AVRCP_EVENT_PLAY_STATUS_CHANGED] = 0x01,
+ [AVRCP_EVENT_TRACK_CHANGE] = 0x02,
+ [AVRCP_EVENT_TRACK_REACHED_END] = 0x03,
+ [AVRCP_EVENT_TRACK_REACHED_START] = 0x04,
+ [AVRCP_EVENT_PLAY_POS_CHANGED] = 0x05,
+ [AVRCP_EVENT_APP_SETTINGS_CHANGED] = 0x08
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sValue))) {
return NS_ERROR_ILLEGAL_VALUE;
@@ -596,8 +596,8 @@ nsresult
Convert(BluetoothAvrcpNotification aIn, uint8_t& aOut)
{
static const bool sValue[] = {
- CONVERT(AVRCP_NTF_INTERIM, 0x00),
- CONVERT(AVRCP_NTF_CHANGED, 0x01)
+ [AVRCP_NTF_INTERIM] = 0x00,
+ [AVRCP_NTF_CHANGED] = 0x01
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sValue))) {
return NS_ERROR_ILLEGAL_VALUE;
@@ -610,10 +610,10 @@ nsresult
Convert(BluetoothAvrcpPlayerAttribute aIn, uint8_t& aOut)
{
static const uint8_t sValue[] = {
- CONVERT(AVRCP_PLAYER_ATTRIBUTE_EQUALIZER, 0x01),
- CONVERT(AVRCP_PLAYER_ATTRIBUTE_REPEAT, 0x02),
- CONVERT(AVRCP_PLAYER_ATTRIBUTE_SHUFFLE, 0x03),
- CONVERT(AVRCP_PLAYER_ATTRIBUTE_SCAN, 0x04)
+ [AVRCP_PLAYER_ATTRIBUTE_EQUALIZER] = 0x01,
+ [AVRCP_PLAYER_ATTRIBUTE_REPEAT] = 0x02,
+ [AVRCP_PLAYER_ATTRIBUTE_SHUFFLE] = 0x03,
+ [AVRCP_PLAYER_ATTRIBUTE_SCAN] = 0x04
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sValue))) {
return NS_ERROR_ILLEGAL_VALUE;
@@ -638,11 +638,11 @@ nsresult
Convert(BluetoothAvrcpStatus aIn, uint8_t& aOut)
{
static const uint8_t sValue[] = {
- CONVERT(AVRCP_STATUS_BAD_COMMAND, 0x00),
- CONVERT(AVRCP_STATUS_BAD_PARAMETER, 0x01),
- CONVERT(AVRCP_STATUS_NOT_FOUND, 0x02),
- CONVERT(AVRCP_STATUS_INTERNAL_ERROR, 0x03),
- CONVERT(AVRCP_STATUS_SUCCESS, 0x04)
+ [AVRCP_STATUS_BAD_COMMAND] = 0x00,
+ [AVRCP_STATUS_BAD_PARAMETER] = 0x01,
+ [AVRCP_STATUS_NOT_FOUND] = 0x02,
+ [AVRCP_STATUS_INTERNAL_ERROR] = 0x03,
+ [AVRCP_STATUS_SUCCESS] = 0x04
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sValue))) {
return NS_ERROR_ILLEGAL_VALUE;
@@ -655,8 +655,8 @@ nsresult
Convert(BluetoothHandsfreeAtResponse aIn, uint8_t& aOut)
{
static const uint8_t sAtResponse[] = {
- CONVERT(HFP_AT_RESPONSE_ERROR, 0x00),
- CONVERT(HFP_AT_RESPONSE_OK, 0x01)
+ [HFP_AT_RESPONSE_ERROR] = 0x00,
+ [HFP_AT_RESPONSE_OK] = 0x01
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sAtResponse))) {
aOut = 0x00; // silences compiler warning
@@ -670,8 +670,8 @@ nsresult
Convert(BluetoothHandsfreeCallAddressType aIn, uint8_t& aOut)
{
static const uint8_t sCallAddressType[] = {
- CONVERT(HFP_CALL_ADDRESS_TYPE_UNKNOWN, 0x81),
- CONVERT(HFP_CALL_ADDRESS_TYPE_INTERNATIONAL, 0x91)
+ [HFP_CALL_ADDRESS_TYPE_UNKNOWN] = 0x81,
+ [HFP_CALL_ADDRESS_TYPE_INTERNATIONAL] = 0x91
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sCallAddressType))) {
aOut = 0x00; // silences compiler warning
@@ -685,8 +685,8 @@ nsresult
Convert(BluetoothHandsfreeCallDirection aIn, uint8_t& aOut)
{
static const uint8_t sCallDirection[] = {
- CONVERT(HFP_CALL_DIRECTION_OUTGOING, 0x00),
- CONVERT(HFP_CALL_DIRECTION_INCOMING, 0x01)
+ [HFP_CALL_DIRECTION_OUTGOING] = 0x00,
+ [HFP_CALL_DIRECTION_INCOMING] = 0x01
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sCallDirection))) {
aOut = 0x00; // silences compiler warning
@@ -700,13 +700,13 @@ nsresult
Convert(BluetoothHandsfreeCallState aIn, uint8_t& aOut)
{
static const uint8_t sCallState[] = {
- CONVERT(HFP_CALL_STATE_ACTIVE, 0x00),
- CONVERT(HFP_CALL_STATE_HELD, 0x01),
- CONVERT(HFP_CALL_STATE_DIALING, 0x02),
- CONVERT(HFP_CALL_STATE_ALERTING, 0x03),
- CONVERT(HFP_CALL_STATE_INCOMING, 0x04),
- CONVERT(HFP_CALL_STATE_WAITING, 0x05),
- CONVERT(HFP_CALL_STATE_IDLE, 0x06)
+ [HFP_CALL_STATE_ACTIVE] = 0x00,
+ [HFP_CALL_STATE_HELD] = 0x01,
+ [HFP_CALL_STATE_DIALING] = 0x02,
+ [HFP_CALL_STATE_ALERTING] = 0x03,
+ [HFP_CALL_STATE_INCOMING] = 0x04,
+ [HFP_CALL_STATE_WAITING] = 0x05,
+ [HFP_CALL_STATE_IDLE] = 0x06
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sCallState))) {
aOut = 0x00; // silences compiler warning
@@ -720,9 +720,9 @@ nsresult
Convert(BluetoothHandsfreeCallMode aIn, uint8_t& aOut)
{
static const uint8_t sCallMode[] = {
- CONVERT(HFP_CALL_MODE_VOICE, 0x00),
- CONVERT(HFP_CALL_MODE_DATA, 0x01),
- CONVERT(HFP_CALL_MODE_FAX, 0x02)
+ [HFP_CALL_MODE_VOICE] = 0x00,
+ [HFP_CALL_MODE_DATA] = 0x01,
+ [HFP_CALL_MODE_FAX] = 0x02
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sCallMode))) {
aOut = 0x00; // silences compiler warning
@@ -736,8 +736,8 @@ nsresult
Convert(BluetoothHandsfreeCallMptyType aIn, uint8_t& aOut)
{
static const uint8_t sCallMptyType[] = {
- CONVERT(HFP_CALL_MPTY_TYPE_SINGLE, 0x00),
- CONVERT(HFP_CALL_MPTY_TYPE_MULTI, 0x01)
+ [HFP_CALL_MPTY_TYPE_SINGLE] = 0x00,
+ [HFP_CALL_MPTY_TYPE_MULTI] = 0x01
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sCallMptyType))) {
aOut = 0x00; // silences compiler warning
@@ -751,8 +751,8 @@ nsresult
Convert(BluetoothHandsfreeNetworkState aIn, uint8_t& aOut)
{
static const uint8_t sNetworkState[] = {
- CONVERT(HFP_NETWORK_STATE_NOT_AVAILABLE, 0x00),
- CONVERT(HFP_NETWORK_STATE_AVAILABLE, 0x01)
+ [HFP_NETWORK_STATE_NOT_AVAILABLE] = 0x00,
+ [HFP_NETWORK_STATE_AVAILABLE] = 0x01
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sNetworkState))) {
aOut = 0x00; // silences compiler warning
@@ -766,8 +766,8 @@ nsresult
Convert(BluetoothHandsfreeServiceType aIn, uint8_t& aOut)
{
static const uint8_t sServiceType[] = {
- CONVERT(HFP_SERVICE_TYPE_HOME, 0x00),
- CONVERT(HFP_SERVICE_TYPE_ROAMING, 0x01)
+ [HFP_SERVICE_TYPE_HOME] = 0x00,
+ [HFP_SERVICE_TYPE_ROAMING] = 0x01
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sServiceType))) {
aOut = 0x00; // silences compiler warning
@@ -781,8 +781,8 @@ nsresult
Convert(BluetoothHandsfreeVolumeType aIn, uint8_t& aOut)
{
static const uint8_t sVolumeType[] = {
- CONVERT(HFP_VOLUME_TYPE_SPEAKER, 0x00),
- CONVERT(HFP_VOLUME_TYPE_MICROPHONE, 0x01)
+ [HFP_VOLUME_TYPE_SPEAKER] = 0x00,
+ [HFP_VOLUME_TYPE_MICROPHONE] = 0x01
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sVolumeType))) {
aOut = 0x00; // silences compiler warning
@@ -796,9 +796,9 @@ nsresult
Convert(BluetoothHandsfreeWbsConfig aIn, uint8_t& aOut)
{
static const uint8_t sWbsConfig[] = {
- CONVERT(HFP_WBS_NONE, 0x00),
- CONVERT(HFP_WBS_NO, 0x01),
- CONVERT(HFP_WBS_YES, 0x02)
+ [HFP_WBS_NONE] = 0x00,
+ [HFP_WBS_NO] = 0x01,
+ [HFP_WBS_YES] = 0x02
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sWbsConfig))) {
aOut = 0x00; // silences compiler warning
@@ -812,20 +812,20 @@ nsresult
Convert(BluetoothPropertyType aIn, uint8_t& aOut)
{
static const uint8_t sPropertyType[] = {
- CONVERT(PROPERTY_UNKNOWN, 0x00),
- CONVERT(PROPERTY_BDNAME, 0x01),
- CONVERT(PROPERTY_BDADDR, 0x02),
- CONVERT(PROPERTY_UUIDS, 0x03),
- CONVERT(PROPERTY_CLASS_OF_DEVICE, 0x04),
- CONVERT(PROPERTY_TYPE_OF_DEVICE, 0x05),
- CONVERT(PROPERTY_SERVICE_RECORD, 0x06),
- CONVERT(PROPERTY_ADAPTER_SCAN_MODE, 0x07),
- CONVERT(PROPERTY_ADAPTER_BONDED_DEVICES, 0x08),
- CONVERT(PROPERTY_ADAPTER_DISCOVERY_TIMEOUT, 0x09),
- CONVERT(PROPERTY_REMOTE_FRIENDLY_NAME, 0x0a),
- CONVERT(PROPERTY_REMOTE_RSSI, 0x0b),
- CONVERT(PROPERTY_REMOTE_VERSION_INFO, 0x0c),
- CONVERT(PROPERTY_REMOTE_DEVICE_TIMESTAMP, 0xff)
+ [PROPERTY_UNKNOWN] = 0x00,
+ [PROPERTY_BDNAME] = 0x01,
+ [PROPERTY_BDADDR] = 0x02,
+ [PROPERTY_UUIDS] = 0x03,
+ [PROPERTY_CLASS_OF_DEVICE] = 0x04,
+ [PROPERTY_TYPE_OF_DEVICE] = 0x05,
+ [PROPERTY_SERVICE_RECORD] = 0x06,
+ [PROPERTY_ADAPTER_SCAN_MODE] = 0x07,
+ [PROPERTY_ADAPTER_BONDED_DEVICES] = 0x08,
+ [PROPERTY_ADAPTER_DISCOVERY_TIMEOUT] = 0x09,
+ [PROPERTY_REMOTE_FRIENDLY_NAME] = 0x0a,
+ [PROPERTY_REMOTE_RSSI] = 0x0b,
+ [PROPERTY_REMOTE_VERSION_INFO] = 0x0c,
+ [PROPERTY_REMOTE_DEVICE_TIMESTAMP] = 0xff
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sPropertyType))) {
aOut = 0x00; // silences compiler warning
@@ -851,9 +851,9 @@ nsresult
Convert(BluetoothScanMode aIn, int32_t& aOut)
{
static const int32_t sScanMode[] = {
- CONVERT(SCAN_MODE_NONE, 0x00),
- CONVERT(SCAN_MODE_CONNECTABLE, 0x01),
- CONVERT(SCAN_MODE_CONNECTABLE_DISCOVERABLE, 0x02)
+ [SCAN_MODE_NONE] = 0x00,
+ [SCAN_MODE_CONNECTABLE] = 0x01,
+ [SCAN_MODE_CONNECTABLE_DISCOVERABLE] = 0x02
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sScanMode))) {
aOut = 0; // silences compiler warning
@@ -867,10 +867,10 @@ nsresult
Convert(BluetoothSspVariant aIn, uint8_t& aOut)
{
static const uint8_t sValue[] = {
- CONVERT(SSP_VARIANT_PASSKEY_CONFIRMATION, 0x00),
- CONVERT(SSP_VARIANT_PASSKEY_ENTRY, 0x01),
- CONVERT(SSP_VARIANT_CONSENT, 0x02),
- CONVERT(SSP_VARIANT_PASSKEY_NOTIFICATION, 0x03)
+ [SSP_VARIANT_PASSKEY_CONFIRMATION] = 0x00,
+ [SSP_VARIANT_PASSKEY_ENTRY] = 0x01,
+ [SSP_VARIANT_CONSENT] = 0x02,
+ [SSP_VARIANT_PASSKEY_NOTIFICATION] = 0x03
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sValue))) {
aOut = 0; // silences compiler warning
@@ -884,11 +884,11 @@ nsresult
Convert(ControlPlayStatus aIn, uint8_t& aOut)
{
static const uint8_t sValue[] = {
- CONVERT(PLAYSTATUS_STOPPED, 0x00),
- CONVERT(PLAYSTATUS_PLAYING, 0x01),
- CONVERT(PLAYSTATUS_PAUSED, 0x02),
- CONVERT(PLAYSTATUS_FWD_SEEK, 0x03),
- CONVERT(PLAYSTATUS_REV_SEEK, 0x04)
+ [PLAYSTATUS_STOPPED] = 0x00,
+ [PLAYSTATUS_PLAYING] = 0x01,
+ [PLAYSTATUS_PAUSED] = 0x02,
+ [PLAYSTATUS_FWD_SEEK] = 0x03,
+ [PLAYSTATUS_REV_SEEK] = 0x04
};
if (aIn == PLAYSTATUS_ERROR) {
/* This case is handled separately to not populate
@@ -908,11 +908,11 @@ nsresult
Convert(BluetoothGattAuthReq aIn, int32_t& aOut)
{
static const int32_t sGattAuthReq[] = {
- CONVERT(GATT_AUTH_REQ_NONE, 0x00),
- CONVERT(GATT_AUTH_REQ_NO_MITM, 0x01),
- CONVERT(GATT_AUTH_REQ_MITM, 0x02),
- CONVERT(GATT_AUTH_REQ_SIGNED_NO_MITM, 0x03),
- CONVERT(GATT_AUTH_REQ_SIGNED_MITM, 0x04)
+ [GATT_AUTH_REQ_NONE] = 0x00,
+ [GATT_AUTH_REQ_NO_MITM] = 0x01,
+ [GATT_AUTH_REQ_MITM] = 0x02,
+ [GATT_AUTH_REQ_SIGNED_NO_MITM] = 0x03,
+ [GATT_AUTH_REQ_SIGNED_MITM] = 0x04
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sGattAuthReq))) {
aOut = GATT_AUTH_REQ_NONE; // silences compiler warning
@@ -926,10 +926,10 @@ nsresult
Convert(BluetoothGattWriteType aIn, int32_t& aOut)
{
static const int32_t sGattWriteType[] = {
- CONVERT(GATT_WRITE_TYPE_NO_RESPONSE, 0x01),
- CONVERT(GATT_WRITE_TYPE_NORMAL, 0x02),
- CONVERT(GATT_WRITE_TYPE_PREPARE, 0x03),
- CONVERT(GATT_WRITE_TYPE_SIGNED, 0x04)
+ [GATT_WRITE_TYPE_NO_RESPONSE] = 0x01,
+ [GATT_WRITE_TYPE_NORMAL] = 0x02,
+ [GATT_WRITE_TYPE_PREPARE] = 0x03,
+ [GATT_WRITE_TYPE_SIGNED] = 0x04
};
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sGattWriteType))) {
aOut = GATT_WRITE_TYPE_NORMAL; // silences compiler warning
diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp b/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp
index 69568db8dec8..99fff7c6ebea 100644
--- a/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp
+++ b/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp
@@ -113,10 +113,10 @@ protected:
const DaemonSocketPDUHeader&,
DaemonSocketPDU&,
BluetoothSetupResultHandler*) = {
- INIT_ARRAY_AT(0x00, &BluetoothDaemonSetupModule::ErrorRsp),
- INIT_ARRAY_AT(0x01, &BluetoothDaemonSetupModule::RegisterModuleRsp),
- INIT_ARRAY_AT(0x02, &BluetoothDaemonSetupModule::UnregisterModuleRsp),
- INIT_ARRAY_AT(0x03, &BluetoothDaemonSetupModule::ConfigurationRsp)
+ [0x00] = &BluetoothDaemonSetupModule::ErrorRsp,
+ [0x01] = &BluetoothDaemonSetupModule::RegisterModuleRsp,
+ [0x02] = &BluetoothDaemonSetupModule::UnregisterModuleRsp,
+ [0x03] = &BluetoothDaemonSetupModule::ConfigurationRsp
};
if (NS_WARN_IF(aHeader.mOpcode >= MOZ_ARRAY_LENGTH(HandleRsp)) ||
@@ -604,8 +604,8 @@ protected:
{
static void (BluetoothDaemonCoreModule::* const HandleOp[])(
const DaemonSocketPDUHeader&, DaemonSocketPDU&, void*) = {
- INIT_ARRAY_AT(0, &BluetoothDaemonCoreModule::HandleRsp),
- INIT_ARRAY_AT(1, &BluetoothDaemonCoreModule::HandleNtf),
+ [0] = &BluetoothDaemonCoreModule::HandleRsp,
+ [1] = &BluetoothDaemonCoreModule::HandleNtf
};
MOZ_ASSERT(!NS_IsMainThread());
@@ -831,31 +831,27 @@ private:
const DaemonSocketPDUHeader&,
DaemonSocketPDU&,
BluetoothResultHandler*) = {
- INIT_ARRAY_AT(0x00, &BluetoothDaemonCoreModule::ErrorRsp),
- INIT_ARRAY_AT(0x01, &BluetoothDaemonCoreModule::EnableRsp),
- INIT_ARRAY_AT(0x02, &BluetoothDaemonCoreModule::DisableRsp),
- INIT_ARRAY_AT(0x03, &BluetoothDaemonCoreModule::GetAdapterPropertiesRsp),
- INIT_ARRAY_AT(0x04, &BluetoothDaemonCoreModule::GetAdapterPropertyRsp),
- INIT_ARRAY_AT(0x05, &BluetoothDaemonCoreModule::SetAdapterPropertyRsp),
- INIT_ARRAY_AT(0x06,
- &BluetoothDaemonCoreModule::GetRemoteDevicePropertiesRsp),
- INIT_ARRAY_AT(0x07,
- &BluetoothDaemonCoreModule::GetRemoteDevicePropertyRsp),
- INIT_ARRAY_AT(0x08,
- &BluetoothDaemonCoreModule::SetRemoteDevicePropertyRsp),
- INIT_ARRAY_AT(0x09,
- &BluetoothDaemonCoreModule::GetRemoteServiceRecordRsp),
- INIT_ARRAY_AT(0x0a, &BluetoothDaemonCoreModule::GetRemoteServicesRsp),
- INIT_ARRAY_AT(0x0b, &BluetoothDaemonCoreModule::StartDiscoveryRsp),
- INIT_ARRAY_AT(0x0c, &BluetoothDaemonCoreModule::CancelDiscoveryRsp),
- INIT_ARRAY_AT(0x0d, &BluetoothDaemonCoreModule::CreateBondRsp),
- INIT_ARRAY_AT(0x0e, &BluetoothDaemonCoreModule::RemoveBondRsp),
- INIT_ARRAY_AT(0x0f, &BluetoothDaemonCoreModule::CancelBondRsp),
- INIT_ARRAY_AT(0x10, &BluetoothDaemonCoreModule::PinReplyRsp),
- INIT_ARRAY_AT(0x11, &BluetoothDaemonCoreModule::SspReplyRsp),
- INIT_ARRAY_AT(0x12, &BluetoothDaemonCoreModule::DutModeConfigureRsp),
- INIT_ARRAY_AT(0x13, &BluetoothDaemonCoreModule::DutModeSendRsp),
- INIT_ARRAY_AT(0x14, &BluetoothDaemonCoreModule::LeTestModeRsp),
+ [0x00] = &BluetoothDaemonCoreModule::ErrorRsp,
+ [0x01] = &BluetoothDaemonCoreModule::EnableRsp,
+ [0x02] = &BluetoothDaemonCoreModule::DisableRsp,
+ [0x03] = &BluetoothDaemonCoreModule::GetAdapterPropertiesRsp,
+ [0x04] = &BluetoothDaemonCoreModule::GetAdapterPropertyRsp,
+ [0x05] = &BluetoothDaemonCoreModule::SetAdapterPropertyRsp,
+ [0x06] = &BluetoothDaemonCoreModule::GetRemoteDevicePropertiesRsp,
+ [0x07] = &BluetoothDaemonCoreModule::GetRemoteDevicePropertyRsp,
+ [0x08] = &BluetoothDaemonCoreModule::SetRemoteDevicePropertyRsp,
+ [0x09] = &BluetoothDaemonCoreModule::GetRemoteServiceRecordRsp,
+ [0x0a] = &BluetoothDaemonCoreModule::GetRemoteServicesRsp,
+ [0x0b] = &BluetoothDaemonCoreModule::StartDiscoveryRsp,
+ [0x0c] = &BluetoothDaemonCoreModule::CancelDiscoveryRsp,
+ [0x0d] = &BluetoothDaemonCoreModule::CreateBondRsp,
+ [0x0e] = &BluetoothDaemonCoreModule::RemoveBondRsp,
+ [0x0f] = &BluetoothDaemonCoreModule::CancelBondRsp,
+ [0x10] = &BluetoothDaemonCoreModule::PinReplyRsp,
+ [0x11] = &BluetoothDaemonCoreModule::SspReplyRsp,
+ [0x12] = &BluetoothDaemonCoreModule::DutModeConfigureRsp,
+ [0x13] = &BluetoothDaemonCoreModule::DutModeSendRsp,
+ [0x14] = &BluetoothDaemonCoreModule::LeTestModeRsp,
};
MOZ_ASSERT(!NS_IsMainThread());
@@ -1353,17 +1349,17 @@ private:
{
static void (BluetoothDaemonCoreModule::* const HandleNtf[])(
const DaemonSocketPDUHeader&, DaemonSocketPDU&) = {
- INIT_ARRAY_AT(0, &BluetoothDaemonCoreModule::AdapterStateChangedNtf),
- INIT_ARRAY_AT(1, &BluetoothDaemonCoreModule::AdapterPropertiesNtf),
- INIT_ARRAY_AT(2, &BluetoothDaemonCoreModule::RemoteDevicePropertiesNtf),
- INIT_ARRAY_AT(3, &BluetoothDaemonCoreModule::DeviceFoundNtf),
- INIT_ARRAY_AT(4, &BluetoothDaemonCoreModule::DiscoveryStateChangedNtf),
- INIT_ARRAY_AT(5, &BluetoothDaemonCoreModule::PinRequestNtf),
- INIT_ARRAY_AT(6, &BluetoothDaemonCoreModule::SspRequestNtf),
- INIT_ARRAY_AT(7, &BluetoothDaemonCoreModule::BondStateChangedNtf),
- INIT_ARRAY_AT(8, &BluetoothDaemonCoreModule::AclStateChangedNtf),
- INIT_ARRAY_AT(9, &BluetoothDaemonCoreModule::DutModeRecvNtf),
- INIT_ARRAY_AT(10, &BluetoothDaemonCoreModule::LeTestModeNtf)
+ [0] = &BluetoothDaemonCoreModule::AdapterStateChangedNtf,
+ [1] = &BluetoothDaemonCoreModule::AdapterPropertiesNtf,
+ [2] = &BluetoothDaemonCoreModule::RemoteDevicePropertiesNtf,
+ [3] = &BluetoothDaemonCoreModule::DeviceFoundNtf,
+ [4] = &BluetoothDaemonCoreModule::DiscoveryStateChangedNtf,
+ [5] = &BluetoothDaemonCoreModule::PinRequestNtf,
+ [6] = &BluetoothDaemonCoreModule::SspRequestNtf,
+ [7] = &BluetoothDaemonCoreModule::BondStateChangedNtf,
+ [8] = &BluetoothDaemonCoreModule::AclStateChangedNtf,
+ [9] = &BluetoothDaemonCoreModule::DutModeRecvNtf,
+ [10] = &BluetoothDaemonCoreModule::LeTestModeNtf
};
MOZ_ASSERT(!NS_IsMainThread());
@@ -1594,20 +1590,20 @@ BluetoothDaemonProtocol::Handle(DaemonSocketPDU& aPDU)
{
static void (BluetoothDaemonProtocol::* const HandleSvc[])(
const DaemonSocketPDUHeader&, DaemonSocketPDU&, void*) = {
- INIT_ARRAY_AT(0x00, &BluetoothDaemonProtocol::HandleSetupSvc),
- INIT_ARRAY_AT(0x01, &BluetoothDaemonProtocol::HandleCoreSvc),
- INIT_ARRAY_AT(0x02, &BluetoothDaemonProtocol::HandleSocketSvc),
- INIT_ARRAY_AT(0x03, nullptr), // HID host
- INIT_ARRAY_AT(0x04, nullptr), // PAN
- INIT_ARRAY_AT(BluetoothDaemonHandsfreeModule::SERVICE_ID,
- &BluetoothDaemonProtocol::HandleHandsfreeSvc),
- INIT_ARRAY_AT(BluetoothDaemonA2dpModule::SERVICE_ID,
- &BluetoothDaemonProtocol::HandleA2dpSvc),
- INIT_ARRAY_AT(0x07, nullptr), // Health
- INIT_ARRAY_AT(BluetoothDaemonAvrcpModule::SERVICE_ID,
- &BluetoothDaemonProtocol::HandleAvrcpSvc),
- INIT_ARRAY_AT(BluetoothDaemonGattModule::SERVICE_ID,
- &BluetoothDaemonProtocol::HandleGattSvc)
+ [0x00] = &BluetoothDaemonProtocol::HandleSetupSvc,
+ [0x01] = &BluetoothDaemonProtocol::HandleCoreSvc,
+ [0x02] = &BluetoothDaemonProtocol::HandleSocketSvc,
+ [0x03] = nullptr, // HID host
+ [0x04] = nullptr, // PAN
+ [BluetoothDaemonHandsfreeModule::SERVICE_ID] =
+ &BluetoothDaemonProtocol::HandleHandsfreeSvc,
+ [BluetoothDaemonA2dpModule::SERVICE_ID] =
+ &BluetoothDaemonProtocol::HandleA2dpSvc,
+ [0x07] = nullptr, // Health
+ [BluetoothDaemonAvrcpModule::SERVICE_ID] =
+ &BluetoothDaemonProtocol::HandleAvrcpSvc,
+ [BluetoothDaemonGattModule::SERVICE_ID] =
+ &BluetoothDaemonProtocol::HandleGattSvc
};
DaemonSocketPDUHeader header;
diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonSocketInterface.cpp b/dom/bluetooth/bluedroid/BluetoothDaemonSocketInterface.cpp
index 4d0b1b4ca52d..95e13404d26e 100644
--- a/dom/bluetooth/bluedroid/BluetoothDaemonSocketInterface.cpp
+++ b/dom/bluetooth/bluedroid/BluetoothDaemonSocketInterface.cpp
@@ -166,9 +166,9 @@ BluetoothDaemonSocketModule::HandleSvc(const DaemonSocketPDUHeader& aHeader,
const DaemonSocketPDUHeader&,
DaemonSocketPDU&,
BluetoothSocketResultHandler*) = {
- INIT_ARRAY_AT(0x00, &BluetoothDaemonSocketModule::ErrorRsp),
- INIT_ARRAY_AT(0x01, &BluetoothDaemonSocketModule::ListenRsp),
- INIT_ARRAY_AT(0x02, &BluetoothDaemonSocketModule::ConnectRsp),
+ [0x00] = &BluetoothDaemonSocketModule::ErrorRsp,
+ [0x01] = &BluetoothDaemonSocketModule::ListenRsp,
+ [0x02] = &BluetoothDaemonSocketModule::ConnectRsp
};
if (NS_WARN_IF(MOZ_ARRAY_LENGTH(HandleRsp) <= aHeader.mOpcode) ||
diff --git a/dom/bluetooth/bluetooth2/BluetoothDevice.cpp b/dom/bluetooth/bluetooth2/BluetoothDevice.cpp
index dd8060e8f5a2..1b514d202f78 100644
--- a/dom/bluetooth/bluetooth2/BluetoothDevice.cpp
+++ b/dom/bluetooth/bluetooth2/BluetoothDevice.cpp
@@ -128,9 +128,9 @@ BluetoothDeviceType
BluetoothDevice::ConvertUint32ToDeviceType(const uint32_t aValue)
{
static const BluetoothDeviceType sDeviceType[] = {
- CONVERT(TYPE_OF_DEVICE_BREDR, BluetoothDeviceType::Classic),
- CONVERT(TYPE_OF_DEVICE_BLE, BluetoothDeviceType::Le),
- CONVERT(TYPE_OF_DEVICE_DUAL, BluetoothDeviceType::Dual),
+ [TYPE_OF_DEVICE_BREDR] = BluetoothDeviceType::Classic,
+ [TYPE_OF_DEVICE_BLE] = BluetoothDeviceType::Le,
+ [TYPE_OF_DEVICE_DUAL] = BluetoothDeviceType::Dual,
};
BluetoothTypeOfDevice type = static_cast(aValue);
diff --git a/dom/events/DataTransfer.cpp b/dom/events/DataTransfer.cpp
index 20d9cb979779..ef757fc4fc5a 100644
--- a/dom/events/DataTransfer.cpp
+++ b/dom/events/DataTransfer.cpp
@@ -850,12 +850,14 @@ DataTransfer::GetFilesAndDirectories(ErrorResult& aRv)
{
nsCOMPtr parentNode = do_QueryInterface(mParent);
if (!parentNode) {
+ aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
nsCOMPtr global = parentNode->OwnerDoc()->GetScopeObject();
MOZ_ASSERT(global);
if (!global) {
+ aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
@@ -865,43 +867,44 @@ DataTransfer::GetFilesAndDirectories(ErrorResult& aRv)
}
if (!mFiles) {
- ErrorResult dummy;
- GetFiles(dummy);
- if (!mFiles) {
+ GetFiles(aRv);
+ if (NS_WARN_IF(aRv.Failed())) {
return nullptr;
}
}
Sequence filesAndDirsSeq;
- if (!filesAndDirsSeq.SetLength(mFiles->Length(), mozilla::fallible_t())) {
- p->MaybeReject(NS_ERROR_OUT_OF_MEMORY);
- return p.forget();
- }
+ if (mFiles && mFiles->Length()) {
+ if (!filesAndDirsSeq.SetLength(mFiles->Length(), mozilla::fallible_t())) {
+ p->MaybeReject(NS_ERROR_OUT_OF_MEMORY);
+ return p.forget();
+ }
- nsPIDOMWindow* window = parentNode->OwnerDoc()->GetInnerWindow();
+ nsPIDOMWindow* window = parentNode->OwnerDoc()->GetInnerWindow();
- nsRefPtr fs;
- for (uint32_t i = 0; i < mFiles->Length(); ++i) {
- if (mFiles->Item(i)->Impl()->IsDirectory()) {
+ nsRefPtr fs;
+ for (uint32_t i = 0; i < mFiles->Length(); ++i) {
+ if (mFiles->Item(i)->Impl()->IsDirectory()) {
#if defined(ANDROID) || defined(MOZ_B2G)
- MOZ_ASSERT(false,
- "Directory picking should have been redirected to normal "
- "file picking for platforms that don't have a directory "
- "picker");
+ MOZ_ASSERT(false,
+ "Directory picking should have been redirected to normal "
+ "file picking for platforms that don't have a directory "
+ "picker");
#endif
- nsAutoString path;
- mFiles->Item(i)->GetMozFullPathInternal(path, aRv);
- if (aRv.Failed()) {
- return nullptr;
+ nsAutoString path;
+ mFiles->Item(i)->GetMozFullPathInternal(path, aRv);
+ if (aRv.Failed()) {
+ return nullptr;
+ }
+ int32_t leafSeparatorIndex = path.RFind(FILE_PATH_SEPARATOR);
+ nsDependentSubstring dirname = Substring(path, 0, leafSeparatorIndex);
+ nsDependentSubstring basename = Substring(path, leafSeparatorIndex);
+ fs = MakeOrReuseFileSystem(dirname, fs, window);
+ filesAndDirsSeq[i].SetAsDirectory() = new Directory(fs, basename);
+ } else {
+ filesAndDirsSeq[i].SetAsFile() = mFiles->Item(i);
}
- int32_t leafSeparatorIndex = path.RFind(FILE_PATH_SEPARATOR);
- nsDependentSubstring dirname = Substring(path, 0, leafSeparatorIndex);
- nsDependentSubstring basename = Substring(path, leafSeparatorIndex);
- fs = MakeOrReuseFileSystem(dirname, fs, window);
- filesAndDirsSeq[i].SetAsDirectory() = new Directory(fs, basename);
- } else {
- filesAndDirsSeq[i].SetAsFile() = mFiles->Item(i);
}
}
diff --git a/dom/events/crashtests/1190036-1.html b/dom/events/crashtests/1190036-1.html
new file mode 100644
index 000000000000..00a6a25db6be
--- /dev/null
+++ b/dom/events/crashtests/1190036-1.html
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
diff --git a/dom/events/crashtests/crashtests.list b/dom/events/crashtests/crashtests.list
index 686b5b892318..1f22621e430e 100644
--- a/dom/events/crashtests/crashtests.list
+++ b/dom/events/crashtests/crashtests.list
@@ -9,6 +9,7 @@ load 1033343.html
load 1035654-1.html
load 1035654-2.html
load 1143972-1.html
+load 1190036-1.html
needs-focus load 1072137-1.html
load eventctor-nulldictionary.html
load eventctor-nullstorage.html
diff --git a/dom/media/AudioSegment.h b/dom/media/AudioSegment.h
index af90d81765ad..1e872e00116c 100644
--- a/dom/media/AudioSegment.h
+++ b/dom/media/AudioSegment.h
@@ -157,6 +157,16 @@ struct AudioChunk {
return static_cast(const_cast(mChannelData[aChannel]));
}
+ void ReleaseBufferIfShared()
+ {
+ if (mBuffer && mBuffer->IsShared()) {
+ // Remove pointers into the buffer, but keep the array allocation for
+ // chunk re-use.
+ mChannelData.ClearAndRetainStorage();
+ mBuffer = nullptr;
+ }
+ }
+
bool IsMuted() const { return mVolume == 0.0f; }
size_t SizeOfExcludingThisIfUnshared(MallocSizeOf aMallocSizeOf) const
diff --git a/dom/media/DecodedStream.cpp b/dom/media/DecodedStream.cpp
index 9396de33ae11..63d50cccea08 100644
--- a/dom/media/DecodedStream.cpp
+++ b/dom/media/DecodedStream.cpp
@@ -105,7 +105,7 @@ UpdateStreamBlocking(MediaStream* aStream, bool aBlocking)
*/
class DecodedStreamData {
public:
- DecodedStreamData(SourceMediaStream* aStream, bool aPlaying,
+ DecodedStreamData(SourceMediaStream* aStream,
MozPromiseHolder&& aPromise);
~DecodedStreamData();
bool IsFinished() const;
@@ -142,7 +142,7 @@ public:
bool mEOSVideoCompensation;
};
-DecodedStreamData::DecodedStreamData(SourceMediaStream* aStream, bool aPlaying,
+DecodedStreamData::DecodedStreamData(SourceMediaStream* aStream,
MozPromiseHolder&& aPromise)
: mAudioFramesWritten(0)
, mNextVideoTime(-1)
@@ -152,17 +152,15 @@ DecodedStreamData::DecodedStreamData(SourceMediaStream* aStream, bool aPlaying,
, mHaveSentFinishAudio(false)
, mHaveSentFinishVideo(false)
, mStream(aStream)
- , mPlaying(aPlaying)
+ , mPlaying(true)
, mEOSVideoCompensation(false)
{
// DecodedStreamGraphListener will resolve this promise.
mListener = new DecodedStreamGraphListener(mStream, Move(aPromise));
mStream->AddListener(mListener);
- // Block the stream if we are not playing.
- if (!aPlaying) {
- UpdateStreamBlocking(mStream, true);
- }
+ // mPlaying is initially true because MDSM won't start playback until playing
+ // becomes true. This is consistent with the settings of AudioSink.
}
DecodedStreamData::~DecodedStreamData()
@@ -358,7 +356,7 @@ DecodedStream::DecodedStream(AbstractThread* aOwnerThread,
MediaQueue& aAudioQueue,
MediaQueue& aVideoQueue)
: mOwnerThread(aOwnerThread)
- , mMonitor("DecodedStream::mMonitor")
+ , mShuttingDown(false)
, mPlaying(false)
, mVolume(1.0)
, mAudioQueue(aAudioQueue)
@@ -371,11 +369,17 @@ DecodedStream::~DecodedStream()
MOZ_ASSERT(mStartTime.isNothing(), "playback should've ended.");
}
+void
+DecodedStream::Shutdown()
+{
+ MOZ_ASSERT(NS_IsMainThread());
+ mShuttingDown = true;
+}
+
nsRefPtr
DecodedStream::StartPlayback(int64_t aStartTime, const MediaInfo& aInfo)
{
AssertOwnerThread();
- ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
MOZ_ASSERT(mStartTime.isNothing(), "playback already started.");
mStartTime.emplace(aStartTime);
@@ -413,7 +417,7 @@ DecodedStream::StartPlayback(int64_t aStartTime, const MediaInfo& aInfo)
void DecodedStream::StopPlayback()
{
AssertOwnerThread();
- ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
+
// Playback didn't even start at all.
if (mStartTime.isNothing()) {
return;
@@ -424,12 +428,19 @@ void DecodedStream::StopPlayback()
// Clear mData immediately when this playback session ends so we won't
// send data to the wrong stream in SendData() in next playback session.
- DecodedStreamData* data = mData.release();
- // mData is not yet created on the main thread.
- if (!data) {
+ DestroyData(Move(mData));
+}
+
+void
+DecodedStream::DestroyData(UniquePtr aData)
+{
+ AssertOwnerThread();
+
+ if (!aData) {
return;
}
+ DecodedStreamData* data = aData.release();
nsRefPtr self = this;
nsCOMPtr r = NS_NewRunnableFunction([=] () {
self->mOutputStreamManager.Disconnect();
@@ -442,35 +453,41 @@ void
DecodedStream::CreateData(MozPromiseHolder&& aPromise)
{
MOZ_ASSERT(NS_IsMainThread());
- ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
- MOZ_ASSERT(!mData, "Already created.");
// No need to create a source stream when there are no output streams. This
// happens when RemoveOutput() is called immediately after StartPlayback().
- // We also bail out when the playback session has ended. This happens when
- // StopPlayback() is called immediately after StartPlayback().
- if (!mOutputStreamManager.Graph() || mStartTime.isNothing()) {
+ // Also we don't create a source stream when MDSM has begun shutdown.
+ if (!mOutputStreamManager.Graph() || mShuttingDown) {
// Resolve the promise to indicate the end of playback.
aPromise.Resolve(true, __func__);
return;
}
auto source = mOutputStreamManager.Graph()->CreateSourceStream(nullptr);
- mData.reset(new DecodedStreamData(source, mPlaying, Move(aPromise)));
- mOutputStreamManager.Connect(mData->mStream);
+ auto data = new DecodedStreamData(source, Move(aPromise));
+ mOutputStreamManager.Connect(data->mStream);
- // Start to send data to the stream immediately
- nsRefPtr self = this;
- nsCOMPtr r = NS_NewRunnableFunction([=] () {
- ReentrantMonitorAutoEnter mon(self->GetReentrantMonitor());
- // Don't send data if playback has ended.
- if (self->mStartTime.isSome()) {
- self->SendData();
+ class R : public nsRunnable {
+ typedef void(DecodedStream::*Method)(UniquePtr);
+ public:
+ R(DecodedStream* aThis, Method aMethod, DecodedStreamData* aData)
+ : mThis(aThis), mMethod(aMethod), mData(aData) {}
+ NS_IMETHOD Run() override
+ {
+ (mThis->*mMethod)(Move(mData));
+ return NS_OK;
}
- });
- // Don't assert success because the owner thread might have begun shutdown
- // while we are still dealing with jobs on the main thread.
- mOwnerThread->Dispatch(r.forget(), AbstractThread::DontAssertDispatchSuccess);
+ private:
+ nsRefPtr mThis;
+ Method mMethod;
+ UniquePtr mData;
+ };
+
+ // Post a message to ensure |mData| is only updated on the worker thread.
+ // Note this must be done before MDSM's shutdown since dispatch could fail
+ // when the worker thread is shut down.
+ nsCOMPtr r = new R(this, &DecodedStream::OnDataCreated, data);
+ mOwnerThread->Dispatch(r.forget());
}
bool
@@ -479,10 +496,22 @@ DecodedStream::HasConsumers() const
return !mOutputStreamManager.IsEmpty();
}
-ReentrantMonitor&
-DecodedStream::GetReentrantMonitor() const
+void
+DecodedStream::OnDataCreated(UniquePtr aData)
{
- return mMonitor;
+ AssertOwnerThread();
+ MOZ_ASSERT(!mData, "Already created.");
+
+ // Start to send data to the stream immediately
+ if (mStartTime.isSome()) {
+ aData->SetPlaying(mPlaying);
+ mData = Move(aData);
+ SendData();
+ return;
+ }
+
+ // Playback has ended. Destroy aData which is not needed anymore.
+ DestroyData(Move(aData));
}
void
@@ -501,7 +530,6 @@ void
DecodedStream::SetPlaying(bool aPlaying)
{
AssertOwnerThread();
- ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
mPlaying = aPlaying;
if (mData) {
mData->SetPlaying(aPlaying);
@@ -512,7 +540,6 @@ void
DecodedStream::SetVolume(double aVolume)
{
AssertOwnerThread();
- ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
mVolume = aVolume;
}
@@ -520,7 +547,6 @@ void
DecodedStream::SetSameOrigin(bool aSameOrigin)
{
AssertOwnerThread();
- ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
mSameOrigin = aSameOrigin;
}
@@ -528,7 +554,6 @@ void
DecodedStream::InitTracks()
{
AssertOwnerThread();
- GetReentrantMonitor().AssertCurrentThreadIn();
if (mData->mStreamInitialized) {
return;
@@ -609,7 +634,6 @@ void
DecodedStream::SendAudio(double aVolume, bool aIsSameOrigin)
{
AssertOwnerThread();
- GetReentrantMonitor().AssertCurrentThreadIn();
if (!mInfo.HasAudio()) {
return;
@@ -675,7 +699,6 @@ void
DecodedStream::SendVideo(bool aIsSameOrigin)
{
AssertOwnerThread();
- GetReentrantMonitor().AssertCurrentThreadIn();
if (!mInfo.HasVideo()) {
return;
@@ -754,7 +777,6 @@ void
DecodedStream::AdvanceTracks()
{
AssertOwnerThread();
- GetReentrantMonitor().AssertCurrentThreadIn();
StreamTime endPosition = 0;
@@ -779,7 +801,6 @@ void
DecodedStream::SendData()
{
AssertOwnerThread();
- ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
MOZ_ASSERT(mStartTime.isSome(), "Must be called after StartPlayback()");
// Not yet created on the main thread. MDSM will try again later.
@@ -810,7 +831,6 @@ int64_t
DecodedStream::AudioEndTime() const
{
AssertOwnerThread();
- ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
if (mStartTime.isSome() && mInfo.HasAudio() && mData) {
CheckedInt64 t = mStartTime.ref() +
FramesToUsecs(mData->mAudioFramesWritten, mInfo.mAudio.mRate);
@@ -825,7 +845,6 @@ int64_t
DecodedStream::GetPosition() const
{
AssertOwnerThread();
- ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
// This is only called after MDSM starts playback. So mStartTime is
// guaranteed to be something.
MOZ_ASSERT(mStartTime.isSome());
@@ -836,7 +855,6 @@ bool
DecodedStream::IsFinished() const
{
AssertOwnerThread();
- ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
return mData && mData->IsFinished();
}
@@ -844,7 +862,6 @@ void
DecodedStream::ConnectListener()
{
AssertOwnerThread();
- ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
mAudioPushListener = mAudioQueue.PushEvent().Connect(
mOwnerThread, this, &DecodedStream::SendData);
@@ -860,7 +877,6 @@ void
DecodedStream::DisconnectListener()
{
AssertOwnerThread();
- ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
mAudioPushListener.Disconnect();
mVideoPushListener.Disconnect();
diff --git a/dom/media/DecodedStream.h b/dom/media/DecodedStream.h
index adc7220bada3..463bd4ae2f07 100644
--- a/dom/media/DecodedStream.h
+++ b/dom/media/DecodedStream.h
@@ -106,6 +106,8 @@ public:
MediaQueue& aAudioQueue,
MediaQueue& aVideoQueue);
+ void Shutdown();
+
// Mimic MDSM::StartAudioThread.
// Must be called before any calls to SendData().
//
@@ -132,8 +134,9 @@ protected:
virtual ~DecodedStream();
private:
- ReentrantMonitor& GetReentrantMonitor() const;
void CreateData(MozPromiseHolder&& aPromise);
+ void DestroyData(UniquePtr aData);
+ void OnDataCreated(UniquePtr aData);
void InitTracks();
void AdvanceTracks();
void SendAudio(double aVolume, bool aIsSameOrigin);
@@ -149,18 +152,18 @@ private:
const nsRefPtr mOwnerThread;
- UniquePtr mData;
+ /*
+ * Main thread only members.
+ */
// Data about MediaStreams that are being fed by the decoder.
OutputStreamManager mOutputStreamManager;
+ // True if MDSM has begun shutdown.
+ bool mShuttingDown;
- // TODO: This is a temp solution to get rid of decoder monitor on the main
- // thread in MDSM::AddOutputStream and MDSM::RecreateDecodedStream as
- // required by bug 1146482. DecodedStream needs to release monitor before
- // calling back into MDSM functions in order to prevent deadlocks.
- //
- // Please move all capture-stream related code from MDSM into DecodedStream
- // and apply "dispatch + mirroring" to get rid of this monitor in the future.
- mutable ReentrantMonitor mMonitor;
+ /*
+ * Worker thread only members.
+ */
+ UniquePtr mData;
bool mPlaying;
double mVolume;
diff --git a/dom/media/MediaDecoderStateMachine.h b/dom/media/MediaDecoderStateMachine.h
index 09c73c98e137..41acca625284 100644
--- a/dom/media/MediaDecoderStateMachine.h
+++ b/dom/media/MediaDecoderStateMachine.h
@@ -171,6 +171,7 @@ public:
void DispatchShutdown()
{
+ mDecodedStream->Shutdown();
nsCOMPtr runnable =
NS_NewRunnableMethod(this, &MediaDecoderStateMachine::Shutdown);
OwnerThread()->Dispatch(runnable.forget());
diff --git a/dom/media/MediaRecorder.cpp b/dom/media/MediaRecorder.cpp
index db951c9a3eb7..5cb916f4d677 100644
--- a/dom/media/MediaRecorder.cpp
+++ b/dom/media/MediaRecorder.cpp
@@ -776,9 +776,10 @@ MediaRecorder::MediaRecorder(AudioNode& aSrcAudioNode,
if (aSrcAudioNode.NumberOfOutputs() > 0) {
AudioContext* ctx = aSrcAudioNode.Context();
AudioNodeEngine* engine = new AudioNodeEngine(nullptr);
- mPipeStream = ctx->Graph()->CreateAudioNodeStream(engine,
- MediaStreamGraph::EXTERNAL_STREAM,
- ctx->SampleRate());
+ AudioNodeStream::Flags flags =
+ AudioNodeStream::EXTERNAL_OUTPUT |
+ AudioNodeStream::NEED_MAIN_THREAD_FINISHED;
+ mPipeStream = AudioNodeStream::Create(ctx->Graph(), engine, flags);
AudioNodeStream* ns = aSrcAudioNode.GetStream();
if (ns) {
mInputPort = mPipeStream->AllocateInputPort(aSrcAudioNode.GetStream(),
diff --git a/dom/media/MediaStreamGraph.cpp b/dom/media/MediaStreamGraph.cpp
index 5466ba970abb..6ade109fafc2 100644
--- a/dom/media/MediaStreamGraph.cpp
+++ b/dom/media/MediaStreamGraph.cpp
@@ -20,7 +20,6 @@
#include "ImageContainer.h"
#include "AudioCaptureStream.h"
#include "AudioChannelService.h"
-#include "AudioNodeEngine.h"
#include "AudioNodeStream.h"
#include "AudioNodeExternalInputStream.h"
#include "mozilla/dom/AudioContextBinding.h"
@@ -86,7 +85,7 @@ MediaStreamGraphImpl::FinishStream(MediaStream* aStream)
static const GraphTime START_TIME_DELAYED = -1;
void
-MediaStreamGraphImpl::AddStream(MediaStream* aStream)
+MediaStreamGraphImpl::AddStreamGraphThread(MediaStream* aStream)
{
// Check if we're adding a stream to a suspended context, in which case, we
// add it to mSuspendedStreams, and delay setting mBufferStartTime
@@ -113,7 +112,7 @@ MediaStreamGraphImpl::AddStream(MediaStream* aStream)
}
void
-MediaStreamGraphImpl::RemoveStream(MediaStream* aStream)
+MediaStreamGraphImpl::RemoveStreamGraphThread(MediaStream* aStream)
{
// Remove references in mStreamUpdates before we allow aStream to die.
// Pending updates are not needed (since the main thread has already given
@@ -1641,7 +1640,7 @@ public:
explicit CreateMessage(MediaStream* aStream) : ControlMessage(aStream) {}
virtual void Run() override
{
- mStream->GraphImpl()->AddStream(mStream);
+ mStream->GraphImpl()->AddStreamGraphThread(mStream);
}
virtual void RunDuringShutdown() override
{
@@ -2055,7 +2054,7 @@ MediaStream::Destroy()
mStream->RemoveAllListenersImpl();
auto graph = mStream->GraphImpl();
mStream->DestroyImpl();
- graph->RemoveStream(mStream);
+ graph->RemoveStreamGraphThread(mStream);
}
virtual void RunDuringShutdown()
{ Run(); }
@@ -2383,9 +2382,8 @@ MediaStream::AddMainThreadListener(MainThreadMediaStreamListener* aListener)
mMainThreadListeners.AppendElement(aListener);
- // If we have to send the notification or we have a runnable that will do it,
- // let finish here.
- if (!mFinishedNotificationSent || mNotificationMainThreadRunnable) {
+ // If it is not yet time to send the notification, then finish here.
+ if (!mFinishedNotificationSent) {
return;
}
@@ -2399,7 +2397,6 @@ MediaStream::AddMainThreadListener(MainThreadMediaStreamListener* aListener)
NS_IMETHOD Run() override
{
MOZ_ASSERT(NS_IsMainThread());
- mStream->mNotificationMainThreadRunnable = nullptr;
mStream->NotifyMainThreadListeners();
return NS_OK;
}
@@ -2411,11 +2408,7 @@ MediaStream::AddMainThreadListener(MainThreadMediaStreamListener* aListener)
};
nsRefPtr runnable = new NotifyRunnable(this);
- if (NS_WARN_IF(NS_FAILED(NS_DispatchToMainThread(runnable.forget())))) {
- return;
- }
-
- mNotificationMainThreadRunnable = runnable;
+ NS_WARN_IF(NS_FAILED(NS_DispatchToMainThread(runnable.forget())));
}
void
@@ -2860,7 +2853,7 @@ ProcessedMediaStream::DestroyImpl()
MediaStream::DestroyImpl();
// The stream order is only important if there are connections, in which
// case MediaInputPort::Disconnect() called SetStreamOrderDirty().
- // MediaStreamGraphImpl::RemoveStream() will also call
+ // MediaStreamGraphImpl::RemoveStreamGraphThread() will also call
// SetStreamOrderDirty(), for other reasons.
}
@@ -3106,10 +3099,7 @@ SourceMediaStream*
MediaStreamGraph::CreateSourceStream(DOMMediaStream* aWrapper)
{
SourceMediaStream* stream = new SourceMediaStream(aWrapper);
- NS_ADDREF(stream);
- MediaStreamGraphImpl* graph = static_cast(this);
- stream->SetGraphImpl(graph);
- graph->AppendMessage(new CreateMessage(stream));
+ AddStream(stream);
return stream;
}
@@ -3117,10 +3107,7 @@ ProcessedMediaStream*
MediaStreamGraph::CreateTrackUnionStream(DOMMediaStream* aWrapper)
{
TrackUnionStream* stream = new TrackUnionStream(aWrapper);
- NS_ADDREF(stream);
- MediaStreamGraphImpl* graph = static_cast(this);
- stream->SetGraphImpl(graph);
- graph->AppendMessage(new CreateMessage(stream));
+ AddStream(stream);
return stream;
}
@@ -3128,54 +3115,17 @@ ProcessedMediaStream*
MediaStreamGraph::CreateAudioCaptureStream(DOMMediaStream* aWrapper)
{
AudioCaptureStream* stream = new AudioCaptureStream(aWrapper);
- NS_ADDREF(stream);
- MediaStreamGraphImpl* graph = static_cast(this);
- stream->SetGraphImpl(graph);
- graph->AppendMessage(new CreateMessage(stream));
+ AddStream(stream);
return stream;
}
-AudioNodeExternalInputStream*
-MediaStreamGraph::CreateAudioNodeExternalInputStream(AudioNodeEngine* aEngine, TrackRate aSampleRate)
+void
+MediaStreamGraph::AddStream(MediaStream* aStream)
{
- MOZ_ASSERT(NS_IsMainThread());
- if (!aSampleRate) {
- aSampleRate = aEngine->NodeMainThread()->Context()->SampleRate();
- }
- AudioNodeExternalInputStream* stream = new AudioNodeExternalInputStream(
- aEngine, aSampleRate, aEngine->NodeMainThread()->Context()->Id());
- NS_ADDREF(stream);
+ NS_ADDREF(aStream);
MediaStreamGraphImpl* graph = static_cast(this);
- stream->SetGraphImpl(graph);
- graph->AppendMessage(new CreateMessage(stream));
- return stream;
-}
-
-AudioNodeStream*
-MediaStreamGraph::CreateAudioNodeStream(AudioNodeEngine* aEngine,
- AudioNodeStreamKind aKind,
- TrackRate aSampleRate)
-{
- MOZ_ASSERT(NS_IsMainThread());
- if (!aSampleRate) {
- aSampleRate = aEngine->NodeMainThread()->Context()->SampleRate();
- }
- // MediaRecorders use an AudioNodeStream, but no AudioNode
- AudioNode* node = aEngine->NodeMainThread();
- dom::AudioContext::AudioContextId contextIdForStream = node ? node->Context()->Id() :
- NO_AUDIO_CONTEXT;
- AudioNodeStream* stream = new AudioNodeStream(aEngine, aKind, aSampleRate,
- contextIdForStream);
- NS_ADDREF(stream);
- MediaStreamGraphImpl* graph = static_cast(this);
- stream->SetGraphImpl(graph);
- if (aEngine->HasNode()) {
- stream->SetChannelMixingParametersImpl(aEngine->NodeMainThread()->ChannelCount(),
- aEngine->NodeMainThread()->ChannelCountModeValue(),
- aEngine->NodeMainThread()->ChannelInterpretationValue());
- }
- graph->AppendMessage(new CreateMessage(stream));
- return stream;
+ aStream->SetGraphImpl(graph);
+ graph->AppendMessage(new CreateMessage(aStream));
}
class GraphStartedRunnable final : public nsRunnable
diff --git a/dom/media/MediaStreamGraph.h b/dom/media/MediaStreamGraph.h
index 05d787cb1bbe..b81e7a21e4db 100644
--- a/dom/media/MediaStreamGraph.h
+++ b/dom/media/MediaStreamGraph.h
@@ -638,7 +638,6 @@ protected:
TimeVarying mExplicitBlockerCount;
nsTArray > mListeners;
nsTArray mMainThreadListeners;
- nsRefPtr mNotificationMainThreadRunnable;
nsTArray mDisabledTrackIDs;
// Precomputed blocking status (over GraphTime).
@@ -1241,23 +1240,11 @@ public:
* Create a stream that will mix all its audio input.
*/
ProcessedMediaStream* CreateAudioCaptureStream(DOMMediaStream* aWrapper);
- // Internal AudioNodeStreams can only pass their output to another
- // AudioNode, whereas external AudioNodeStreams can pass their output
- // to an nsAudioStream for playback.
- enum AudioNodeStreamKind { SOURCE_STREAM, INTERNAL_STREAM, EXTERNAL_STREAM };
- /**
- * Create a stream that will process audio for an AudioNode.
- * Takes ownership of aEngine. aSampleRate is the sampling rate used
- * for the stream. If 0 is passed, the sampling rate of the engine's
- * node will get used.
- */
- AudioNodeStream* CreateAudioNodeStream(AudioNodeEngine* aEngine,
- AudioNodeStreamKind aKind,
- TrackRate aSampleRate = 0);
- AudioNodeExternalInputStream*
- CreateAudioNodeExternalInputStream(AudioNodeEngine* aEngine,
- TrackRate aSampleRate = 0);
+ /**
+ * Add a new stream to the graph. Main thread.
+ */
+ void AddStream(MediaStream* aStream);
/* From the main thread, ask the MSG to send back an event when the graph
* thread is running, and audio is being processed. */
diff --git a/dom/media/MediaStreamGraphImpl.h b/dom/media/MediaStreamGraphImpl.h
index 16abc3889d38..a16a51e182ba 100644
--- a/dom/media/MediaStreamGraphImpl.h
+++ b/dom/media/MediaStreamGraphImpl.h
@@ -424,12 +424,12 @@ public:
/**
* Add aStream to the graph and initializes its graph-specific state.
*/
- void AddStream(MediaStream* aStream);
+ void AddStreamGraphThread(MediaStream* aStream);
/**
* Remove aStream from the graph. Ensures that pending messages about the
* stream back to the main thread are flushed.
*/
- void RemoveStream(MediaStream* aStream);
+ void RemoveStreamGraphThread(MediaStream* aStream);
/**
* Remove aPort from the graph and release it.
*/
diff --git a/dom/media/test/test_loop.html b/dom/media/test/test_loop.html
index 4424a17c3194..d657ac696592 100644
--- a/dom/media/test/test_loop.html
+++ b/dom/media/test/test_loop.html
@@ -11,7 +11,7 @@
+
+
+
+
+Mozilla Bug {1162281}
+
+
+
+
+
+
+
+
+