☠☠ backed out by 0c899672fff6 ☠ ☠ | |
author | Eric Rahm <erahm@mozilla.com> |
Thu, 13 Oct 2016 22:02:47 -0700 | |
changeset 317935 | 9c7364b4579d0780b0423612143c02e188a5f715 |
parent 317934 | 5ee00c8709ee6b7f70a589f8ac2548e9e6e802ae |
child 317936 | 5af415bbb1072acb039b7a76779ac91d98762890 |
push id | 33170 |
push user | cbook@mozilla.com |
push date | Fri, 14 Oct 2016 10:37:07 +0000 |
treeherder | autoland@0d101ebfd95c [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jesup |
bugs | 1308615 |
milestone | 52.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/browser/modules/ContentWebRTC.jsm +++ b/browser/modules/ContentWebRTC.jsm @@ -256,18 +256,18 @@ function forgetPendingListsEventually(aC return; } aContentWindow.pendingGetUserMediaRequests = null; aContentWindow.pendingPeerConnectionRequests = null; aContentWindow.removeEventListener("unload", ContentWebRTC); } function updateIndicators() { - let contentWindowSupportsArray = MediaManagerService.activeMediaCaptureWindows; - let count = contentWindowSupportsArray.Count(); + let contentWindowArray = MediaManagerService.activeMediaCaptureWindows; + let count = contentWindowArray.length; let state = { showGlobalIndicator: count > 0, showCameraIndicator: false, showMicrophoneIndicator: false, showScreenSharingIndicator: "" }; @@ -275,17 +275,17 @@ function updateIndicators() { .getService(Ci.nsIMessageSender); cpmm.sendAsyncMessage("webrtc:UpdatingIndicators"); // If several iframes in the same page use media streams, it's possible to // have the same top level window several times. We use a Set to avoid // sending duplicate notifications. let contentWindows = new Set(); for (let i = 0; i < count; ++i) { - contentWindows.add(contentWindowSupportsArray.GetElementAt(i).top); + contentWindows.add(contentWindowArray.queryElementAt(i, Ci.nsISupports).top); } for (let contentWindow of contentWindows) { let tabState = getTabStateForContentWindow(contentWindow); if (tabState.camera) state.showCameraIndicator = true; if (tabState.microphone) state.showMicrophoneIndicator = true;
--- a/dom/media/MediaManager.cpp +++ b/dom/media/MediaManager.cpp @@ -5,16 +5,17 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "MediaManager.h" #include "MediaStreamGraph.h" #include "mozilla/dom/MediaStreamTrack.h" #include "GetUserMediaRequest.h" #include "MediaStreamListener.h" +#include "nsArray.h" #include "nsContentUtils.h" #include "nsHashPropertyBag.h" #ifdef MOZ_WIDGET_GONK #include "nsIAudioManager.h" #endif #include "nsIEventTarget.h" #include "nsIUUIDGenerator.h" #include "nsIScriptGlobalObject.h" @@ -3128,24 +3129,21 @@ MediaManager::Observe(nsISupports* aSubj return NS_OK; } #endif return NS_OK; } nsresult -MediaManager::GetActiveMediaCaptureWindows(nsISupportsArray** aArray) +MediaManager::GetActiveMediaCaptureWindows(nsIArray** aArray) { MOZ_ASSERT(aArray); - nsISupportsArray* array; - nsresult rv = NS_NewISupportsArray(&array); // AddRefs - if (NS_FAILED(rv)) { - return rv; - } + + nsCOMPtr<nsIMutableArray> array = nsArray::Create(); for (auto iter = mActiveWindows.Iter(); !iter.Done(); iter.Next()) { const uint64_t& id = iter.Key(); StreamListeners* listeners = iter.UserData(); nsPIDOMWindowInner* window = nsGlobalWindow::GetInnerWindowWithId(id)->AsInner(); MOZ_ASSERT(window); @@ -3166,21 +3164,21 @@ MediaManager::GetActiveMediaCaptureWindo listener->CapturingScreen() || listener->CapturingWindow() || listener->CapturingApplication()) { capturing = true; break; } } } if (capturing) { - array->AppendElement(window); + array->AppendElement(window, /*weak =*/ false); } } - *aArray = array; + array.forget(aArray); return NS_OK; } // XXX flags might be better... struct CaptureWindowStateData { bool *mVideo; bool *mAudio; bool *mScreenShare; @@ -3329,43 +3327,43 @@ MediaManager::IterateWindowListeners(nsP } } } void MediaManager::StopMediaStreams() { - nsCOMPtr<nsISupportsArray> array; + nsCOMPtr<nsIArray> array; GetActiveMediaCaptureWindows(getter_AddRefs(array)); uint32_t len; - array->Count(&len); + array->GetLength(&len); for (uint32_t i = 0; i < len; i++) { - nsCOMPtr<nsISupports> window; - array->GetElementAt(i, getter_AddRefs(window)); - nsCOMPtr<nsPIDOMWindowInner> win(do_QueryInterface(window)); + nsCOMPtr<nsPIDOMWindowInner> win; + array->QueryElementAt(i, NS_GET_IID(nsPIDOMWindowInner), + getter_AddRefs(win)); if (win) { OnNavigation(win->WindowID()); } } } bool MediaManager::IsActivelyCapturingOrHasAPermission(uint64_t aWindowId) { // Does page currently have a gUM stream active? - nsCOMPtr<nsISupportsArray> array; + nsCOMPtr<nsIArray> array; GetActiveMediaCaptureWindows(getter_AddRefs(array)); uint32_t len; - array->Count(&len); + array->GetLength(&len); for (uint32_t i = 0; i < len; i++) { - nsCOMPtr<nsISupports> window; - array->GetElementAt(i, getter_AddRefs(window)); - nsCOMPtr<nsPIDOMWindowInner> win(do_QueryInterface(window)); + nsCOMPtr<nsPIDOMWindowInner> win; + array->QueryElementAt(i, NS_GET_IID(nsPIDOMWindowInner), + getter_AddRefs(win)); if (win && win->WindowID() == aWindowId) { return true; } } // Or are persistent permissions (audio or video) granted? auto* window = nsGlobalWindow::GetInnerWindowWithId(aWindowId);
--- a/dom/media/nsIMediaManager.idl +++ b/dom/media/nsIMediaManager.idl @@ -1,27 +1,27 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsISupports.idl" -interface nsISupportsArray; +interface nsIArray; interface nsIDOMWindow; %{C++ #define NS_MEDIAMANAGERSERVICE_CID {0xabc622ea, 0x9655, 0x4123, {0x80, 0xd9, 0x22, 0x62, 0x1b, 0xdd, 0x54, 0x65}} #define MEDIAMANAGERSERVICE_CONTRACTID "@mozilla.org/mediaManagerService;1" %} [scriptable, builtinclass, uuid(24b23e01-33fd-401f-ba25-6e52658750b0)] interface nsIMediaManagerService : nsISupports { /* return a array of inner windows that have active captures */ - readonly attribute nsISupportsArray activeMediaCaptureWindows; + readonly attribute nsIArray activeMediaCaptureWindows; /* Get the capture state for the given window and all descendant windows (iframes, etc) */ void mediaCaptureWindowState(in nsIDOMWindow aWindow, out boolean aVideo, out boolean aAudio, [optional] out boolean aScreenShare, [optional] out boolean aWindowShare, [optional] out boolean aAppShare, [optional] out boolean aBrowserShare); /* Clear per-orgin list of persistent DeviceIds stored for enumerateDevices sinceTime is milliseconds since 1 January 1970 00:00:00 UTC. 0 = clear all */
--- a/mobile/android/chrome/content/WebrtcUI.js +++ b/mobile/android/chrome/content/WebrtcUI.js @@ -53,17 +53,17 @@ var WebrtcUI = { } } else if (aTopic === "VideoCapture:Resumed") { this.notify(); } }, notify: function() { let windows = MediaManagerService.activeMediaCaptureWindows; - let count = windows.Count(); + let count = windows.length; let msg = {}; if (count == 0) { if (this._notificationId) { Notifications.cancel(this._notificationId); this._notificationId = null; } } else { let notificationOptions = { @@ -71,17 +71,17 @@ var WebrtcUI = { when: null, // hide the date row light: [0xFF9500FF, 1000, 1000], ongoing: true }; let cameraActive = false; let audioActive = false; for (let i = 0; i < count; i++) { - let win = windows.GetElementAt(i); + let win = windows.queryElementAt(i, Ci.nsIDOMWindow); let hasAudio = {}; let hasVideo = {}; MediaManagerService.mediaCaptureWindowState(win, hasVideo, hasAudio); if (hasVideo.value) cameraActive = true; if (hasAudio.value) audioActive = true; } if (cameraActive && audioActive) {