import changes from `dev' branch of rmottola/Arctic-Fox:

- missing part of  Bug 1165772: P1. (7311039be4)
- missing gstreamer stuff (54a80d69b2)
- Bug 1214208: Do not use MP3Decoder on B2G. r=alfredo (0a19e7946e)
- Bug 1194014 - Remove redundant includes. r=jya (ccc3753113)
- Bug 1039639 - Add support for Flac on Firefox OS. r=cajbir (7d76197e07)
- Bug 875573 - Add video/x-m4v mime type. r=kentuckyfriedtakahe (6ec8af93e6)
- cleanup (6fb3d5dd26)
- Bug 1180621 - [FxOS] Enable VP9 codec for the Android version after KK. r=sotaro (58f7c2b657)
- Bug 1187247: [MSE] P2. Enable WebM in MediaSource. r=jya (2df0ee1f7a)
- Bug 1187247: [MSE] P1. Continue parsing MediaSegment if buffer starts with SimpleBlock/Block. r=kinetik (574475ed6f)
- Bug 1217170: P1. Rename functions to explicitly reflect what they are doing. r=kentuckyfriedtakahe (70c81a8179)
- Bug 1070216 - Split DOMMediaStream::InitStreamCommon into three. r=roc (1bda71cc88)
- Bug 1215582 - Rename Blacklist to Block list in GStreamerFormatReader. r=gerald (4f08077f5e)
- Bug 1170958 - Destroy track-locked MediaInputPorts when the track ends. r=roc (ff3922a2d6)
- Bug 1070216 - constify DOMMediaStream::Get[Audio/Video]Tracks(). r=roc (ba09f6f191)
- Bug 1070216 - Guard against adding a track owned by one MSG to a stream owned by another. r=padenot (a80deb8b30)
- Bug 1070216 - Implement MediaStream constructors. r=smaug,jib,padenot (3403ef2599)
- Bug 1070216 - Guard against a null MediaInputPort in DOMMediaStream::FindPlaybackDOMTrack(). r=roc (453a9ffbc1)
- Bug 1212783 - Expose TrackPort in DOMMediaStream.h r=roc (fb61c79ae7)
- Bug 1219711 - Ensure MediaStreamTrack.enabled propagates across peer connections. r=jesup (d9d1e54dae)
- Bug 1129051 - Fix double free in Camera Control Listener. Fix webrtc memory leak. r=aosmond (3e9b3bccfd)
- Bug 1152260 - Generate focused event for drivers that do not notify us when using continuous auto focus. r=mikeh (6c7bd42fdc)
- Bug 1175656 - Implement generation of recording posters in Gecko. r=dhylands,bz (51b2c66dc7)
- Bug 1187364 - Part 1. Add ability for camera to pause/resume recording. r=dhylands,bz (c54c735e37)
- Bug 1187364 - Part 2. Ensure that recording is resumed with a key frame. r=mchiang (c1c6048982)
- Bug 1187364 - Part 3. Fix missing end comment in WebIDL. r=me,bz (7faf106cc1)
- Bug 1212783 - Add a MediaStreamTrack to DOMCameraControl. r=aosmond (91e11efd3a)
- Bug 1124338 - Fix possible camera cached parameters invalidation from underlying driver modification. r=aosmond (dea67dc155)
- Bug 1196330 - Do not restart preview if configuration is unchanged. r=dhylands (097644f5d9)
- Bug 1215372 - Filter empty camera face detected events at gonk layer. r=dhylands (733efe50eb)
- Bug 1179726 - Prefer lower resolutions than 4kuhd as the default video recording profile. r=dhylands (27c71273dc)
- Bug 1222122 - Add picture size to verified parameters when reconfiguring the camera. r=dhylands (8c1fac6a4a)
- Bug 1141267 - register CameraThread with profiler, r=aosmond (299592a024)
- Bug 1008483 - removes the RW lock in CameraControlImpl and replaces it with a standard mutex. r=aosmond (45936cb90d)
- Bug 1008483 - Part 2. Readd missing nsPrintfCString.h include which has broken some local builds. r=me (9dd84b0f19)
- Bug 1191731 - Update poster API to allow application control over when poster is saved. r=bz, r=dhylands (73f9e7e0f4)
- Bug 1155648 - Fix documentation for DOMMediaStream::OnTracksAvailable. r=jesup (702828c304)
- Bug 1217170: [MSE] P2. Enable WebM/MSE on systems with no MP4/H264 support. r=kentuckyfriedtakahe (0b814b0708)
- Bug 1213177: Enable WebM on machines where H264 HW decoding is disabled. r=kentuckyfriedtakahe (e64da2ea24)
- add back some sps telemetry (52c2c64f5b)
- missing bit of Bug 1195073: [MSE/webm] P1 (9c45e82c3d)
- Bug 1150305 - sourcebuffer.buffered returns the same object if not changed. r=roc, r=bz, r=jya (6005d56c0c)
- Bug 1215447 - move flag setting from SeekStarted() to Seek(). r=roc. (a646b744c1)
- Bug 1119936 - Audio from FM Radio or Music app ceases to play when switching between front/back camera. r=roc (1a60aa7d69)
- Bug 1186806 - Part 1: Replace nsBaseHashtable::EnumerateRead() with iterators in HTMLFormControlsCollection. r=khuey (ccb8cb180a)
- Bug 1186806 - Part 2: Use NS_IMPL_CYCLE_COLLECTION_TRAVERSE instead of manual traversal in HTMLFormElement. r=khuey (57e6eabf1b)
- Bug 1186806 - Part 3: Replace nsBaseHashtable::EnumerateRead() with iterators in HTMLMediaElement. r=khuey (243ef6e83b)
- Bug 1186806 - Part 4: Replace nsBaseHashtable::EnumerateRead() with iterators in HTMLPropertiesCollection. r=khuey (499bdef85f)
- Bug 1163958 - Reduce the allocation in MediaStreamGraph - patch 3 CLOSED TREE (a557661df1)
- Bug 1219330 - Prevent the creation of TextureClient after shutdown. r=mattwoodrow (a6c047d54f)
- Bug 1205559: Make TextureChild/TextureClient thread-safe. r=nical (307c089631)
- missing bit of 1219330 (0e351ea419)
- nsRefPtr -> RefPtr (07ba248e69)
- Bug 1215023. Part 1 - make MediaDecoder::mOwner a const member. We will check mShuttingDown before calling functions of mOwner. r=kinetik. (da7f201815)
- Bug 1215023. Part 2 - remove null check of mOwner. We check mShuttingDown to know whether it is valid to call functions of mOwner. r=kinetik. (8d28a04bbe)
- Bug 1220558. Part 2 - remove unused members. r=jya. (d3a9ed8c68)
- Bug 1223599 - Remove the throttling argument from AbstractMediaDecoder::NotifyDataArrived(). r=jya. (320323ff1d)
- Bug 1194606 - Make MediaDecoderStateMachine capable of requesting different kind (decoded/raw) of media data. r=jya (1e2b6a5c44)
- Bug 1197075: P3. Decode frames ahead of MDSM requesting them. r=edwin This makes the media.*-decode-ahead pref performs more according to its name. We decode audio and video in advance so a MediaDataPromise can be resolved almost instantly. Default is 2. (b3f56447c4)
- Bug 1189964 - Fix bustage. r=bustage CLOSED TREE (afaa49b4b5)
- Bug 1212149 - e10s support for opening notification settings. r=wchen (f0e7778fb6)
- Bug 1215644 - Use child process volume service cache for available and storage status requests. r=dhylands (dfd49f2ef3)
- bug 1215552 - nsHttpConnectionMgr::PostEvent shouldnt manually ref count r=hurley (5e2f1886e6)
- Bug 1219392 - Capitalize mozilla::unused to avoid conflicts. r=froydnj (0c8bb7f15a)
- bug 1217834 - buzzfeed packet loss r=dragana (e9a60b605f)
- Bug 1168033 - Add a comment to nsHttpConnectionMgr.cpp explaining the assignment of attemptedOptimisticPipeline. r=mcmanus (2451996350)
- bug 1189645 - remove spdy telem r=hurley (cda90abbdb)
- Bug 1148268 - fixed misspelling attribute mActorDestoryed. r=dhyland. (3615d68765)
- Bug 1216031 - Make MediaDecoder::mVideoFrameContainer const. r=kinetik. (a3feb9d6bc)
- missing bits of  Bug 1165515 - Part 13-2 (009e32281f)
- Bug 1131473 - crash in -[NativeMenuItemTarget menuItemHit:]. r=spohl (ea2da6441c)
- Bug 1216416 - Fix -Wimplicit-fallthrough warnings in widget/cocoa. r=spohl (faaa390b20)
- Bug 1181977 - Firefox app menu contains only "Quit" in certain edgecases. r=spohl (0b9d912961)
This commit is contained in:
2022-12-06 13:48:22 +08:00
parent 6b21bacef6
commit 86a3aa0b54
329 changed files with 3290 additions and 2125 deletions
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -35,7 +35,7 @@ BroadcastDomainSetChange(DomainSetType aSetType, DomainSetChangeType aChangeType
SerializeURI(aDomain, uri);
for (uint32_t i = 0; i < parents.Length(); i++) {
unused << parents[i]->SendDomainSetChanged(aSetType, aChangeType, uri);
Unused << parents[i]->SendDomainSetChanged(aSetType, aChangeType, uri);
}
return NS_OK;
}
+1 -1
View File
@@ -766,7 +766,7 @@ SendManifestEntry(const ChromeRegistryItem &aItem)
return;
for (uint32_t i = 0; i < parents.Length(); i++) {
unused << parents[i]->SendRegisterChromeItem(aItem);
Unused << parents[i]->SendRegisterChromeItem(aItem);
}
}
+1 -1
View File
@@ -5075,7 +5075,7 @@ nsDocShell::DisplayLoadError(nsresult aError, nsIURI* aURI,
// asserts). Satisfy that assertion now since GetDoc will force
// creation of one if it hasn't already been created.
if (mScriptGlobal) {
unused << mScriptGlobal->GetDoc();
Unused << mScriptGlobal->GetDoc();
}
// Display a message box
+5 -5
View File
@@ -56,7 +56,7 @@ using mozilla::ipc::BackgroundChild;
using mozilla::ipc::IsOnBackgroundThread;
using mozilla::ipc::PBackgroundChild;
using mozilla::ipc::PrincipalInfo;
using mozilla::unused;
using mozilla::Unused;
using mozilla::HashString;
namespace mozilla {
@@ -478,7 +478,7 @@ private:
FinishOnOwningThread();
if (!mActorDestroyed) {
unused << Send__delete__(this, mResult);
Unused << Send__delete__(this, mResult);
}
}
@@ -993,7 +993,7 @@ ParentRunnable::Run()
// Metadata is now open.
if (!SendOnOpenMetadataForRead(mMetadata)) {
unused << Send__delete__(this, JS::AsmJSCache_InternalError);
Unused << Send__delete__(this, JS::AsmJSCache_InternalError);
}
return NS_OK;
@@ -1035,7 +1035,7 @@ ParentRunnable::Run()
FileDescriptor::PlatformHandleType handle =
FileDescriptor::PlatformHandleType(PR_FileDesc2NativeHandle(mFileDesc));
if (!SendOnOpenCacheFile(mFileSize, FileDescriptor(handle))) {
unused << Send__delete__(this, JS::AsmJSCache_InternalError);
Unused << Send__delete__(this, JS::AsmJSCache_InternalError);
}
return NS_OK;
@@ -1451,7 +1451,7 @@ ChildRunnable::Run()
Release();
if (!mActorDestroyed) {
unused << Send__delete__(this, JS::AsmJSCache_Success);
Unused << Send__delete__(this, JS::AsmJSCache_Success);
}
mState = eFinished;
+1 -1
View File
@@ -210,7 +210,7 @@ public:
rv = NS_DispatchToMainThread(mEncodingCompleteEvent);
if (NS_FAILED(rv)) {
// Better to leak than to crash.
unused << mEncodingCompleteEvent.forget();
Unused << mEncodingCompleteEvent.forget();
return rv;
}
+6 -6
View File
@@ -33,7 +33,7 @@
#include "nsIDOMEvent.h"
#include "nsWeakPtr.h"
using mozilla::unused; // <snicker>
using mozilla::Unused; // <snicker>
using namespace mozilla::dom;
using namespace mozilla;
@@ -473,7 +473,7 @@ nsContentPermissionRequestProxy::nsContentPermissionRequesterProxy
mGetCallback = aCallback;
mWaitGettingResult = true;
unused << mParent->SendGetVisibility();
Unused << mParent->SendGetVisibility();
return NS_OK;
}
@@ -608,7 +608,7 @@ nsContentPermissionRequestProxy::Cancel()
nsTArray<PermissionChoice> emptyChoices;
unused << ContentPermissionRequestParent::Send__delete__(mParent, false, emptyChoices);
Unused << ContentPermissionRequestParent::Send__delete__(mParent, false, emptyChoices);
mParent = nullptr;
return NS_OK;
}
@@ -672,7 +672,7 @@ nsContentPermissionRequestProxy::Allow(JS::HandleValue aChoices)
return NS_ERROR_FAILURE;
}
unused << ContentPermissionRequestParent::Send__delete__(mParent, true, choices);
Unused << ContentPermissionRequestParent::Send__delete__(mParent, true, choices);
mParent = nullptr;
return NS_OK;
}
@@ -776,7 +776,7 @@ RemotePermissionRequest::RecvGetVisibility()
bool isActive = false;
docshell->GetIsActive(&isActive);
unused << SendNotifyVisibility(isActive);
Unused << SendNotifyVisibility(isActive);
return true;
}
@@ -787,6 +787,6 @@ RemotePermissionRequest::NotifyVisibility(bool isVisible)
return NS_OK;
}
unused << SendNotifyVisibility(isVisible);
Unused << SendNotifyVisibility(isVisible);
return NS_OK;
}
+1 -1
View File
@@ -1120,7 +1120,7 @@ void
ActivateOrDeactivateChild(TabParent* aParent, void* aArg)
{
bool active = static_cast<bool>(aArg);
unused << aParent->SendParentActivated(active);
Unused << aParent->SendParentActivated(active);
}
void
+6 -6
View File
@@ -988,8 +988,8 @@ nsFrameLoader::SwapWithOtherRemoteLoader(nsFrameLoader* aOther,
mInSwap = aOther->mInSwap = false;
unused << mRemoteBrowser->SendSwappedWithOtherRemoteLoader();
unused << aOther->mRemoteBrowser->SendSwappedWithOtherRemoteLoader();
Unused << mRemoteBrowser->SendSwappedWithOtherRemoteLoader();
Unused << aOther->mRemoteBrowser->SendSwappedWithOtherRemoteLoader();
return NS_OK;
}
@@ -2298,7 +2298,7 @@ nsFrameLoader::TryRemoteBrowser()
nsGkAtoms::mozpasspointerevents,
nsGkAtoms::_true,
eCaseMatters)) {
unused << mRemoteBrowser->SendSetUpdateHitRegion(true);
Unused << mRemoteBrowser->SendSetUpdateHitRegion(true);
}
ReallyLoadFrameScripts();
@@ -2343,14 +2343,14 @@ nsFrameLoader::DeactivateRemoteFrame() {
void
nsFrameLoader::ActivateUpdateHitRegion() {
if (mRemoteBrowser) {
unused << mRemoteBrowser->SendSetUpdateHitRegion(true);
Unused << mRemoteBrowser->SendSetUpdateHitRegion(true);
}
}
void
nsFrameLoader::DeactivateUpdateHitRegion() {
if (mRemoteBrowser) {
unused << mRemoteBrowser->SendSetUpdateHitRegion(false);
Unused << mRemoteBrowser->SendSetUpdateHitRegion(false);
}
}
@@ -2861,7 +2861,7 @@ nsFrameLoader::RequestNotifyAfterRemotePaint()
{
// If remote browsing (e10s), handle this with the TabParent.
if (mRemoteBrowser) {
unused << mRemoteBrowser->SendRequestNotifyAfterRemotePaint();
Unused << mRemoteBrowser->SendRequestNotifyAfterRemotePaint();
}
return NS_OK;
+1
View File
@@ -857,6 +857,7 @@ GK_ATOM(onpopuphidden, "onpopuphidden")
GK_ATOM(onpopuphiding, "onpopuphiding")
GK_ATOM(onpopupshowing, "onpopupshowing")
GK_ATOM(onpopupshown, "onpopupshown")
GK_ATOM(onposter, "onposter")
GK_ATOM(onpreviewstatechange, "onpreviewstatechange")
GK_ATOM(onpullphonebookreq, "onpullphonebookreq")
GK_ATOM(onpullvcardentryreq, "onpullvcardentryreq")
+3 -3
View File
@@ -12199,7 +12199,7 @@ nsGlobalWindow::SetTimeoutOrInterval(nsIScriptTimeoutHandler *aHandler,
}
// The timeout is now also held in the timer's closure.
unused << copy.forget();
Unused << copy.forget();
} else {
// If we are frozen, however, then we instead simply set
// timeout->mTimeRemaining to be the "time remaining" in the timeout (i.e.,
@@ -12595,7 +12595,7 @@ nsGlobalWindow::RunTimeout(nsTimeout *aTimeout)
// through a timeout that fired while a modal (to this window)
// dialog was open or through other non-obvious paths.
MOZ_ASSERT(dummy_timeout->HasRefCntOne(), "dummy_timeout may leak");
unused << timeoutExtraRef.forget().take();
Unused << timeoutExtraRef.forget().take();
mTimeoutInsertionPoint = last_insertion_point;
@@ -13098,7 +13098,7 @@ nsGlobalWindow::SuspendTimeouts(uint32_t aIncrease,
// Suspend all of the AudioContexts for this window
for (uint32_t i = 0; i < mAudioContexts.Length(); ++i) {
ErrorResult dummy;
unused << mAudioContexts[i]->Suspend(dummy);
RefPtr<Promise> d = mAudioContexts[i]->Suspend(dummy);
}
}
+3 -3
View File
@@ -844,8 +844,8 @@ NotifyOffThreadScriptLoadCompletedRunnable::~NotifyOffThreadScriptLoadCompletedR
} else {
MOZ_ASSERT(false, "We really shouldn't leak!");
// Better to leak than crash.
unused << mRequest.forget();
unused << mLoader.forget();
Unused << mRequest.forget();
Unused << mLoader.forget();
}
}
}
@@ -915,7 +915,7 @@ nsScriptLoader::AttemptAsyncScriptCompile(nsScriptLoadRequest* aRequest)
mDocument->BlockOnload();
aRequest->mProgress = nsScriptLoadRequest::Progress_Compiling;
unused << runnable.forget();
Unused << runnable.forget();
return NS_OK;
}
-4
View File
@@ -1339,10 +1339,6 @@ DOMInterfaces = {
'implicitJSContext': ['readHeapSnapshot', 'saveHeapSnapshot']
},
'TimeRanges': {
'wrapperCache': False
},
'TouchList': {
'headerFile': 'mozilla/dom/TouchEvent.h',
},
@@ -68,7 +68,7 @@ BluetoothDaemonA2dpModule::ConnectCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -90,7 +90,7 @@ BluetoothDaemonA2dpModule::DisconnectCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -70,7 +70,7 @@ BluetoothDaemonAvrcpModule::GetPlayStatusRspCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -96,7 +96,7 @@ BluetoothDaemonAvrcpModule::ListPlayerAppAttrRspCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -120,7 +120,7 @@ BluetoothDaemonAvrcpModule::ListPlayerAppValueRspCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -145,7 +145,7 @@ BluetoothDaemonAvrcpModule::GetPlayerAppValueRspCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -169,7 +169,7 @@ BluetoothDaemonAvrcpModule::GetPlayerAppAttrTextRspCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -193,7 +193,7 @@ BluetoothDaemonAvrcpModule::GetPlayerAppValueTextRspCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -217,7 +217,7 @@ BluetoothDaemonAvrcpModule::GetElementAttrRspCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -239,7 +239,7 @@ BluetoothDaemonAvrcpModule::SetPlayerAppValueRspCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -267,7 +267,7 @@ BluetoothDaemonAvrcpModule::RegisterNotificationRspCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -289,7 +289,7 @@ BluetoothDaemonAvrcpModule::SetVolumeCmd(uint8_t aVolume,
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -65,7 +65,7 @@ BluetoothDaemonCoreModule::EnableCmd(BluetoothResultHandler* aRes)
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return rv;
}
@@ -82,7 +82,7 @@ BluetoothDaemonCoreModule::DisableCmd(BluetoothResultHandler* aRes)
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return rv;
}
@@ -100,7 +100,7 @@ BluetoothDaemonCoreModule::GetAdapterPropertiesCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return rv;
}
@@ -123,7 +123,7 @@ BluetoothDaemonCoreModule::GetAdapterPropertyCmd(const nsAString& aName,
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return rv;
}
@@ -145,7 +145,7 @@ BluetoothDaemonCoreModule::SetAdapterPropertyCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return rv;
}
@@ -168,7 +168,7 @@ BluetoothDaemonCoreModule::GetRemoteDevicePropertiesCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return rv;
}
@@ -194,7 +194,7 @@ BluetoothDaemonCoreModule::GetRemoteDevicePropertyCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return rv;
}
@@ -220,7 +220,7 @@ BluetoothDaemonCoreModule::SetRemoteDevicePropertyCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return rv;
}
@@ -245,7 +245,7 @@ BluetoothDaemonCoreModule::GetRemoteServiceRecordCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return rv;
}
@@ -267,7 +267,7 @@ BluetoothDaemonCoreModule::GetRemoteServicesCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return rv;
}
@@ -284,7 +284,7 @@ BluetoothDaemonCoreModule::StartDiscoveryCmd(BluetoothResultHandler* aRes)
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return rv;
}
@@ -301,7 +301,7 @@ BluetoothDaemonCoreModule::CancelDiscoveryCmd(BluetoothResultHandler* aRes)
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return rv;
}
@@ -330,7 +330,7 @@ BluetoothDaemonCoreModule::CreateBondCmd(const nsAString& aBdAddr,
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return rv;
}
@@ -353,7 +353,7 @@ BluetoothDaemonCoreModule::RemoveBondCmd(const nsAString& aBdAddr,
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return rv;
}
@@ -376,7 +376,7 @@ BluetoothDaemonCoreModule::CancelBondCmd(const nsAString& aBdAddr,
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return rv;
}
@@ -402,7 +402,7 @@ BluetoothDaemonCoreModule::PinReplyCmd(const nsAString& aBdAddr, bool aAccept,
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return rv;
}
@@ -428,7 +428,7 @@ BluetoothDaemonCoreModule::SspReplyCmd(const nsAString& aBdAddr,
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return rv;
}
@@ -450,7 +450,7 @@ BluetoothDaemonCoreModule::DutModeConfigureCmd(bool aEnable,
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return rv;
}
@@ -474,7 +474,7 @@ BluetoothDaemonCoreModule::DutModeSendCmd(uint16_t aOpcode,
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return rv;
}
@@ -498,7 +498,7 @@ BluetoothDaemonCoreModule::LeTestModeCmd(uint16_t aOpcode,
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return rv;
}
@@ -69,7 +69,7 @@ BluetoothDaemonGattModule::ClientRegisterCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -91,7 +91,7 @@ BluetoothDaemonGattModule::ClientUnregisterCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -115,7 +115,7 @@ BluetoothDaemonGattModule::ClientScanCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -145,7 +145,7 @@ BluetoothDaemonGattModule::ClientConnectCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -173,7 +173,7 @@ BluetoothDaemonGattModule::ClientDisconnectCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -198,7 +198,7 @@ BluetoothDaemonGattModule::ClientListenCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -223,7 +223,7 @@ BluetoothDaemonGattModule::ClientRefreshCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -251,7 +251,7 @@ BluetoothDaemonGattModule::ClientSearchServiceCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -280,7 +280,7 @@ BluetoothDaemonGattModule::ClientGetIncludedServiceCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -310,7 +310,7 @@ BluetoothDaemonGattModule::ClientGetCharacteristicCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -342,7 +342,7 @@ BluetoothDaemonGattModule::ClientGetDescriptorCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -370,7 +370,7 @@ BluetoothDaemonGattModule::ClientReadCharacteristicCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -397,7 +397,7 @@ BluetoothDaemonGattModule::ClientWriteCharacteristicCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -426,7 +426,7 @@ BluetoothDaemonGattModule::ClientReadDescriptorCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -454,7 +454,7 @@ BluetoothDaemonGattModule::ClientWriteDescriptorCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -478,7 +478,7 @@ BluetoothDaemonGattModule::ClientExecuteWriteCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -507,7 +507,7 @@ BluetoothDaemonGattModule::ClientRegisterNotificationCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -536,7 +536,7 @@ BluetoothDaemonGattModule::ClientDeregisterNotificationCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -562,7 +562,7 @@ BluetoothDaemonGattModule::ClientReadRemoteRssiCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -585,7 +585,7 @@ BluetoothDaemonGattModule::ClientGetDeviceTypeCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -621,7 +621,7 @@ BluetoothDaemonGattModule::ClientSetAdvDataCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -655,7 +655,7 @@ BluetoothDaemonGattModule::ClientTestCommandCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -677,7 +677,7 @@ BluetoothDaemonGattModule::ServerRegisterCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -699,7 +699,7 @@ BluetoothDaemonGattModule::ServerUnregisterCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -729,7 +729,7 @@ BluetoothDaemonGattModule::ServerConnectPeripheralCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -756,7 +756,7 @@ BluetoothDaemonGattModule::ServerDisconnectPeripheralCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -782,7 +782,7 @@ BluetoothDaemonGattModule::ServerAddServiceCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -809,7 +809,7 @@ BluetoothDaemonGattModule::ServerAddIncludedServiceCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -840,7 +840,7 @@ BluetoothDaemonGattModule::ServerAddCharacteristicCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -869,7 +869,7 @@ BluetoothDaemonGattModule::ServerAddDescriptorCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -896,7 +896,7 @@ BluetoothDaemonGattModule::ServerStartServiceCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -921,7 +921,7 @@ BluetoothDaemonGattModule::ServerStopServiceCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -946,7 +946,7 @@ BluetoothDaemonGattModule::ServerDeleteServiceCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -974,7 +974,7 @@ BluetoothDaemonGattModule::ServerSendIndicationCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -1007,7 +1007,7 @@ BluetoothDaemonGattModule::ServerSendResponseCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -72,7 +72,7 @@ BluetoothDaemonHandsfreeModule::ConnectCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -95,7 +95,7 @@ BluetoothDaemonHandsfreeModule::DisconnectCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -118,7 +118,7 @@ BluetoothDaemonHandsfreeModule::ConnectAudioCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -141,7 +141,7 @@ BluetoothDaemonHandsfreeModule::DisconnectAudioCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -167,7 +167,7 @@ BluetoothDaemonHandsfreeModule::StartVoiceRecognitionCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -193,7 +193,7 @@ BluetoothDaemonHandsfreeModule::StopVoiceRecognitionCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -224,7 +224,7 @@ BluetoothDaemonHandsfreeModule::VolumeControlCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -253,7 +253,7 @@ BluetoothDaemonHandsfreeModule::DeviceStatusNotificationCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -283,7 +283,7 @@ BluetoothDaemonHandsfreeModule::CopsResponseCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -334,7 +334,7 @@ BluetoothDaemonHandsfreeModule::CindResponseCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -364,7 +364,7 @@ BluetoothDaemonHandsfreeModule::FormattedAtResponseCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -396,7 +396,7 @@ BluetoothDaemonHandsfreeModule::AtResponseCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -441,7 +441,7 @@ BluetoothDaemonHandsfreeModule::ClccResponseCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -474,7 +474,7 @@ BluetoothDaemonHandsfreeModule::PhoneStateChangeCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -500,7 +500,7 @@ BluetoothDaemonHandsfreeModule::ConfigureWbsCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return NS_OK;
}
@@ -477,7 +477,7 @@ BluetoothDaemonInterface::Init(
// If we could not cleanup properly before and an old
// instance of the daemon is still running, we kill it
// here.
unused << NS_WARN_IF(property_set("ctl.stop", "bluetoothd"));
Unused << NS_WARN_IF(property_set("ctl.stop", "bluetoothd"));
mResultHandlerQ.AppendElement(aRes);
@@ -1023,7 +1023,7 @@ BluetoothDaemonInterface::OnConnectError(int aIndex)
mCmdChannel->Close();
case CMD_CHANNEL:
// Stop daemon and close listen socket
unused << NS_WARN_IF(property_set("ctl.stop", "bluetoothd"));
Unused << NS_WARN_IF(property_set("ctl.stop", "bluetoothd"));
mListenSocket->Close();
case LISTEN_SOCKET:
if (!mResultHandlerQ.IsEmpty()) {
@@ -75,7 +75,7 @@ BluetoothDaemonSetupModule::RegisterModuleCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return rv;
}
@@ -97,7 +97,7 @@ BluetoothDaemonSetupModule::UnregisterModuleCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return rv;
}
@@ -121,7 +121,7 @@ BluetoothDaemonSetupModule::ConfigurationCmd(
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return rv;
}
@@ -49,7 +49,7 @@ BluetoothDaemonSocketModule::ListenCmd(BluetoothSocketType aType,
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return rv;
}
@@ -80,7 +80,7 @@ BluetoothDaemonSocketModule::ConnectCmd(const nsAString& aBdAddr,
if (NS_FAILED(rv)) {
return rv;
}
unused << pdu.forget();
Unused << pdu.forget();
return rv;
}
@@ -2033,7 +2033,7 @@ BluetoothServiceBluedroid::RemoteDevicePropertiesNotification(
break;
}
}
unused << NS_WARN_IF(i == mGetRemoteServiceRecordArray.Length());
Unused << NS_WARN_IF(i == mGetRemoteServiceRecordArray.Length());
} else if (p.mType == PROPERTY_UNKNOWN) {
/* Bug 1065999: working around unknown properties */
} else {
+13 -13
View File
@@ -1234,7 +1234,7 @@ AppendDeviceName(BluetoothSignal& aSignal)
NS_ENSURE_TRUE_VOID(success);
unused << handler.forget(); // picked up by callback handler
Unused << handler.forget(); // picked up by callback handler
}
class SetPairingConfirmationTask : public Task
@@ -1660,7 +1660,7 @@ private:
NS_ENSURE_TRUE(success, false);
unused << handler.forget(); // picked up by callback handler
Unused << handler.forget(); // picked up by callback handler
return true;
}
@@ -1699,7 +1699,7 @@ public:
NS_ENSURE_TRUE_VOID(success);
unused << handler.forget(); /* picked up by callback handler */
Unused << handler.forget(); /* picked up by callback handler */
}
};
@@ -2390,7 +2390,7 @@ protected:
return false;
}
unused << handler.forget(); // picked up by callback handler
Unused << handler.forget(); // picked up by callback handler
return true;
}
@@ -2450,7 +2450,7 @@ public:
DBUS_TYPE_INVALID);
NS_ENSURE_TRUE_VOID(success);
unused << handler.forget(); // picked up by callback handler
Unused << handler.forget(); // picked up by callback handler
}
private:
@@ -2523,7 +2523,7 @@ public:
DBUS_TYPE_INVALID);
NS_ENSURE_TRUE_VOID(success);
unused << mRunnable.forget(); // picked up by callback handler
Unused << mRunnable.forget(); // picked up by callback handler
}
private:
@@ -2791,7 +2791,7 @@ protected:
NS_ENSURE_TRUE(success, false);
unused << handler.forget(); // picked up by callback handler
Unused << handler.forget(); // picked up by callback handler
return true;
}
@@ -2954,7 +2954,7 @@ public:
1000, msg);
NS_ENSURE_TRUE_VOID(success);
unused << mRunnable.forget(); // picked up by callback handler
Unused << mRunnable.forget(); // picked up by callback handler
}
private:
@@ -3099,7 +3099,7 @@ public:
DBUS_TYPE_INVALID);
NS_ENSURE_TRUE_VOID(success);
unused << mRunnable.forget(); // picked up by callback handler
Unused << mRunnable.forget(); // picked up by callback handler
/**
* FIXME: Bug 820274
@@ -3168,7 +3168,7 @@ public:
DBUS_TYPE_INVALID);
NS_ENSURE_TRUE_VOID(success);
unused << mRunnable.forget(); // picked up by callback handler
Unused << mRunnable.forget(); // picked up by callback handler
}
protected:
@@ -3622,7 +3622,7 @@ public:
DBUS_TYPE_INVALID);
NS_ENSURE_TRUE_VOID(success);
unused << handler.forget(); // picked up by callback handler
Unused << handler.forget(); // picked up by callback handler
}
private:
@@ -3927,7 +3927,7 @@ public:
DBUS_TYPE_INVALID);
NS_ENSURE_TRUE_VOID(success);
unused << mRunnable.forget(); // picked up by callback handler
Unused << mRunnable.forget(); // picked up by callback handler
}
private:
@@ -4057,7 +4057,7 @@ public:
DBUS_TYPE_INVALID);
NS_ENSURE_TRUE_VOID(success);
unused << mRunnable.forget(); // picked up by callback handler
Unused << mRunnable.forget(); // picked up by callback handler
}
private:
+1 -1
View File
@@ -453,7 +453,7 @@ BluetoothService::SetEnabled(bool aEnabled)
GetAllBluetoothActors(childActors);
for (uint32_t index = 0; index < childActors.Length(); index++) {
unused << childActors[index]->SendEnabled(aEnabled);
Unused << childActors[index]->SendEnabled(aEnabled);
}
/**
+3 -3
View File
@@ -17,7 +17,7 @@
#include "BluetoothReplyRunnable.h"
#include "BluetoothService.h"
using mozilla::unused;
using mozilla::Unused;
USING_BLUETOOTH_NAMESPACE
/*******************************************************************************
@@ -99,7 +99,7 @@ BluetoothParent::BeginShutdown()
{
// Only do something here if we haven't yet begun the shutdown sequence.
if (mShutdownState == Running) {
unused << SendBeginShutdown();
Unused << SendBeginShutdown();
mShutdownState = SentBeginShutdown;
}
}
@@ -342,7 +342,7 @@ BluetoothParent::DeallocPBluetoothRequestParent(PBluetoothRequestParent* aActor)
void
BluetoothParent::Notify(const BluetoothSignal& aSignal)
{
unused << SendNotify(aSignal);
Unused << SendNotify(aSignal);
}
/*******************************************************************************
@@ -60,7 +60,7 @@ BroadcastChannelParent::RecvClose()
mService->UnregisterActor(this);
mService = nullptr;
unused << Send__delete__(this);
Unused << Send__delete__(this);
return true;
}
@@ -105,7 +105,7 @@ BroadcastChannelParent::CheckAndDeliver(const ClonedMessageData& aData,
newData.blobsParent()[i] = blobParent;
}
unused << SendNotify(newData);
Unused << SendNotify(newData);
}
}
+5 -5
View File
@@ -24,7 +24,7 @@
namespace {
using mozilla::unused;
using mozilla::Unused;
using mozilla::dom::cache::CachePushStreamChild;
using mozilla::dom::cache::CacheReadStream;
using mozilla::dom::cache::CacheReadStreamOrVoid;
@@ -54,7 +54,7 @@ CleanupChildFds(CacheReadStream& aReadStream, CleanupAction aAction)
MOZ_ASSERT(fdSetActor);
if (aAction == Delete) {
unused << fdSetActor->Send__delete__(fdSetActor);
Unused << fdSetActor->Send__delete__(fdSetActor);
}
// FileDescriptorSet doesn't clear its fds in its ActorDestroy, so we
@@ -114,7 +114,7 @@ CleanupParentFds(CacheReadStream& aReadStream, CleanupAction aAction)
MOZ_ASSERT(fdSetActor);
if (aAction == Delete) {
unused << fdSetActor->Send__delete__(fdSetActor);
Unused << fdSetActor->Send__delete__(fdSetActor);
}
// FileDescriptorSet doesn't clear its fds in its ActorDestroy, so we
@@ -482,7 +482,7 @@ AutoParentOpResult::~AutoParentOpResult()
if (action == Forget || result.actorParent() == nullptr) {
break;
}
unused << PCacheParent::Send__delete__(result.actorParent());
Unused << PCacheParent::Send__delete__(result.actorParent());
}
default:
// other types do not need clean up
@@ -490,7 +490,7 @@ AutoParentOpResult::~AutoParentOpResult()
}
if (action == Delete && mStreamControl) {
unused << PCacheStreamControlParent::Send__delete__(mStreamControl);
Unused << PCacheStreamControlParent::Send__delete__(mStreamControl);
}
}
+1 -1
View File
@@ -124,7 +124,7 @@ CacheChild::StartDestroy()
MOZ_ASSERT(!mListener);
// Start actor destruction from parent process
unused << SendTeardown();
Unused << SendTeardown();
}
void
+4 -4
View File
@@ -56,7 +56,7 @@ CacheOpParent::Execute(ManagerId* aManagerId)
RefPtr<Manager> manager;
nsresult rv = Manager::GetOrCreate(aManagerId, getter_AddRefs(manager));
if (NS_WARN_IF(NS_FAILED(rv))) {
unused << Send__delete__(this, ErrorResult(rv), void_t());
Unused << Send__delete__(this, ErrorResult(rv), void_t());
return;
}
@@ -144,7 +144,7 @@ CacheOpParent::OnPrincipalVerified(nsresult aRv, ManagerId* aManagerId)
mVerifier = nullptr;
if (NS_WARN_IF(NS_FAILED(aRv))) {
unused << Send__delete__(this, ErrorResult(aRv), void_t());
Unused << Send__delete__(this, ErrorResult(aRv), void_t());
return;
}
@@ -165,7 +165,7 @@ CacheOpParent::OnOpComplete(ErrorResult&& aRv, const CacheOpResult& aResult,
// Never send an op-specific result if we have an error. Instead, send
// void_t() to ensure that we don't leak actors on the child side.
if (NS_WARN_IF(aRv.Failed())) {
unused << Send__delete__(this, aRv, void_t());
Unused << Send__delete__(this, aRv, void_t());
aRv.SuppressException(); // We serialiazed it, as best we could.
return;
}
@@ -190,7 +190,7 @@ CacheOpParent::OnOpComplete(ErrorResult&& aRv, const CacheOpResult& aResult,
result.Add(aSavedRequestList[i], aStreamList);
}
unused << Send__delete__(this, aRv, result.SendAsOpResult());
Unused << Send__delete__(this, aRv, result.SendAsOpResult());
}
already_AddRefed<nsIInputStream>
+2 -2
View File
@@ -189,7 +189,7 @@ CachePushStreamChild::DoRead()
// If we read any data from the stream, send it across.
if (!buffer.IsEmpty()) {
unused << SendBuffer(buffer);
Unused << SendBuffer(buffer);
}
if (rv == NS_BASE_STREAM_WOULD_BLOCK) {
@@ -252,7 +252,7 @@ CachePushStreamChild::OnEnd(nsresult aRv)
}
// This will trigger an ActorDestroy() from the parent side
unused << SendClose(aRv);
Unused << SendClose(aRv);
}
} // namespace cache
+1 -1
View File
@@ -79,7 +79,7 @@ bool
CachePushStreamParent::RecvClose(const nsresult& aRv)
{
mWriter->CloseWithStatus(aRv);
unused << Send__delete__(this);
Unused << Send__delete__(this);
return true;
}
+1 -1
View File
@@ -32,7 +32,7 @@ namespace mozilla {
namespace dom {
namespace cache {
using mozilla::unused;
using mozilla::Unused;
using mozilla::ErrorResult;
using mozilla::dom::workers::WorkerPrivate;
using mozilla::ipc::BackgroundChild;
+2 -2
View File
@@ -53,7 +53,7 @@ CacheStorageChild::ExecuteOp(nsIGlobalObject* aGlobal, Promise* aPromise,
nsISupports* aParent, const CacheOpArgs& aArgs)
{
mNumChildActors += 1;
unused << SendPCacheOpConstructor(
Unused << SendPCacheOpConstructor(
new CacheOpChild(GetFeature(), aGlobal, aParent, aPromise), aArgs);
}
@@ -99,7 +99,7 @@ CacheStorageChild::StartDestroy()
MOZ_ASSERT(!mListener);
// Start actor destruction from parent process
unused << SendTeardown();
Unused << SendTeardown();
}
void
+1 -1
View File
@@ -101,7 +101,7 @@ CacheStorageParent::RecvPCacheOpConstructor(PCacheOpParent* aActor,
}
if (NS_WARN_IF(NS_FAILED(mVerifiedStatus))) {
unused << CacheOpParent::Send__delete__(actor, ErrorResult(mVerifiedStatus),
Unused << CacheOpParent::Send__delete__(actor, ErrorResult(mVerifiedStatus),
void_t());
return true;
}
+3 -3
View File
@@ -101,7 +101,7 @@ CacheStreamControlChild::SerializeFds(CacheReadStream* aReadStreamOut,
if (!aFds.IsEmpty()) {
fdSet = Manager()->SendPFileDescriptorSetConstructor(aFds[0]);
for (uint32_t i = 1; i < aFds.Length(); ++i) {
unused << fdSet->SendAddFileDescriptor(aFds[i]);
Unused << fdSet->SendAddFileDescriptor(aFds[i]);
}
}
@@ -128,14 +128,14 @@ CacheStreamControlChild::DeserializeFds(const CacheReadStream& aReadStream,
fdSetActor->ForgetFileDescriptors(aFdsOut);
MOZ_ASSERT(!aFdsOut.IsEmpty());
unused << fdSetActor->Send__delete__(fdSetActor);
Unused << fdSetActor->Send__delete__(fdSetActor);
}
void
CacheStreamControlChild::NoteClosedAfterForget(const nsID& aId)
{
NS_ASSERT_OWNINGTHREAD(CacheStreamControlChild);
unused << SendNoteClosed(aId);
Unused << SendNoteClosed(aId);
// A stream has closed. If we delayed StartDestry() due to this stream
// being read, then we should check to see if any of the remaining streams
+3 -3
View File
@@ -61,7 +61,7 @@ CacheStreamControlParent::SerializeFds(CacheReadStream* aReadStreamOut,
if (!aFds.IsEmpty()) {
fdSet = Manager()->SendPFileDescriptorSetConstructor(aFds[0]);
for (uint32_t i = 1; i < aFds.Length(); ++i) {
unused << fdSet->SendAddFileDescriptor(aFds[i]);
Unused << fdSet->SendAddFileDescriptor(aFds[i]);
}
}
@@ -141,7 +141,7 @@ CacheStreamControlParent::Close(const nsID& aId)
{
NS_ASSERT_OWNINGTHREAD(CacheStreamControlParent);
NotifyClose(aId);
unused << SendClose(aId);
Unused << SendClose(aId);
}
void
@@ -149,7 +149,7 @@ CacheStreamControlParent::CloseAll()
{
NS_ASSERT_OWNINGTHREAD(CacheStreamControlParent);
NotifyCloseAll();
unused << SendCloseAll();
Unused << SendCloseAll();
}
void
+1 -1
View File
@@ -187,7 +187,7 @@ BodyCancelWrite(nsIFile* aBaseDir, nsISupports* aCopyContext)
MOZ_ASSERT(aCopyContext);
nsresult rv = NS_CancelAsyncCopy(aCopyContext, NS_ERROR_ABORT);
unused << NS_WARN_IF(NS_FAILED(rv));
Unused << NS_WARN_IF(NS_FAILED(rv));
// The partially written file must be cleaned up after the async copy
// makes its callback.
+2 -2
View File
@@ -141,7 +141,7 @@ public:
}
rv = BodyDeleteFiles(dbDir, mDeletedBodyIdList);
unused << NS_WARN_IF(NS_FAILED(rv));
Unused << NS_WARN_IF(NS_FAILED(rv));
aResolver->Resolve(rv);
}
@@ -900,7 +900,7 @@ private:
}
rv = trans.Commit();
unused << NS_WARN_IF(NS_FAILED(rv));
Unused << NS_WARN_IF(NS_FAILED(rv));
DoResolve(rv);
}
+1 -1
View File
@@ -20,7 +20,7 @@ namespace mozilla {
namespace dom {
namespace cache {
using mozilla::unused;
using mozilla::Unused;
using mozilla::ipc::FileDescriptor;
// ----------------------------------------------------------------------------
+1 -1
View File
@@ -78,7 +78,7 @@ SerializeNormalStream(nsIInputStream* aStream, CacheReadStream& aReadStreamOut)
fdSet = manager->SendPFileDescriptorSetConstructor(fds[0]);
for (uint32_t i = 1; i < fds.Length(); ++i) {
unused << fdSet->SendAddFileDescriptor(fds[i]);
Unused << fdSet->SendAddFileDescriptor(fds[i]);
}
}
+87 -38
View File
@@ -18,7 +18,7 @@ using namespace mozilla;
/* static */ StaticRefPtr<nsIThread> CameraControlImpl::sCameraThread;
CameraControlImpl::CameraControlImpl()
: mListenerLock(PR_NewRWLock(PR_RWLOCK_RANK_NONE, "CameraControlImpl.Listeners.Lock"))
: mListenerLock("mozilla::camera::CameraControlImpl.Listeners")
, mPreviewState(CameraControlListener::kPreviewStopped)
, mHardwareState(CameraControlListener::kHardwareUninitialized)
, mHardwareStateChangeReason(NS_OK)
@@ -26,6 +26,18 @@ CameraControlImpl::CameraControlImpl()
DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
mCurrentConfiguration.mMode = ICameraControl::kUnspecifiedMode;
class Delegate : public nsRunnable
{
public:
NS_IMETHOD
Run()
{
char stackBaseGuess;
profiler_register_thread("CameraThread", &stackBaseGuess);
return NS_OK;
}
};
// reuse the same camera thread to conserve resources
nsCOMPtr<nsIThread> ct = do_QueryInterface(sCameraThread);
if (ct) {
@@ -35,34 +47,14 @@ CameraControlImpl::CameraControlImpl()
if (NS_FAILED(rv)) {
MOZ_CRASH("Failed to create new Camera Thread");
}
mCameraThread->Dispatch(new Delegate(), NS_DISPATCH_NORMAL);
sCameraThread = mCameraThread;
}
// Care must be taken with the mListenerLock read-write lock to prevent
// deadlocks. Currently this is handled by ensuring that any attempts to
// acquire the lock for writing (as in Add/RemoveListener()) happen in a
// runnable dispatched to the Camera Thread--even if the method is being
// called from that thread. This ensures that if a registered listener
// (which is invoked with a read-lock) tries to call Add/RemoveListener(),
// the lock-for-writing attempt won't happen until the listener has
// completed.
//
// Multiple parallel listeners being invoked are not a problem because
// the read-write lock allows multiple simultaneous read-locks.
if (!mListenerLock) {
MOZ_CRASH("Out of memory getting new PRRWLock");
}
}
CameraControlImpl::~CameraControlImpl()
{
DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
MOZ_ASSERT(mListenerLock, "mListenerLock missing in ~CameraControlImpl()");
if (mListenerLock) {
PR_DestroyRWLock(mListenerLock);
mListenerLock = nullptr;
}
}
void
@@ -72,7 +64,7 @@ CameraControlImpl::OnHardwareStateChange(CameraControlListener::HardwareState aN
// This callback can run on threads other than the Main Thread and
// the Camera Thread. On Gonk, it may be called from the camera's
// local binder thread, should the mediaserver process die.
RwLockAutoEnterRead lock(mListenerLock);
MutexAutoLock lock(mListenerLock);
if (aNewState == mHardwareState) {
DOM_CAMERA_LOGI("OnHardwareStateChange: state did not change from %d\n", mHardwareState);
@@ -101,7 +93,7 @@ void
CameraControlImpl::OnConfigurationChange()
{
MOZ_ASSERT(NS_GetCurrentThread() == mCameraThread);
RwLockAutoEnterRead lock(mListenerLock);
MutexAutoLock lock(mListenerLock);
DOM_CAMERA_LOGI("OnConfigurationChange : %zu listeners\n", mListeners.Length());
@@ -117,7 +109,7 @@ CameraControlImpl::OnAutoFocusComplete(bool aAutoFocusSucceeded)
// This callback can run on threads other than the Main Thread and
// the Camera Thread. On Gonk, it is called from the camera
// library's auto focus thread.
RwLockAutoEnterRead lock(mListenerLock);
MutexAutoLock lock(mListenerLock);
for (uint32_t i = 0; i < mListeners.Length(); ++i) {
CameraControlListener* l = mListeners[i];
@@ -128,7 +120,7 @@ CameraControlImpl::OnAutoFocusComplete(bool aAutoFocusSucceeded)
void
CameraControlImpl::OnAutoFocusMoving(bool aIsMoving)
{
RwLockAutoEnterRead lock(mListenerLock);
MutexAutoLock lock(mListenerLock);
for (uint32_t i = 0; i < mListeners.Length(); ++i) {
CameraControlListener* l = mListeners[i];
@@ -142,7 +134,7 @@ CameraControlImpl::OnFacesDetected(const nsTArray<Face>& aFaces)
// This callback can run on threads other than the Main Thread and
// the Camera Thread. On Gonk, it is called from the camera
// library's face detection thread.
RwLockAutoEnterRead lock(mListenerLock);
MutexAutoLock lock(mListenerLock);
for (uint32_t i = 0; i < mListeners.Length(); ++i) {
CameraControlListener* l = mListeners[i];
@@ -151,12 +143,12 @@ CameraControlImpl::OnFacesDetected(const nsTArray<Face>& aFaces)
}
void
CameraControlImpl::OnTakePictureComplete(uint8_t* aData, uint32_t aLength, const nsAString& aMimeType)
CameraControlImpl::OnTakePictureComplete(const uint8_t* aData, uint32_t aLength, const nsAString& aMimeType)
{
// This callback can run on threads other than the Main Thread and
// the Camera Thread. On Gonk, it is called from the camera
// library's snapshot thread.
RwLockAutoEnterRead lock(mListenerLock);
MutexAutoLock lock(mListenerLock);
for (uint32_t i = 0; i < mListeners.Length(); ++i) {
CameraControlListener* l = mListeners[i];
@@ -164,13 +156,26 @@ CameraControlImpl::OnTakePictureComplete(uint8_t* aData, uint32_t aLength, const
}
}
void
CameraControlImpl::OnPoster(dom::BlobImpl* aBlobImpl)
{
// This callback can run on threads other than the Main Thread and
// the Camera Thread.
MutexAutoLock lock(mListenerLock);
for (uint32_t i = 0; i < mListeners.Length(); ++i) {
CameraControlListener* l = mListeners[i];
l->OnPoster(aBlobImpl);
}
}
void
CameraControlImpl::OnShutter()
{
// This callback can run on threads other than the Main Thread and
// the Camera Thread. On Gonk, it is called from the camera driver's
// preview thread.
RwLockAutoEnterRead lock(mListenerLock);
MutexAutoLock lock(mListenerLock);
for (uint32_t i = 0; i < mListeners.Length(); ++i) {
CameraControlListener* l = mListeners[i];
@@ -185,7 +190,7 @@ CameraControlImpl::OnRecorderStateChange(CameraControlListener::RecorderState aS
// This callback can run on threads other than the Main Thread and
// the Camera Thread. On Gonk, it is called from the media encoder
// thread.
RwLockAutoEnterRead lock(mListenerLock);
MutexAutoLock lock(mListenerLock);
for (uint32_t i = 0; i < mListeners.Length(); ++i) {
CameraControlListener* l = mListeners[i];
@@ -199,7 +204,7 @@ CameraControlImpl::OnPreviewStateChange(CameraControlListener::PreviewState aNew
// This callback runs on the Main Thread and the Camera Thread, and
// may run on the local binder thread, should the mediaserver
// process die.
RwLockAutoEnterRead lock(mListenerLock);
MutexAutoLock lock(mListenerLock);
if (aNewState == mPreviewState) {
DOM_CAMERA_LOGI("OnPreviewStateChange: state did not change from %d\n", mPreviewState);
@@ -226,7 +231,7 @@ void
CameraControlImpl::OnRateLimitPreview(bool aLimit)
{
// This function runs on neither the Main Thread nor the Camera Thread.
RwLockAutoEnterRead lock(mListenerLock);
MutexAutoLock lock(mListenerLock);
DOM_CAMERA_LOGI("OnRateLimitPreview: %d\n", aLimit);
@@ -241,7 +246,7 @@ CameraControlImpl::OnNewPreviewFrame(layers::Image* aImage, uint32_t aWidth, uin
{
// This function runs on neither the Main Thread nor the Camera Thread.
// On Gonk, it is called from the camera driver's preview thread.
RwLockAutoEnterRead lock(mListenerLock);
MutexAutoLock lock(mListenerLock);
DOM_CAMERA_LOGI("OnNewPreviewFrame: we have %zu preview frame listener(s)\n",
mListeners.Length());
@@ -261,7 +266,7 @@ CameraControlImpl::OnUserError(CameraControlListener::UserContext aContext,
{
// This callback can run on threads other than the Main Thread and
// the Camera Thread.
RwLockAutoEnterRead lock(mListenerLock);
MutexAutoLock lock(mListenerLock);
const char* context[] = {
"StartCamera",
@@ -272,6 +277,8 @@ CameraControlImpl::OnUserError(CameraControlListener::UserContext aContext,
"TakePicture",
"StartRecording",
"StopRecording",
"PauseRecording",
"ResumeRecording",
"SetConfiguration",
"StartPreview",
"StopPreview",
@@ -300,7 +307,7 @@ CameraControlImpl::OnSystemError(CameraControlListener::SystemContext aContext,
{
// This callback can run on threads other than the Main Thread and
// the Camera Thread.
RwLockAutoEnterRead lock(mListenerLock);
MutexAutoLock lock(mListenerLock);
const char* context[] = {
"Camera Service"
@@ -576,6 +583,48 @@ CameraControlImpl::StopRecording()
return Dispatch(new Message(this, CameraControlListener::kInStopRecording));
}
nsresult
CameraControlImpl::PauseRecording()
{
class Message : public ControlMessage
{
public:
Message(CameraControlImpl* aCameraControl,
CameraControlListener::UserContext aContext)
: ControlMessage(aCameraControl, aContext)
{ }
nsresult
RunImpl() override
{
return mCameraControl->PauseRecordingImpl();
}
};
return Dispatch(new Message(this, CameraControlListener::kInPauseRecording));
}
nsresult
CameraControlImpl::ResumeRecording()
{
class Message : public ControlMessage
{
public:
Message(CameraControlImpl* aCameraControl,
CameraControlListener::UserContext aContext)
: ControlMessage(aCameraControl, aContext)
{ }
nsresult
RunImpl() override
{
return mCameraControl->ResumeRecordingImpl();
}
};
return Dispatch(new Message(this, CameraControlListener::kInResumeRecording));
}
nsresult
CameraControlImpl::StartPreview()
{
@@ -676,7 +725,7 @@ protected:
void
CameraControlImpl::AddListenerImpl(already_AddRefed<CameraControlListener> aListener)
{
RwLockAutoEnterWrite lock(mListenerLock);
MutexAutoLock lock(mListenerLock);
CameraControlListener* l = *mListeners.AppendElement() = aListener;
DOM_CAMERA_LOGI("Added camera control listener %p\n", l);
@@ -714,7 +763,7 @@ CameraControlImpl::AddListener(CameraControlListener* aListener)
void
CameraControlImpl::RemoveListenerImpl(CameraControlListener* aListener)
{
RwLockAutoEnterWrite lock(mListenerLock);
MutexAutoLock lock(mListenerLock);
RefPtr<CameraControlListener> l(aListener);
mListeners.RemoveElement(l);
+13 -4
View File
@@ -9,9 +9,9 @@
#include "nsWeakPtr.h"
#include "mozilla/Attributes.h"
#include "mozilla/ReentrantMonitor.h"
#include "mozilla/Mutex.h"
#include "nsIFile.h"
#include "nsProxyRelease.h"
#include "AutoRwLock.h"
#include "ICameraControl.h"
#include "CameraCommon.h"
#include "DeviceStorage.h"
@@ -20,9 +20,13 @@
namespace mozilla {
namespace dom {
class BlobImpl;
} // namespace dom
namespace layers {
class Image;
}
} // namespace layers
class CameraControlImpl : public ICameraControl
{
@@ -44,6 +48,8 @@ public:
virtual nsresult StartRecording(DeviceStorageFileDescriptor* aFileDescriptor,
const StartRecordingOptions* aOptions) override;
virtual nsresult StopRecording() override;
virtual nsresult PauseRecording() override;
virtual nsresult ResumeRecording() override;
virtual nsresult ResumeContinuousFocus() override;
// Event handlers called directly from outside this class.
@@ -56,7 +62,8 @@ protected:
// Event handlers.
void OnAutoFocusComplete(bool aAutoFocusSucceeded);
void OnFacesDetected(const nsTArray<Face>& aFaces);
void OnTakePictureComplete(uint8_t* aData, uint32_t aLength, const nsAString& aMimeType);
void OnTakePictureComplete(const uint8_t* aData, uint32_t aLength, const nsAString& aMimeType);
void OnPoster(dom::BlobImpl* aBlobImpl);
void OnRateLimitPreview(bool aLimit);
bool OnNewPreviewFrame(layers::Image* aImage, uint32_t aWidth, uint32_t aHeight);
@@ -84,7 +91,7 @@ protected:
void AddListenerImpl(already_AddRefed<CameraControlListener> aListener);
void RemoveListenerImpl(CameraControlListener* aListener);
nsTArray<RefPtr<CameraControlListener> > mListeners;
PRRWLock* mListenerLock;
mutable Mutex mListenerLock;
class ControlMessage;
class ListenerMessage;
@@ -116,6 +123,8 @@ protected:
virtual nsresult StartRecordingImpl(DeviceStorageFileDescriptor* aFileDescriptor,
const StartRecordingOptions* aOptions) = 0;
virtual nsresult StopRecordingImpl() = 0;
virtual nsresult PauseRecordingImpl() = 0;
virtual nsresult ResumeRecordingImpl() = 0;
virtual nsresult ResumeContinuousFocusImpl() = 0;
virtual nsresult PushParametersImpl() = 0;
virtual nsresult PullParametersImpl() = 0;
+12 -1
View File
@@ -10,6 +10,10 @@
namespace mozilla {
namespace dom {
class BlobImpl;
}
namespace layers {
class Image;
}
@@ -60,6 +64,10 @@ public:
{
kRecorderStopped,
kRecorderStarted,
kRecorderPaused,
kRecorderResumed,
kPosterCreated,
kPosterFailed,
#ifdef MOZ_B2G_CAMERA
kFileSizeLimitReached,
kVideoLengthLimitReached,
@@ -89,8 +97,9 @@ public:
virtual void OnAutoFocusComplete(bool aAutoFocusSucceeded) { }
virtual void OnAutoFocusMoving(bool aIsMoving) { }
virtual void OnTakePictureComplete(uint8_t* aData, uint32_t aLength, const nsAString& aMimeType) { }
virtual void OnTakePictureComplete(const uint8_t* aData, uint32_t aLength, const nsAString& aMimeType) { }
virtual void OnFacesDetected(const nsTArray<ICameraControl::Face>& aFaces) { }
virtual void OnPoster(dom::BlobImpl* aBlobImpl) { }
enum UserContext
{
@@ -102,6 +111,8 @@ public:
kInTakePicture,
kInStartRecording,
kInStopRecording,
kInPauseRecording,
kInResumeRecording,
kInSetConfiguration,
kInStartPreview,
kInStopPreview,
+174 -12
View File
@@ -37,6 +37,7 @@
#include "mozilla/dom/CameraFacesDetectedEventBinding.h"
#include "mozilla/dom/CameraStateChangeEvent.h"
#include "mozilla/dom/CameraClosedEvent.h"
#include "mozilla/dom/VideoStreamTrack.h"
#include "mozilla/dom/BlobEvent.h"
#include "DOMCameraDetectedFace.h"
#include "mozilla/dom/BindingUtils.h"
@@ -46,6 +47,45 @@ using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::ipc;
class mozilla::TrackCreatedListener : public MediaStreamListener
{
public:
explicit TrackCreatedListener(nsDOMCameraControl* aCameraControl)
: mCameraControl(aCameraControl) {}
void Forget() { mCameraControl = nullptr; }
void DoNotifyTrackCreated(TrackID aTrackID)
{
MOZ_ASSERT(NS_IsMainThread());
if (!mCameraControl) {
return;
}
mCameraControl->TrackCreated(aTrackID);
}
void NotifyQueuedTrackChanges(MediaStreamGraph* aGraph, TrackID aID,
StreamTime aTrackOffset, uint32_t aTrackEvents,
const MediaSegment& aQueuedMedia,
MediaStream* aInputStream,
TrackID aInputTrackID) override
{
if (aTrackEvents & TRACK_EVENT_CREATED) {
nsCOMPtr<nsIRunnable> runnable =
NS_NewRunnableMethodWithArgs<TrackID>(
this, &TrackCreatedListener::DoNotifyTrackCreated, aID);
aGraph->DispatchToMainThreadAfterStreamStateUpdate(runnable.forget());
}
}
protected:
~TrackCreatedListener() {}
nsDOMCameraControl* mCameraControl;
};
#ifdef MOZ_WIDGET_GONK
StaticRefPtr<ICameraControl> nsDOMCameraControl::sCachedCameraControl;
/* static */ nsresult nsDOMCameraControl::sCachedCameraControlStartResult = NS_OK;
@@ -82,6 +122,19 @@ nsDOMCameraControl::HasSupport(JSContext* aCx, JSObject* aGlobal)
return Navigator::HasCameraSupport(aCx, aGlobal);
}
static nsresult
RegisterStorageRequestEvents(DOMRequest* aRequest, nsIDOMEventListener* aListener)
{
EventListenerManager* elm = aRequest->GetOrCreateListenerManager();
if (NS_WARN_IF(!elm)) {
return NS_ERROR_UNEXPECTED;
}
elm->AddEventListener(NS_LITERAL_STRING("success"), aListener, false, false);
elm->AddEventListener(NS_LITERAL_STRING("error"), aListener, false, false);
return NS_OK;
}
class mozilla::StartRecordingHelper : public nsIDOMEventListener
{
public:
@@ -90,6 +143,7 @@ public:
explicit StartRecordingHelper(nsDOMCameraControl* aDOMCameraControl)
: mDOMCameraControl(aDOMCameraControl)
, mState(false)
{
MOZ_COUNT_CTOR(StartRecordingHelper);
}
@@ -98,10 +152,12 @@ protected:
virtual ~StartRecordingHelper()
{
MOZ_COUNT_DTOR(StartRecordingHelper);
mDOMCameraControl->OnCreatedFileDescriptor(mState);
}
protected:
RefPtr<nsDOMCameraControl> mDOMCameraControl;
bool mState;
};
NS_IMETHODIMP
@@ -109,8 +165,7 @@ StartRecordingHelper::HandleEvent(nsIDOMEvent* aEvent)
{
nsString eventType;
aEvent->GetType(eventType);
mDOMCameraControl->OnCreatedFileDescriptor(eventType.EqualsLiteral("success"));
mState = eventType.EqualsLiteral("success");
return NS_OK;
}
@@ -202,6 +257,7 @@ nsDOMCameraControl::nsDOMCameraControl(uint32_t aCameraId,
, mWindow(aWindow)
, mPreviewState(CameraControlListener::kPreviewStopped)
, mRecording(false)
, mRecordingStoppedDeferred(false)
, mSetInitialConfig(false)
{
DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
@@ -263,6 +319,11 @@ nsDOMCameraControl::nsDOMCameraControl(uint32_t aCameraId,
#endif
mCurrentConfiguration = initialConfig.forget();
// Register a TrackCreatedListener directly on CameraPreviewMediaStream
// so we can know the TrackID of the video track.
mTrackCreatedListener = new TrackCreatedListener(this);
mInput->AddListener(mTrackCreatedListener);
// Register the playback listener directly on the camera input stream.
// We want as low latency as possible for the camera, thus avoiding
// MediaStreamGraph altogether. Don't do the regular InitStreamCommon()
@@ -318,6 +379,10 @@ nsDOMCameraControl::~nsDOMCameraControl()
mInput->Destroy();
mInput = nullptr;
}
if (mTrackCreatedListener) {
mTrackCreatedListener->Forget();
mTrackCreatedListener = nullptr;
}
}
JSObject*
@@ -459,6 +524,19 @@ nsDOMCameraControl::GetCameraStream() const
return mInput;
}
void
nsDOMCameraControl::TrackCreated(TrackID aTrackID) {
// This track is not connected through a port.
MediaInputPort* inputPort = nullptr;
dom::VideoStreamTrack* track =
new dom::VideoStreamTrack(this, aTrackID);
RefPtr<TrackPort> port =
new TrackPort(inputPort, track,
TrackPort::InputPortOwnership::OWNED);
mTracks.AppendElement(port.forget());
NotifyTrackAdded(track);
}
#define THROW_IF_NO_CAMERACONTROL(...) \
do { \
if (!mCameraControl) { \
@@ -759,7 +837,11 @@ nsDOMCameraControl::StartRecording(const CameraStartRecordingOptions& aOptions,
return nullptr;
}
if (mStartRecordingPromise || mRecording) {
// If we are trying to start recording, already recording or are still
// waiting for a poster to be created/fail, we need to wait
if (mStartRecordingPromise || mRecording ||
mRecordingStoppedDeferred ||
mOptions.mCreatePoster) {
promise->MaybeReject(NS_ERROR_IN_PROGRESS);
return promise.forget();
}
@@ -778,20 +860,16 @@ nsDOMCameraControl::StartRecording(const CameraStartRecordingOptions& aOptions,
return nullptr;
}
mStartRecordingPromise = promise;
mOptions = aOptions;
EventListenerManager* elm = request->GetOrCreateListenerManager();
if (!elm) {
nsCOMPtr<nsIDOMEventListener> listener = new StartRecordingHelper(this);
aRv = RegisterStorageRequestEvents(request, listener);
if (aRv.Failed()) {
NotifyRecordingStatusChange(NS_LITERAL_STRING("shutdown"));
aRv.Throw(NS_ERROR_UNEXPECTED);
return nullptr;
}
mStartRecordingPromise = promise;
mOptions = aOptions;
mRecording = true;
nsCOMPtr<nsIDOMEventListener> listener = new StartRecordingHelper(this);
elm->AddEventListener(NS_LITERAL_STRING("success"), listener, false, false);
elm->AddEventListener(NS_LITERAL_STRING("error"), listener, false, false);
return promise.forget();
}
@@ -806,6 +884,7 @@ nsDOMCameraControl::OnCreatedFileDescriptor(bool aSucceeded)
// Race condition where StopRecording comes in before we issue
// the start recording request to Gonk
rv = NS_ERROR_ABORT;
mOptions.mCreatePoster = false;
} else if (aSucceeded && mDSFileDescriptor->mFileDescriptor.IsValid()) {
ICameraControl::StartRecordingOptions o;
@@ -813,6 +892,7 @@ nsDOMCameraControl::OnCreatedFileDescriptor(bool aSucceeded)
o.maxFileSizeBytes = mOptions.mMaxFileSizeBytes;
o.maxVideoLengthMs = mOptions.mMaxVideoLengthMs;
o.autoEnableLowLightTorch = mOptions.mAutoEnableLowLightTorch;
o.createPoster = mOptions.mCreatePoster;
rv = mCameraControl->StartRecording(mDSFileDescriptor.get(), &o);
if (NS_SUCCEEDED(rv)) {
return;
@@ -842,6 +922,24 @@ nsDOMCameraControl::StopRecording(ErrorResult& aRv)
aRv = mCameraControl->StopRecording();
}
void
nsDOMCameraControl::PauseRecording(ErrorResult& aRv)
{
DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
THROW_IF_NO_CAMERACONTROL();
aRv = mCameraControl->PauseRecording();
}
void
nsDOMCameraControl::ResumeRecording(ErrorResult& aRv)
{
DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
THROW_IF_NO_CAMERACONTROL();
aRv = mCameraControl->ResumeRecording();
}
void
nsDOMCameraControl::ResumePreview(ErrorResult& aRv)
{
@@ -1274,6 +1372,30 @@ nsDOMCameraControl::OnPreviewStateChange(CameraControlListener::PreviewState aSt
DispatchPreviewStateEvent(aState);
}
void
nsDOMCameraControl::OnPoster(BlobImpl* aPoster)
{
DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(mOptions.mCreatePoster);
RefPtr<Blob> blob = Blob::Create(GetParentObject(), aPoster);
if (NS_WARN_IF(!blob)) {
OnRecorderStateChange(CameraControlListener::kPosterFailed, 0, 0);
return;
}
BlobEventInit eventInit;
eventInit.mData = blob;
RefPtr<BlobEvent> event = BlobEvent::Constructor(this,
NS_LITERAL_STRING("poster"),
eventInit);
DispatchTrustedEvent(event);
OnRecorderStateChange(CameraControlListener::kPosterCreated, 0, 0);
}
void
nsDOMCameraControl::OnRecorderStateChange(CameraControlListener::RecorderState aState,
int32_t aArg, int32_t aTrackNum)
@@ -1298,10 +1420,33 @@ nsDOMCameraControl::OnRecorderStateChange(CameraControlListener::RecorderState a
break;
case CameraControlListener::kRecorderStopped:
if (mOptions.mCreatePoster) {
mRecordingStoppedDeferred = true;
return;
}
NotifyRecordingStatusChange(NS_LITERAL_STRING("shutdown"));
state = NS_LITERAL_STRING("Stopped");
break;
case CameraControlListener::kPosterCreated:
state = NS_LITERAL_STRING("PosterCreated");
mOptions.mCreatePoster = false;
break;
case CameraControlListener::kPosterFailed:
state = NS_LITERAL_STRING("PosterFailed");
mOptions.mCreatePoster = false;
break;
case CameraControlListener::kRecorderPaused:
state = NS_LITERAL_STRING("Paused");
break;
case CameraControlListener::kRecorderResumed:
state = NS_LITERAL_STRING("Resumed");
break;
#ifdef MOZ_B2G_CAMERA
case CameraControlListener::kFileSizeLimitReached:
state = NS_LITERAL_STRING("FileSizeLimitReached");
@@ -1334,6 +1479,11 @@ nsDOMCameraControl::OnRecorderStateChange(CameraControlListener::RecorderState a
}
DispatchStateEvent(NS_LITERAL_STRING("recorderstatechange"), state);
if (mRecordingStoppedDeferred && !mOptions.mCreatePoster) {
mRecordingStoppedDeferred = false;
OnRecorderStateChange(CameraControlListener::kRecorderStopped, 0, 0);
}
}
void
@@ -1553,6 +1703,18 @@ nsDOMCameraControl::OnUserError(CameraControlListener::UserContext aContext, nsr
NS_WARNING("Failed to stop recording");
return;
case CameraControlListener::kInPauseRecording:
// This method doesn't have any callbacks, so all we can do is log the
// failure. This only happens after the hardware has been released.
NS_WARNING("Failed to pause recording");
return;
case CameraControlListener::kInResumeRecording:
// This method doesn't have any callbacks, so all we can do is log the
// failure. This only happens after the hardware has been released.
NS_WARNING("Failed to resume recording");
return;
case CameraControlListener::kInStartPreview:
// This method doesn't have any callbacks, so all we can do is log the
// failure. This only happens after the hardware has been released.
+15
View File
@@ -39,6 +39,8 @@ namespace dom {
} // namespace dom
class ErrorResult;
class StartRecordingHelper;
class RecorderPosterHelper;
class TrackCreatedListener;
#define NS_DOM_CAMERA_CONTROL_CID \
{ 0x3700c096, 0xf920, 0x438d, \
@@ -72,6 +74,10 @@ public:
MediaStream* GetCameraStream() const override;
// Called by TrackCreatedListener when the underlying track has been created.
// XXX Bug 1124630. This can be removed with CameraPreviewMediaStream.
void TrackCreated(TrackID aTrackID);
// Attributes.
void GetEffect(nsString& aEffect, ErrorResult& aRv);
void SetEffect(const nsAString& aEffect, ErrorResult& aRv);
@@ -121,6 +127,8 @@ public:
const nsAString& filename,
ErrorResult& aRv);
void StopRecording(ErrorResult& aRv);
void PauseRecording(ErrorResult& aRv);
void ResumeRecording(ErrorResult& aRv);
void ResumePreview(ErrorResult& aRv);
already_AddRefed<dom::Promise> ReleaseHardware(ErrorResult& aRv);
void ResumeContinuousFocus(ErrorResult& aRv);
@@ -142,6 +150,7 @@ public:
IMPL_EVENT_HANDLER(focus)
IMPL_EVENT_HANDLER(picture)
IMPL_EVENT_HANDLER(configurationchange)
IMPL_EVENT_HANDLER(poster)
protected:
virtual ~nsDOMCameraControl();
@@ -165,6 +174,7 @@ protected:
friend class DOMCameraControlListener;
friend class mozilla::StartRecordingHelper;
friend class mozilla::RecorderPosterHelper;
void OnCreatedFileDescriptor(bool aSucceeded);
@@ -172,6 +182,7 @@ protected:
void OnAutoFocusMoving(bool aIsMoving);
void OnTakePictureComplete(nsIDOMBlob* aPicture);
void OnFacesDetected(const nsTArray<ICameraControl::Face>& aFaces);
void OnPoster(dom::BlobImpl* aPoster);
void OnGetCameraComplete();
void OnHardwareStateChange(DOMCameraControlListener::HardwareState aState, nsresult aReason);
@@ -220,6 +231,9 @@ protected:
// our viewfinder stream
RefPtr<CameraPreviewMediaStream> mInput;
// A listener on mInput for adding tracks to the DOM side.
RefPtr<TrackCreatedListener> mTrackCreatedListener;
// set once when this object is created
nsCOMPtr<nsPIDOMWindow> mWindow;
@@ -227,6 +241,7 @@ protected:
RefPtr<DeviceStorageFileDescriptor> mDSFileDescriptor;
DOMCameraControlListener::PreviewState mPreviewState;
bool mRecording;
bool mRecordingStoppedDeferred;
bool mSetInitialConfig;
#ifdef MOZ_WIDGET_GONK
+30 -4
View File
@@ -341,18 +341,20 @@ DOMCameraControlListener::OnAutoFocusComplete(bool aAutoFocusSucceeded)
}
void
DOMCameraControlListener::OnTakePictureComplete(uint8_t* aData, uint32_t aLength, const nsAString& aMimeType)
DOMCameraControlListener::OnTakePictureComplete(const uint8_t* aData, uint32_t aLength, const nsAString& aMimeType)
{
class Callback : public DOMCallback
{
public:
Callback(nsMainThreadPtrHandle<nsISupports> aDOMCameraControl,
uint8_t* aData, uint32_t aLength, const nsAString& aMimeType)
const uint8_t* aData, uint32_t aLength, const nsAString& aMimeType)
: DOMCallback(aDOMCameraControl)
, mData(aData)
, mLength(aLength)
, mMimeType(aMimeType)
{ }
{
mData = (uint8_t*) malloc(aLength);
memcpy(mData, aData, aLength);
}
void
RunCallback(nsDOMCameraControl* aDOMCameraControl) override
@@ -408,3 +410,27 @@ DOMCameraControlListener::OnUserError(UserContext aContext, nsresult aError)
NS_DispatchToMainThread(new Callback(mDOMCameraControl, aContext, aError));
}
void
DOMCameraControlListener::OnPoster(BlobImpl* aBlobImpl)
{
class Callback : public DOMCallback
{
public:
Callback(nsMainThreadPtrHandle<nsISupports> aDOMCameraControl, BlobImpl* aBlobImpl)
: DOMCallback(aDOMCameraControl)
, mBlobImpl(aBlobImpl)
{ }
void
RunCallback(nsDOMCameraControl* aDOMCameraControl) override
{
aDOMCameraControl->OnPoster(mBlobImpl);
}
protected:
RefPtr<BlobImpl> mBlobImpl;
};
NS_DispatchToMainThread(new Callback(mDOMCameraControl, aBlobImpl));
}
+2 -1
View File
@@ -21,7 +21,7 @@ public:
virtual void OnAutoFocusComplete(bool aAutoFocusSucceeded) override;
virtual void OnAutoFocusMoving(bool aIsMoving) override;
virtual void OnFacesDetected(const nsTArray<ICameraControl::Face>& aFaces) override;
virtual void OnTakePictureComplete(uint8_t* aData, uint32_t aLength, const nsAString& aMimeType) override;
virtual void OnTakePictureComplete(const uint8_t* aData, uint32_t aLength, const nsAString& aMimeType) override;
virtual void OnHardwareStateChange(HardwareState aState, nsresult aReason) override;
virtual void OnPreviewStateChange(PreviewState aState) override;
@@ -31,6 +31,7 @@ public:
virtual void OnRateLimitPreview(bool aLimit) override;
virtual bool OnNewPreviewFrame(layers::Image* aImage, uint32_t aWidth, uint32_t aHeight) override;
virtual void OnUserError(UserContext aContext, nsresult aError) override;
virtual void OnPoster(dom::BlobImpl* aBlobImpl) override;
protected:
virtual ~DOMCameraControlListener();
+400 -66
View File
@@ -27,17 +27,22 @@
#include <media/mediaplayer.h>
#include <media/MediaProfiles.h>
#include "GrallocImages.h"
#include "imgIEncoder.h"
#include "libyuv.h"
#include "nsNetUtil.h" // for NS_ReadInputStreamToBuffer
#endif
#include "nsNetCID.h" // for NS_STREAMTRANSPORTSERVICE_CONTRACTID
#include "nsAutoPtr.h" // for nsAutoArrayPtr
#include "nsCOMPtr.h"
#include "nsMemory.h"
#include "nsThread.h"
#include "nsITimer.h"
#include "mozilla/FileUtils.h"
#include "mozilla/Services.h"
#include "mozilla/unused.h"
#include "mozilla/ipc/FileDescriptorUtils.h"
#include "nsAlgorithm.h"
#include "nsPrintfCString.h"
#include "AutoRwLock.h"
#include "GonkCameraHwMgr.h"
#include "GonkRecorderProfiles.h"
#include "CameraCommon.h"
@@ -45,6 +50,7 @@
#include "DeviceStorageFileDescriptor.h"
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::layers;
using namespace mozilla::gfx;
using namespace mozilla::ipc;
@@ -59,6 +65,9 @@ using namespace android;
} \
} while(0)
static const unsigned long kAutoFocusCompleteTimeoutMs = 1000;
static const int32_t kAutoFocusCompleteTimeoutLimit = 3;
// Construct nsGonkCameraControl on the main thread.
nsGonkCameraControl::nsGonkCameraControl(uint32_t aCameraId)
: mCameraId(aCameraId)
@@ -75,11 +84,20 @@ nsGonkCameraControl::nsGonkCameraControl(uint32_t aCameraId)
#endif
, mRecorderMonitor("GonkCameraControl::mRecorder.Monitor")
, mVideoFile(nullptr)
, mCapturePoster(false)
, mAutoFocusPending(false)
, mAutoFocusCompleteExpired(0)
, mPrevFacesDetected(0)
, mReentrantMonitor("GonkCameraControl::OnTakePicture.Monitor")
{
// Constructor runs on the main thread...
DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
mImageContainer = LayerManager::CreateImageContainer();
mAutoFocusCompleteTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
if (NS_WARN_IF(!mAutoFocusCompleteTimer)) {
mAutoFocusCompleteExpired = kAutoFocusCompleteTimeoutLimit;
}
}
nsresult
@@ -122,13 +140,19 @@ nsGonkCameraControl::StartInternal(const Configuration* aInitialConfig)
case NS_ERROR_ALREADY_INITIALIZED:
case NS_OK:
break;
default:
return rv;
}
if (aInitialConfig) {
rv = SetConfigurationInternal(*aInitialConfig);
Configuration config;
rv = ValidateConfiguration(*aInitialConfig, config);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
rv = SetConfigurationInternal(config);
if (NS_WARN_IF(NS_FAILED(rv))) {
// The initial configuration failed, close up the hardware
StopInternal();
@@ -166,9 +190,11 @@ nsGonkCameraControl::Initialize()
DOM_CAMERA_LOGI("Initializing camera %d (this=%p, mCameraHw=%p)\n", mCameraId, this, mCameraHw.get());
mCurrentConfiguration.mRecorderProfile.Truncate();
mRequestedPreviewSize.width = UINT32_MAX;
mRequestedPreviewSize.height = UINT32_MAX;
// Initialize our camera configuration database.
PullParametersImpl();
mCameraHw->PullParameters(mParams);
// Set preferred preview frame format.
mParams.Set(CAMERA_PARAM_PREVIEWFORMAT, NS_LITERAL_STRING("yuv420sp"));
@@ -261,7 +287,7 @@ nsGonkCameraControl::Initialize()
DOM_CAMERA_LOGI(" - metering mode: '%s'\n",
NS_ConvertUTF16toUTF8(mode).get());
}
return NS_OK;
}
@@ -304,9 +330,19 @@ nsGonkCameraControl::ValidateConfiguration(const Configuration& aConfig, Configu
return NS_ERROR_INVALID_ARG;
}
if (mCurrentConfiguration.mMode == aConfig.mMode &&
mCurrentConfiguration.mRecorderProfile.Equals(profile->GetName()) &&
mRequestedPreviewSize.Equals(aConfig.mPreviewSize) &&
mCurrentConfiguration.mPictureSize.Equals(aValidatedConfig.mPictureSize))
{
DOM_CAMERA_LOGI("Camera configuration is unchanged\n");
return NS_ERROR_ALREADY_INITIALIZED;
}
aValidatedConfig.mMode = aConfig.mMode;
aValidatedConfig.mPreviewSize = aConfig.mPreviewSize;
aValidatedConfig.mRecorderProfile = profile->GetName();
mRequestedPreviewSize = aConfig.mPreviewSize;
return NS_OK;
}
@@ -315,53 +351,46 @@ nsGonkCameraControl::SetConfigurationInternal(const Configuration& aConfig)
{
DOM_CAMERA_LOGT("%s:%d\n", __func__, __LINE__);
// Ensure sanity of all provided parameters and determine defaults if
// none are provided when given a new configuration
Configuration config;
nsresult rv = ValidateConfiguration(aConfig, config);
ICameraControlParameterSetAutoEnter set(this);
nsresult rv;
switch (aConfig.mMode) {
case kPictureMode:
rv = SetPictureConfiguration(aConfig);
break;
case kVideoMode:
rv = SetVideoConfiguration(aConfig);
break;
default:
MOZ_ASSERT_UNREACHABLE("Unanticipated camera mode in SetConfigurationInternal()");
rv = NS_ERROR_FAILURE;
break;
}
DOM_CAMERA_LOGT("%s:%d\n", __func__, __LINE__);
if (NS_WARN_IF(NS_FAILED(rv))) {
mRequestedPreviewSize.width = UINT32_MAX;
mRequestedPreviewSize.height = UINT32_MAX;
return rv;
}
{
ICameraControlParameterSetAutoEnter set(this);
rv = Set(CAMERA_PARAM_RECORDINGHINT, aConfig.mMode == kVideoMode);
if (NS_FAILED(rv)) {
DOM_CAMERA_LOGE("Failed to set recording hint (0x%x)\n", rv);
}
switch (config.mMode) {
case kPictureMode:
rv = SetPictureConfiguration(config);
break;
mCurrentConfiguration.mMode = aConfig.mMode;
mCurrentConfiguration.mRecorderProfile = aConfig.mRecorderProfile;
case kVideoMode:
rv = SetVideoConfiguration(config);
break;
default:
MOZ_ASSERT_UNREACHABLE("Unanticipated camera mode in SetConfigurationInternal()");
rv = NS_ERROR_FAILURE;
break;
}
DOM_CAMERA_LOGT("%s:%d\n", __func__, __LINE__);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
rv = Set(CAMERA_PARAM_RECORDINGHINT, config.mMode == kVideoMode);
if (NS_FAILED(rv)) {
DOM_CAMERA_LOGE("Failed to set recording hint (0x%x)\n", rv);
}
mCurrentConfiguration.mMode = config.mMode;
mCurrentConfiguration.mRecorderProfile = config.mRecorderProfile;
if (config.mMode == kPictureMode) {
mCurrentConfiguration.mPictureSize = config.mPictureSize;
} else /* if config.mMode == kVideoMode */ {
// The following is best-effort; we don't currently support taking
// pictures while in video mode, but we should at least return
// sane values to OnConfigurationChange() handlers...
SetPictureSizeImpl(config.mPictureSize);
}
if (aConfig.mMode == kPictureMode) {
mCurrentConfiguration.mPictureSize = aConfig.mPictureSize;
} else /* if config.mMode == kVideoMode */ {
// The following is best-effort; we don't currently support taking
// pictures while in video mode, but we should at least return
// sane values to OnConfigurationChange() handlers...
SetPictureSizeImpl(aConfig.mPictureSize);
}
return NS_OK;
}
@@ -377,8 +406,19 @@ nsGonkCameraControl::SetConfigurationImpl(const Configuration& aConfig)
return NS_ERROR_INVALID_ARG;
}
Configuration config;
nsresult rv = ValidateConfiguration(aConfig, config);
if (rv == NS_ERROR_ALREADY_INITIALIZED) {
// Configuration did not change, so no need to stop/start the preview
// or push parameters to the camera hardware
OnConfigurationChange();
return NS_OK;
} else if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
// Stop any currently running preview
nsresult rv = PausePreview();
rv = PausePreview();
if (NS_FAILED(rv)) {
DOM_CAMERA_LOGW("PausePreview() in SetConfigurationImpl() failed (0x%x)\n", rv);
if (rv == NS_ERROR_NOT_INITIALIZED) {
@@ -389,7 +429,7 @@ nsGonkCameraControl::SetConfigurationImpl(const Configuration& aConfig)
}
DOM_CAMERA_LOGT("%s:%d\n", __func__, __LINE__);
rv = SetConfigurationInternal(aConfig);
rv = SetConfigurationInternal(config);
if (NS_WARN_IF(NS_FAILED(rv))) {
StopPreviewImpl();
return rv;
@@ -813,6 +853,12 @@ nsGonkCameraControl::AutoFocusImpl()
if (mCameraHw->AutoFocus() != OK) {
return NS_ERROR_FAILURE;
}
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
mAutoFocusPending = true;
if (mAutoFocusCompleteTimer) {
mAutoFocusCompleteTimer->Cancel();
}
return NS_OK;
}
@@ -1110,7 +1156,13 @@ nsGonkCameraControl::PullParametersImpl()
DOM_CAMERA_LOGI("Pulling camera parameters\n");
RETURN_IF_NO_CAMERA_HW();
return mCameraHw->PullParameters(mParams);
nsresult rv = mCameraHw->PullParameters(mParams);
mParams.Get(CAMERA_PARAM_THUMBNAILSIZE, mLastThumbnailSize);
mParams.Get(CAMERA_PARAM_PICTURE_SIZE, mCurrentConfiguration.mPictureSize);
mParams.Get(CAMERA_PARAM_PREVIEWSIZE, mCurrentConfiguration.mPreviewSize);
mParams.Get(CAMERA_PARAM_VIDEOSIZE, mLastRecorderSize);
return rv;
}
nsresult
@@ -1229,6 +1281,7 @@ nsGonkCameraControl::StartRecordingImpl(DeviceStorageFileDescriptor* aFileDescri
#endif
OnRecorderStateChange(CameraControlListener::kRecorderStarted);
mCapturePoster = aOptions->createPoster;
return NS_OK;
}
@@ -1273,6 +1326,9 @@ nsGonkCameraControl::StopRecordingImpl()
return NS_OK;
}
#endif
if (mCapturePoster.exchange(false)) {
OnPoster(nullptr, 0);
}
OnRecorderStateChange(CameraControlListener::kRecorderStopped);
{
@@ -1290,6 +1346,48 @@ nsGonkCameraControl::StopRecordingImpl()
return NS_DispatchToMainThread(new RecordingComplete(mVideoFile.forget()));
}
nsresult
nsGonkCameraControl::PauseRecordingImpl()
{
ReentrantMonitorAutoEnter mon(mRecorderMonitor);
#ifdef MOZ_WIDGET_GONK
if (!mRecorder) {
return NS_ERROR_NOT_AVAILABLE;
}
int err = mRecorder->pause();
switch (err) {
case OK:
break;
case INVALID_OPERATION:
return NS_ERROR_NOT_IMPLEMENTED;
default:
return NS_ERROR_FAILURE;
}
#endif
OnRecorderStateChange(CameraControlListener::kRecorderPaused);
return NS_OK;
}
nsresult
nsGonkCameraControl::ResumeRecordingImpl()
{
ReentrantMonitorAutoEnter mon(mRecorderMonitor);
#ifdef MOZ_WIDGET_GONK
if (!mRecorder) {
return NS_ERROR_NOT_AVAILABLE;
}
if (mRecorder->resume() != OK) {
return NS_ERROR_FAILURE;
}
#endif
OnRecorderStateChange(CameraControlListener::kRecorderResumed);
return NS_OK;
}
nsresult
nsGonkCameraControl::ResumeContinuousFocusImpl()
{
@@ -1307,30 +1405,118 @@ nsGonkCameraControl::ResumeContinuousFocusImpl()
return NS_OK;
}
class AutoFocusMovingTimerCallback : public nsITimerCallback
{
public:
NS_DECL_THREADSAFE_ISUPPORTS
AutoFocusMovingTimerCallback(nsGonkCameraControl* aCameraControl)
: mCameraControl(aCameraControl)
{ }
NS_IMETHODIMP
Notify(nsITimer* aTimer)
{
mCameraControl->OnAutoFocusComplete(true, true);
return NS_OK;
}
protected:
virtual ~AutoFocusMovingTimerCallback()
{ }
RefPtr<nsGonkCameraControl> mCameraControl;
};
NS_IMPL_ISUPPORTS(AutoFocusMovingTimerCallback, nsITimerCallback);
void
nsGonkCameraControl::OnAutoFocusComplete(bool aSuccess)
nsGonkCameraControl::OnAutoFocusMoving(bool aIsMoving)
{
CameraControlImpl::OnAutoFocusMoving(aIsMoving);
if (!aIsMoving) {
/* Some drivers do not signal us with the status of the continuous auto focus
operation, only the moving signal which comes first. As a result we need to
arm a timer to detect the driver behaviour and if necessary generate the
signal ourselves to update the application state. */
int32_t expiredCount = 0;
{
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
if (mAutoFocusCompleteTimer) {
mAutoFocusCompleteTimer->Cancel();
if (!mAutoFocusPending) {
RefPtr<nsITimerCallback> timerCb = new AutoFocusMovingTimerCallback(this);
nsresult rv = mAutoFocusCompleteTimer->InitWithCallback(timerCb,
kAutoFocusCompleteTimeoutMs,
nsITimer::TYPE_ONE_SHOT);
NS_WARN_IF(NS_FAILED(rv));
}
return;
}
if (!mAutoFocusPending) {
expiredCount = mAutoFocusCompleteExpired;
}
}
if (expiredCount == kAutoFocusCompleteTimeoutLimit) {
OnAutoFocusComplete(true, true);
}
}
}
void
nsGonkCameraControl::OnAutoFocusComplete(bool aSuccess, bool aExpired)
{
class AutoFocusComplete : public nsRunnable
{
public:
AutoFocusComplete(nsGonkCameraControl* aCameraControl, bool aSuccess)
AutoFocusComplete(nsGonkCameraControl* aCameraControl, bool aSuccess, bool aExpired)
: mCameraControl(aCameraControl)
, mSuccess(aSuccess)
, mExpired(aExpired)
{ }
NS_IMETHODIMP
Run() override
{
mCameraControl->OnAutoFocusComplete(mSuccess);
mCameraControl->OnAutoFocusComplete(mSuccess, mExpired);
return NS_OK;
}
protected:
RefPtr<nsGonkCameraControl> mCameraControl;
bool mSuccess;
bool mExpired;
};
if (NS_GetCurrentThread() == mCameraThread) {
{
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
if (mAutoFocusPending) {
mAutoFocusPending = false;
} else if (mAutoFocusCompleteTimer) {
if (aExpired) {
NS_WARNING("Camera timed out waiting for OnAutoFocusComplete");
++mAutoFocusCompleteExpired;
} else {
mAutoFocusCompleteTimer->Cancel();
--mAutoFocusCompleteExpired;
}
if (mAutoFocusCompleteExpired == kAutoFocusCompleteTimeoutLimit ||
mAutoFocusCompleteExpired == -kAutoFocusCompleteTimeoutLimit)
{
mAutoFocusCompleteTimer = nullptr;
}
}
}
/**
* Auto focusing can change some of the camera's parameters, so
* we need to pull a new set before notifying any clients.
@@ -1344,7 +1530,7 @@ nsGonkCameraControl::OnAutoFocusComplete(bool aSuccess)
* Because the callback needs to call PullParametersImpl(),
* we need to dispatch this callback through the Camera Thread.
*/
mCameraThread->Dispatch(new AutoFocusComplete(this, aSuccess), NS_DISPATCH_NORMAL);
mCameraThread->Dispatch(new AutoFocusComplete(this, aSuccess, aExpired), NS_DISPATCH_NORMAL);
}
bool
@@ -1372,6 +1558,11 @@ nsGonkCameraControl::OnFacesDetected(camera_frame_metadata_t* aMetaData)
nsTArray<Face> faces;
uint32_t numFaces = aMetaData->number_of_faces;
if (numFaces == 0 && mPrevFacesDetected == 0) {
return;
}
mPrevFacesDetected = numFaces;
DOM_CAMERA_LOGI("Camera detected %d face(s)", numFaces);
faces.SetCapacity(numFaces);
@@ -1429,14 +1620,10 @@ nsGonkCameraControl::OnTakePictureComplete(uint8_t* aData, uint32_t aLength)
{
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
uint8_t* data = new uint8_t[aLength];
memcpy(data, aData, aLength);
nsString s(NS_LITERAL_STRING("image/"));
s.Append(mFileFormat);
DOM_CAMERA_LOGI("Got picture, type '%s', %u bytes\n", NS_ConvertUTF16toUTF8(s).get(), aLength);
OnTakePictureComplete(data, aLength, s);
OnTakePictureComplete(aData, aLength, s);
if (mResumePreviewAfterTakingPicture) {
nsresult rv = StartPreview();
@@ -1911,11 +2098,13 @@ nsGonkCameraControl::SetupRecording(int aFd, int aRotation,
NS_ERROR_INVALID_ARG);
// adjust rotation by camera sensor offset
int r = aRotation;
r += mCameraHw->GetSensorOrientation();
r = RationalizeRotation(r);
DOM_CAMERA_LOGI("setting video rotation to %d degrees (mapped from %d)\n", r, aRotation);
snprintf(buffer, SIZE, "video-param-rotation-angle-degrees=%d", r);
mVideoRotation = aRotation;
mVideoRotation += mCameraHw->GetSensorOrientation();
mVideoRotation = RationalizeRotation(mVideoRotation);
DOM_CAMERA_LOGI("setting video rotation to %d degrees (mapped from %d)\n",
mVideoRotation, aRotation);
snprintf(buffer, SIZE, "video-param-rotation-angle-degrees=%d",
mVideoRotation);
CHECK_SETARG_RETURN(mRecorder->setParameters(String8(buffer)),
NS_ERROR_INVALID_ARG);
@@ -1983,6 +2172,7 @@ nsGonkCameraControl::LoadRecorderProfiles()
nsTArray<RecorderProfile>::size_type bestIndexMatch = 0;
int bestAreaMatch = 0;
uint32_t bestPriorityMatch = UINT32_MAX;
// Limit profiles to those video sizes supported by the camera hardware...
for (nsTArray<RecorderProfile>::size_type i = 0; i < profiles.Length(); ++i) {
@@ -1997,17 +2187,22 @@ nsGonkCameraControl::LoadRecorderProfiles()
if (static_cast<uint32_t>(width) == sizes[n].width &&
static_cast<uint32_t>(height) == sizes[n].height) {
mRecorderProfiles.Put(profiles[i]->GetName(), profiles[i]);
// "Best" or default profile is the one with the lowest priority
// value and largest area.
int area = width * height;
if (area > bestAreaMatch) {
uint32_t priority = profiles[i]->GetPriority();
if (bestPriorityMatch > priority ||
(bestPriorityMatch == priority && area > bestAreaMatch)) {
bestIndexMatch = i;
bestAreaMatch = area;
bestPriorityMatch = priority;
}
break;
}
}
}
// Default profile is the one with the largest area.
if (bestAreaMatch > 0) {
nsAutoString name;
name.AssignASCII("default");
@@ -2058,6 +2253,137 @@ nsGonkCameraControl::OnRateLimitPreview(bool aLimit)
CameraControlImpl::OnRateLimitPreview(aLimit);
}
void
nsGonkCameraControl::CreatePoster(Image* aImage, uint32_t aWidth, uint32_t aHeight, int32_t aRotation)
{
class PosterRunnable : public nsRunnable {
public:
PosterRunnable(nsGonkCameraControl* aTarget, Image* aImage,
uint32_t aWidth, uint32_t aHeight, int32_t aRotation)
: mTarget(aTarget)
, mImage(aImage)
, mWidth(aWidth)
, mHeight(aHeight)
, mRotation(aRotation)
, mDst(nullptr)
, mDstLength(0)
{ }
virtual ~PosterRunnable()
{
mTarget->OnPoster(mDst, mDstLength);
}
NS_IMETHODIMP Run() override
{
#ifdef MOZ_WIDGET_GONK
// NV21 (yuv420sp) is 12 bits / pixel
size_t srcLength = (mWidth * mHeight * 3 + 1) / 2;
// ARGB is 32 bits / pixel
size_t tmpLength = mWidth * mHeight * sizeof(uint32_t);
nsAutoArrayPtr<uint8_t> tmp;
tmp = new uint8_t[tmpLength];
GrallocImage* nativeImage = static_cast<GrallocImage*>(mImage.get());
android::sp<GraphicBuffer> graphicBuffer = nativeImage->GetGraphicBuffer();
void* graphicSrc = nullptr;
graphicBuffer->lock(GraphicBuffer::USAGE_SW_READ_MASK, &graphicSrc);
uint32_t stride = mWidth * 4;
int err = libyuv::ConvertToARGB(static_cast<uint8_t*>(graphicSrc),
srcLength, tmp, stride, 0, 0,
mWidth, mHeight, mWidth, mHeight,
libyuv::kRotate0, libyuv::FOURCC_NV21);
graphicBuffer->unlock();
graphicSrc = nullptr;
graphicBuffer.clear();
nativeImage = nullptr;
mImage = nullptr;
if (NS_WARN_IF(err < 0)) {
DOM_CAMERA_LOGE("CreatePoster: to ARGB failed (%d)\n", err);
return NS_OK;
}
nsCOMPtr<imgIEncoder> encoder =
do_CreateInstance("@mozilla.org/image/encoder;2?type=image/jpeg");
if (NS_WARN_IF(!encoder)) {
DOM_CAMERA_LOGE("CreatePoster: no JPEG encoder\n");
return NS_OK;
}
nsString opt;
nsresult rv = encoder->InitFromData(tmp, tmpLength, mWidth,
mHeight, stride,
imgIEncoder::INPUT_FORMAT_HOSTARGB,
opt);
if (NS_WARN_IF(NS_FAILED(rv))) {
DOM_CAMERA_LOGE("CreatePoster: encoder init failed (0x%x)\n",
rv);
return NS_OK;
}
nsCOMPtr<nsIInputStream> stream = do_QueryInterface(encoder);
if (NS_WARN_IF(!stream)) {
DOM_CAMERA_LOGE("CreatePoster: to input stream failed\n");
return NS_OK;
}
uint64_t length = 0;
rv = stream->Available(&length);
if (NS_WARN_IF(NS_FAILED(rv))) {
DOM_CAMERA_LOGE("CreatePoster: get length failed (0x%x)\n",
rv);
return NS_OK;
}
rv = NS_ReadInputStreamToBuffer(stream, &mDst, length);
if (NS_WARN_IF(NS_FAILED(rv))) {
DOM_CAMERA_LOGE("CreatePoster: read failed (0x%x)\n", rv);
mDst = nullptr;
return NS_OK;
}
mDstLength = length;
#endif
return NS_OK;
}
private:
RefPtr<nsGonkCameraControl> mTarget;
RefPtr<Image> mImage;
int32_t mWidth;
int32_t mHeight;
int32_t mRotation;
void* mDst;
size_t mDstLength;
};
nsCOMPtr<nsIRunnable> event = new PosterRunnable(this, aImage,
aWidth,
aHeight,
aRotation);
nsCOMPtr<nsIEventTarget> target
= do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID);
MOZ_ASSERT(target);
target->Dispatch(event, NS_DISPATCH_NORMAL);
}
void
nsGonkCameraControl::OnPoster(void* aData, uint32_t aLength)
{
RefPtr<BlobImpl> blobImpl;
if (aData) {
blobImpl = new BlobImplMemory(aData, aLength, NS_LITERAL_STRING("image/jpeg"));
}
CameraControlImpl::OnPoster(blobImpl);
}
void
nsGonkCameraControl::OnNewPreviewFrame(layers::TextureClient* aBuffer)
{
@@ -2072,6 +2398,14 @@ nsGonkCameraControl::OnNewPreviewFrame(layers::TextureClient* aBuffer)
mCurrentConfiguration.mPreviewSize.height);
videoImage->SetData(data);
if (mCapturePoster.exchange(false)) {
CreatePoster(frame,
mCurrentConfiguration.mPreviewSize.width,
mCurrentConfiguration.mPreviewSize.height,
mVideoRotation);
return;
}
OnNewPreviewFrame(frame, mCurrentConfiguration.mPreviewSize.width,
mCurrentConfiguration.mPreviewSize.height);
#endif
@@ -2107,7 +2441,7 @@ OnTakePictureError(nsGonkCameraControl* gc)
void
OnAutoFocusComplete(nsGonkCameraControl* gc, bool aSuccess)
{
gc->OnAutoFocusComplete(aSuccess);
gc->OnAutoFocusComplete(aSuccess, false);
}
void
+19 -1
View File
@@ -34,6 +34,7 @@
#include "FallbackCameraPlatform.h"
#endif
class nsITimer;
namespace android {
class GonkCameraHardware;
@@ -46,6 +47,7 @@ namespace mozilla {
namespace layers {
class TextureClient;
class ImageContainer;
class Image;
}
class nsGonkCameraControl : public CameraControlImpl
@@ -53,11 +55,13 @@ class nsGonkCameraControl : public CameraControlImpl
public:
nsGonkCameraControl(uint32_t aCameraId);
void OnAutoFocusComplete(bool aSuccess);
void OnAutoFocusMoving(bool aIsMoving);
void OnAutoFocusComplete(bool aSuccess, bool aExpired);
void OnFacesDetected(camera_frame_metadata_t* aMetaData);
void OnTakePictureComplete(uint8_t* aData, uint32_t aLength);
void OnTakePictureError();
void OnRateLimitPreview(bool aLimit);
void OnPoster(void* aData, uint32_t aLength);
void OnNewPreviewFrame(layers::TextureClient* aBuffer);
#ifdef MOZ_WIDGET_GONK
void OnRecorderEvent(int msg, int ext1, int ext2);
@@ -134,6 +138,8 @@ protected:
virtual nsresult StartRecordingImpl(DeviceStorageFileDescriptor* aFileDescriptor,
const StartRecordingOptions* aOptions = nullptr) override;
virtual nsresult StopRecordingImpl() override;
virtual nsresult PauseRecordingImpl() override;
virtual nsresult ResumeRecordingImpl() override;
virtual nsresult ResumeContinuousFocusImpl() override;
virtual nsresult PushParametersImpl() override;
virtual nsresult PullParametersImpl() override;
@@ -147,6 +153,8 @@ protected:
nsresult PausePreview();
nsresult GetSupportedSize(const Size& aSize, const nsTArray<Size>& supportedSizes, Size& best);
void CreatePoster(layers::Image* aImage, uint32_t aWidth, uint32_t aHeight, int32_t aRotation);
nsresult LoadRecorderProfiles();
static PLDHashOperator Enumerate(const nsAString& aProfileName,
RecorderProfile* aProfile,
@@ -171,6 +179,7 @@ protected:
Size mLastThumbnailSize;
Size mLastRecorderSize;
Size mRequestedPreviewSize;
uint32_t mPreviewFps;
bool mResumePreviewAfterTakingPicture;
bool mFlashSupported;
@@ -196,6 +205,15 @@ protected:
RefPtr<DeviceStorageFile> mVideoFile;
nsString mFileFormat;
Atomic<bool> mCapturePoster;
int32_t mVideoRotation;
bool mAutoFocusPending;
nsCOMPtr<nsITimer> mAutoFocusCompleteTimer;
int32_t mAutoFocusCompleteExpired;
uint32_t mPrevFacesDetected;
// Guards against calling StartPreviewImpl() while in OnTakePictureComplete().
ReentrantMonitor mReentrantMonitor;
+178 -8
View File
@@ -20,6 +20,7 @@
#include "CameraCommon.h"
#include "GonkCameraSource.h"
#include "GonkRecorder.h"
#include "mozilla/CondVar.h"
#define RE_LOGD(fmt, ...) DOM_CAMERA_LOGA("[%s:%d]" fmt,__FILE__,__LINE__, ## __VA_ARGS__)
#define RE_LOGV(fmt, ...) DOM_CAMERA_LOGI("[%s:%d]" fmt,__FILE__,__LINE__, ## __VA_ARGS__)
@@ -54,6 +55,132 @@
#define RES_720P (720 * 1280)
namespace android {
struct GonkRecorder::WrappedMediaSource : MediaSource {
public:
WrappedMediaSource(const sp<MediaSource> &encoder);
status_t start(MetaData *params = NULL) override;
status_t stop() override;
sp<MetaData> getFormat() override;
status_t read(MediaBuffer **buffer, const ReadOptions *options = NULL) override;
void block();
status_t resume();
protected:
virtual ~WrappedMediaSource() {};
private:
WrappedMediaSource(const WrappedMediaSource &);
WrappedMediaSource &operator=(const WrappedMediaSource &);
sp<MediaSource> mEncoder;
mozilla::Mutex mMutex;
mozilla::CondVar mCondVar;
bool mWait;
bool mResume;
status_t mResumeStatus;
};
GonkRecorder::WrappedMediaSource::WrappedMediaSource(const sp<MediaSource> &encoder)
: mEncoder(encoder)
, mMutex("GonkRecorder::WrappedMediaSource::mMutex")
, mCondVar(mMutex, "GonkRecorder::WrappedMediaSource::mCondVar")
, mWait(false)
, mResume(false)
, mResumeStatus(UNKNOWN_ERROR)
{
}
status_t
GonkRecorder::WrappedMediaSource::start(MetaData *params)
{
return mEncoder->start(params);
}
status_t
GonkRecorder::WrappedMediaSource::stop()
{
{
// Ensure the writer thread is not blocked first.
MutexAutoLock lock(mMutex);
mWait = false;
mCondVar.Notify();
}
return mEncoder->stop();
}
sp<MetaData>
GonkRecorder::WrappedMediaSource::getFormat()
{
return mEncoder->getFormat();
}
status_t
GonkRecorder::WrappedMediaSource::read(MediaBuffer **buffer, const ReadOptions *options)
{
MutexAutoLock lock(mMutex);
while (mWait) {
mCondVar.Wait();
}
status_t rv = UNKNOWN_ERROR;
MediaBuffer *buf = NULL;
do {
rv = mEncoder->read(&buf, options);
if (!mResume) {
break;
}
if (rv != OK || !buf) {
mResume = false;
mResumeStatus = UNKNOWN_ERROR;
mCondVar.Notify();
break;
}
int32_t isSync = 0;
buf->meta_data()->findInt32(kKeyIsSyncFrame, &isSync);
if (isSync) {
mResume = false;
mResumeStatus = OK;
mCondVar.Notify();
break;
}
buf->release();
buf = NULL;
} while(true);
*buffer = buf;
return rv;
}
void
GonkRecorder::WrappedMediaSource::block()
{
MutexAutoLock lock(mMutex);
mWait = true;
}
status_t
GonkRecorder::WrappedMediaSource::resume()
{
MutexAutoLock lock(mMutex);
if (!mWait) {
return UNKNOWN_ERROR;
}
mWait = false;
mResume = true;
mCondVar.Notify();
do {
mCondVar.Wait();
} while(mResume);
return mResumeStatus;
}
GonkRecorder::GonkRecorder()
: mWriter(NULL),
mOutputFd(-1),
@@ -1335,11 +1462,13 @@ status_t GonkRecorder::setupMPEG4Recording(
int32_t videoWidth, int32_t videoHeight,
int32_t videoBitRate,
int32_t *totalBitRate,
sp<MediaWriter> *mediaWriter) {
sp<MediaWriter> *mediaWriter,
sp<WrappedMediaSource> *mediaSource) {
mediaWriter->clear();
*totalBitRate = 0;
status_t err = OK;
sp<MediaWriter> writer = new MPEG4Writer(outputFd);
sp<WrappedMediaSource> writerSource;
if (mVideoSource < VIDEO_SOURCE_LIST_END) {
@@ -1355,7 +1484,10 @@ status_t GonkRecorder::setupMPEG4Recording(
return err;
}
writer->addSource(encoder);
sp<GonkCameraSource> cameraSource = reinterpret_cast<GonkCameraSource *>(mediaSource.get());
writerSource = new WrappedMediaSource(encoder);
writer->addSource(writerSource);
*totalBitRate += videoBitRate;
}
@@ -1391,6 +1523,7 @@ status_t GonkRecorder::setupMPEG4Recording(
writer->setListener(mListener);
*mediaWriter = writer;
*mediaSource = writerSource;
return OK;
}
@@ -1422,7 +1555,8 @@ status_t GonkRecorder::startMPEG4Recording() {
int32_t totalBitRate;
status_t err = setupMPEG4Recording(
mOutputFd, mVideoWidth, mVideoHeight,
mVideoBitRate, &totalBitRate, &mWriter);
mVideoBitRate, &totalBitRate, &mWriter,
&mWriterSource);
if (err != OK) {
return err;
}
@@ -1451,20 +1585,56 @@ status_t GonkRecorder::pause() {
if (mWriter == NULL) {
return UNKNOWN_ERROR;
}
mWriter->pause();
if (mStarted) {
if (!mStarted) {
return OK;
}
// Pause is not properly supported by all writers although
// for B2G we only currently use 3GPP/MPEG4
int err = INVALID_OPERATION;
switch (mOutputFormat) {
case OUTPUT_FORMAT_DEFAULT:
case OUTPUT_FORMAT_THREE_GPP:
case OUTPUT_FORMAT_MPEG_4:
err = mWriter->pause();
break;
default:
break;
}
if (err == OK) {
mStarted = false;
}
return err;
}
return OK;
status_t GonkRecorder::resume() {
RE_LOGV("resume");
if (mWriter == NULL) {
return UNKNOWN_ERROR;
}
if (mStarted) {
return OK;
}
/* While the writer is paused, it will continue to pull frames
from the encoder. This ensures continuity on the timestamps of
the encoded frames, etc. When we want to resume however, we must
ensure that the first read frame is a key frame. */
mWriterSource->block();
int err = mWriter->start(NULL);
if (err != OK) {
return err;
}
err = mWriterSource->resume();
if (err == OK) {
mStarted = true;
}
return err;
}
status_t GonkRecorder::stop() {
RE_LOGV("stop");
status_t err = OK;
mWriterSource.clear();
if (mWriter != NULL) {
err = mWriter->stop();
mWriter.clear();
+6 -1
View File
@@ -59,6 +59,7 @@ struct GonkRecorder {
virtual status_t prepare();
virtual status_t start();
virtual status_t pause();
virtual status_t resume();
virtual status_t stop();
virtual status_t close();
virtual status_t reset();
@@ -70,10 +71,13 @@ protected:
virtual ~GonkRecorder();
private:
struct WrappedMediaSource;
sp<IMediaRecorderClient> mListener;
String16 mClientName;
uid_t mClientUid;
sp<MediaWriter> mWriter;
sp<WrappedMediaSource> mWriterSource;
int mOutputFd;
sp<AudioSource> mAudioSourceNode;
@@ -123,7 +127,8 @@ private:
int32_t videoWidth, int32_t videoHeight,
int32_t videoBitRate,
int32_t *totalBitRate,
sp<MediaWriter> *mediaWriter);
sp<MediaWriter> *mediaWriter,
sp<WrappedMediaSource> *mediaSource);
void setupMPEG4MetaData(int64_t startTimeUs, int32_t totalBitRate,
sp<MetaData> *meta);
status_t startMPEG4Recording();
+6 -2
View File
@@ -31,9 +31,10 @@ namespace mozilla {
struct ProfileConfig {
const char* name;
int quality;
uint32_t priority;
};
#define DEF_GONK_RECORDER_PROFILE(e, n) { n, e },
#define DEF_GONK_RECORDER_PROFILE(e, n, p) { n, e, p },
static const ProfileConfig ProfileList[] = {
#include "GonkRecorderProfiles.def"
};
@@ -44,9 +45,10 @@ struct ProfileConfigDetect {
const char* name;
uint32_t width;
uint32_t height;
uint32_t priority;
};
#define DEF_GONK_RECORDER_PROFILE_DETECT(n, w, h) { n, w, h },
#define DEF_GONK_RECORDER_PROFILE_DETECT(n, w, h, p) { n, w, h, p },
static const ProfileConfigDetect ProfileListDetect[] = {
#include "GonkRecorderProfiles.def"
};
@@ -322,6 +324,7 @@ GonkRecorderProfile::GetProfileHashtable(uint32_t aCameraId)
DOM_CAMERA_LOGI("Profile %d '%s' supported by platform\n", p.quality, p.name);
profile->mName.AssignASCII(p.name);
profile->mPriority = p.priority;
profiles->Put(profile->GetName(), profile);
}
@@ -351,6 +354,7 @@ GonkRecorderProfile::GetProfileHashtable(uint32_t aCameraId)
if (s.width == p.width && s.height == p.height) {
DOM_CAMERA_LOGI("Profile %d '%s' supported by platform\n", q, p.name);
profile->mName.AssignASCII(p.name);
profile->mPriority = p.priority;
profiles->Put(profile->GetName(), profile);
break;
}
+22 -18
View File
@@ -19,20 +19,24 @@
*/
#ifndef DEF_GONK_RECORDER_PROFILE
#define DEF_GONK_RECORDER_PROFILE(e, n)
#define DEF_GONK_RECORDER_PROFILE(e, n, p)
#endif
#ifndef DEF_GONK_RECORDER_PROFILE_DETECT
#define DEF_GONK_RECORDER_PROFILE_DETECT(n, w, h)
#define DEF_GONK_RECORDER_PROFILE_DETECT(n, w, h, p)
#endif
DEF_GONK_RECORDER_PROFILE(CAMCORDER_QUALITY_LOW, "low")
DEF_GONK_RECORDER_PROFILE(CAMCORDER_QUALITY_HIGH, "high")
DEF_GONK_RECORDER_PROFILE(CAMCORDER_QUALITY_QCIF, "qcif")
DEF_GONK_RECORDER_PROFILE(CAMCORDER_QUALITY_CIF, "cif")
DEF_GONK_RECORDER_PROFILE(CAMCORDER_QUALITY_480P, "480p")
DEF_GONK_RECORDER_PROFILE(CAMCORDER_QUALITY_720P, "720p")
DEF_GONK_RECORDER_PROFILE(CAMCORDER_QUALITY_1080P, "1080p")
/* Enum value, name, and priority. The supported profile with the
* lowest priority and then largest area is selected as the default.
*/
DEF_GONK_RECORDER_PROFILE(CAMCORDER_QUALITY_LOW, "low", 900)
DEF_GONK_RECORDER_PROFILE(CAMCORDER_QUALITY_HIGH, "high", 900)
DEF_GONK_RECORDER_PROFILE(CAMCORDER_QUALITY_QCIF, "qcif", 300)
DEF_GONK_RECORDER_PROFILE(CAMCORDER_QUALITY_CIF, "cif", 300)
DEF_GONK_RECORDER_PROFILE(CAMCORDER_QUALITY_480P, "480p", 200)
DEF_GONK_RECORDER_PROFILE(CAMCORDER_QUALITY_720P, "720p", 100)
DEF_GONK_RECORDER_PROFILE(CAMCORDER_QUALITY_1080P, "1080p", 0)
/**
* The following profiles do not appear in all versions of the
@@ -40,15 +44,15 @@ DEF_GONK_RECORDER_PROFILE(CAMCORDER_QUALITY_1080P, "1080p")
* profiles may have more than one resolution, depending on the camera.
*/
DEF_GONK_RECORDER_PROFILE_DETECT("4kuhd", 3840, 2160)
DEF_GONK_RECORDER_PROFILE_DETECT("fwvga", 864, 480)
DEF_GONK_RECORDER_PROFILE_DETECT("fwvga", 854, 480)
DEF_GONK_RECORDER_PROFILE_DETECT("wvga", 800, 480)
DEF_GONK_RECORDER_PROFILE_DETECT("wvga", 768, 480)
DEF_GONK_RECORDER_PROFILE_DETECT("vga", 640, 480)
DEF_GONK_RECORDER_PROFILE_DETECT("hvga", 480, 320)
DEF_GONK_RECORDER_PROFILE_DETECT("wqvga", 400, 240)
DEF_GONK_RECORDER_PROFILE_DETECT("qvga", 320, 240)
DEF_GONK_RECORDER_PROFILE_DETECT("4kuhd", 3840, 2160, 800)
DEF_GONK_RECORDER_PROFILE_DETECT("fwvga", 864, 480, 200)
DEF_GONK_RECORDER_PROFILE_DETECT("fwvga", 854, 480, 200)
DEF_GONK_RECORDER_PROFILE_DETECT("wvga", 800, 480, 200)
DEF_GONK_RECORDER_PROFILE_DETECT("wvga", 768, 480, 200)
DEF_GONK_RECORDER_PROFILE_DETECT("vga", 640, 480, 200)
DEF_GONK_RECORDER_PROFILE_DETECT("hvga", 480, 320, 300)
DEF_GONK_RECORDER_PROFILE_DETECT("wqvga", 400, 240, 300)
DEF_GONK_RECORDER_PROFILE_DETECT("qvga", 320, 240, 300)
#undef DEF_GONK_RECORDER_PROFILE
#undef DEF_GONK_RECORDER_PROFILE_DETECT
+10
View File
@@ -116,6 +116,11 @@ public:
struct Size {
uint32_t width;
uint32_t height;
bool Equals(const Size& aSize) const
{
return width == aSize.width && height == aSize.height;
}
};
struct Region {
@@ -138,6 +143,7 @@ public:
uint64_t maxFileSizeBytes;
uint64_t maxVideoLengthMs;
bool autoEnableLowLightTorch;
bool createPoster;
};
struct Configuration {
@@ -218,6 +224,7 @@ public:
const nsString& GetName() const { return mName; }
const nsString& GetContainer() const { return mContainer; }
const nsString& GetMimeType() const { return mMimeType; }
uint32_t GetPriority() const { return mPriority; }
virtual const Video& GetVideo() const = 0;
virtual const Audio& GetAudio() const = 0;
@@ -228,6 +235,7 @@ public:
nsString mName;
nsString mContainer;
nsString mMimeType;
uint32_t mPriority;
private:
DISALLOW_EVIL_CONSTRUCTORS(RecorderProfile);
@@ -255,6 +263,8 @@ public:
virtual nsresult StartRecording(DeviceStorageFileDescriptor* aFileDescriptor,
const StartRecordingOptions* aOptions = nullptr) = 0;
virtual nsresult StopRecording() = 0;
virtual nsresult PauseRecording() = 0;
virtual nsresult ResumeRecording() = 0;
virtual nsresult StartFaceDetection() = 0;
virtual nsresult StopFaceDetection() = 0;
virtual nsresult ResumeContinuousFocus() = 0;
+1
View File
@@ -63,6 +63,7 @@ else:
LOCAL_INCLUDES += [
'../base',
'/media/libyuv/include',
]
include('/ipc/chromium/chromium-config.mozbuild')
+10
View File
@@ -80,6 +80,8 @@ function CameraTestSuite() {
this.rejectTakePicture = this._rejectTakePicture.bind(this);
this.rejectStartRecording = this._rejectStartRecording.bind(this);
this.rejectStopRecording = this._rejectStopRecording.bind(this);
this.rejectPauseRecording = this._rejectPauseRecording.bind(this);
this.rejectResumeRecording = this._rejectResumeRecording.bind(this);
this.rejectPreviewStarted = this._rejectPreviewStarted.bind(this);
var self = this;
@@ -409,6 +411,14 @@ CameraTestSuite.prototype = {
return this.logError('stop recording failed', e);
},
_rejectPauseRecording: function(e) {
return this.logError('pause recording failed', e);
},
_rejectResumeRecording: function(e) {
return this.logError('resume recording failed', e);
},
_rejectPreviewStarted: function(e) {
return this.logError('preview start failed', e);
},
+55 -2
View File
@@ -111,7 +111,7 @@ suite.test('picture-mode', function() {
suite.hw.params['preview-size'] = '1x1';
suite.hw.params['picture-size'] = '1x1';
suite.hw.params['preview-size-values'] = '640x480,320x240,1x1';
suite.hw.params['picture-size-values'] = '640x480,320x240,1x1';
suite.hw.params['picture-size-values'] = '1280x960,640x480,320x240,1x1';
suite.hw.params['video-size-values'] = '320x240';
var setConfig = {
@@ -123,6 +123,19 @@ suite.test('picture-mode', function() {
};
var expConfig = {
mode: 'picture',
recorderProfile: 'qvga',
previewSize: {
width: 640,
height: 480
},
pictureSize: {
width: 1280,
height: 960
}
};
var postConfig = {
mode: 'picture',
recorderProfile: 'qvga',
previewSize: {
@@ -135,7 +148,47 @@ suite.test('picture-mode', function() {
}
};
return setAndVerifyConfig(setConfig, expConfig);
function syncPreview() {
return new Promise(function(resolve, reject) {
function onEvent(e) {
if (e.newState === 'started') {
resolve();
}
}
suite.camera.addEventListener('previewstatechange', onEvent);
});
}
function reconfigure(p) {
// The preview restarting confirms the configuration actually happened
var sync = new Promise(function(resolve, reject) {
var i = 0;
var expState = ['started', 'stopped', 'started'];
function onEvent(e) {
ok(e.newState === expState[i], 'preview event state ' + expState[i] +
' === ' + e.newState);
++i;
if (i === expState.length) { return; }
suite.camera.removeEventListener('previewstatechange', onEvent);
resolve();
}
suite.camera.addEventListener('previewstatechange', onEvent);
});
var configure = suite.camera.setConfiguration(postConfig)
.then(resolveReconfigure);
return Promise.all([sync, configure]);
}
function resolveReconfigure(cfg) {
verifyConfig(cfg, postConfig);
}
return setAndVerifyConfig(setConfig, expConfig)
.then(syncPreview)
.then(reconfigure);
});
suite.test('picture-mode-larger-picture-size', function() {
@@ -527,6 +527,33 @@ suite.test('bug-1052851', function() {
.then(resolve, suite.rejectGetCamera);
});
suite.test('bug-1124338', function() {
function triggerAutoFocus(p) {
var sync = new Promise(function(resolve, reject) {
function onEvent(e) {
suite.camera.removeEventListener('focus', onEvent);
var thumbnailSize = suite.camera.getThumbnailSize();
ok(thumbnailSize.width == 640 && thumbnailSize.height == 480, 'thumbnail size reset with auto focus');
resolve();
}
suite.camera.addEventListener('focus', onEvent);
});
var initThumbnailSize = suite.camera.getThumbnailSize();
ok(initThumbnailSize.width == 320 && initThumbnailSize.height == 240, 'initial thumbnail size incorrect');
suite.hw.params['jpeg-thumbnail-width'] = '640';
suite.hw.params['jpeg-thumbnail-height'] = '480';
suite.hw.fireAutoFocusComplete(false);
return sync;
}
suite.hw.params['jpeg-thumbnail-size-values'] = '320x240,640x480';
suite.hw.params['jpeg-thumbnail-width'] = '320';
suite.hw.params['jpeg-thumbnail-height'] = '240';
return suite.getCamera()
.then(triggerAutoFocus)
});
suite.setup()
.then(suite.run);
@@ -34,8 +34,34 @@ suite.test('auto-focus-moving', function() {
return sync;
}
function waitAutoFocusComplete(p) {
var sync = new Promise(function(resolve, reject) {
function onEvent(e) {
suite.camera.removeEventListener('focus', onEvent);
ok(e.newState === 'focused', 'autofocus event state focused == ' + e.newState);
resolve();
}
suite.camera.addEventListener('focus', onEvent);
});
// Missing the fireAutoFocusComplete but it should timeout on its own
suite.hw.fireAutoFocusMoving(false);
return sync;
}
function runAutoFocusCycle(p) {
return triggerAutoFocusMoving(p)
.then(waitAutoFocusComplete);
}
/* If the driver doesn't supply an onAutoFocusComplete notification,
gecko will timeout and provide it. After three times, it will no
longer rely upon a timeout and fire it immediately. */
return suite.getCamera()
.then(triggerAutoFocusMoving);
.then(runAutoFocusCycle)
.then(runAutoFocusCycle)
.then(runAutoFocusCycle)
.then(runAutoFocusCycle);
});
suite.setup()
+47 -1
View File
@@ -45,6 +45,50 @@ suite.test('recording', function() {
return Promise.all([domPromise, eventPromise]);
}
function pauseRecording(p) {
var eventPromise = new Promise(function(resolve, reject) {
function onEvent(evt) {
ok(evt.newState === 'Paused', 'recorder state change event = ' + evt.newState);
suite.camera.removeEventListener('recorderstatechange', onEvent);
resolve();
}
suite.camera.addEventListener('recorderstatechange', onEvent);
});
var domPromise = new Promise(function(resolve, reject) {
try {
suite.camera.pauseRecording();
resolve();
} catch(e) {
reject(e);
}
});
return Promise.all([domPromise, eventPromise]);
}
function resumeRecording(p) {
var eventPromise = new Promise(function(resolve, reject) {
function onEvent(evt) {
ok(evt.newState === 'Resumed', 'recorder state change event = ' + evt.newState);
suite.camera.removeEventListener('recorderstatechange', onEvent);
resolve();
}
suite.camera.addEventListener('recorderstatechange', onEvent);
});
var domPromise = new Promise(function(resolve, reject) {
try {
suite.camera.resumeRecording();
resolve();
} catch(e) {
reject(e);
}
});
return Promise.all([domPromise, eventPromise]);
}
function stopRecording(p) {
var eventPromise = new Promise(function(resolve, reject) {
function onEvent(evt) {
@@ -70,7 +114,9 @@ suite.test('recording', function() {
return suite.getCamera(undefined, baseConfig)
.then(cleanup, suite.rejectGetCamera)
.then(startRecording)
.then(stopRecording, suite.rejectStartRecording)
.then(pauseRecording, suite.rejectStartRecording)
.then(resumeRecording, suite.rejectPauseRecording)
.then(stopRecording, suite.rejectResumeRecording)
.catch(suite.rejectStopRecording);
});
+2 -2
View File
@@ -1027,7 +1027,7 @@ CanvasRenderingContext2D::ParseColor(const nsAString& aString,
mCanvasElement, nullptr, presShell);
}
unused << nsRuleNode::ComputeColor(
Unused << nsRuleNode::ComputeColor(
value, presShell ? presShell->GetPresContext() : nullptr, parentContext,
*aColor);
}
@@ -4892,7 +4892,7 @@ CanvasRenderingContext2D::DrawWindow(nsGlobalWindow& window, double x,
}
nsCOMPtr<nsIPresShell> shell = presContext->PresShell();
unused << shell->RenderDocument(r, renderDocFlags, backgroundColor, thebes);
Unused << shell->RenderDocument(r, renderDocFlags, backgroundColor, thebes);
if (drawDT) {
RefPtr<SourceSurface> snapshot = drawDT->Snapshot();
RefPtr<DataSourceSurface> data = snapshot->GetDataSurface();
+1 -1
View File
@@ -1349,7 +1349,7 @@ DataStoreService::EnableDataStore(uint32_t aAppId, const nsAString& aName,
ContentParent::GetAll(children);
for (uint32_t i = 0; i < children.Length(); i++) {
if (children[i]->NeedsDataStoreInfos()) {
unused << children[i]->SendDataStoreNotify(aAppId, nsAutoString(aName),
Unused << children[i]->SendDataStoreNotify(aAppId, nsAutoString(aName),
nsAutoString(aManifestURL));
}
}
@@ -95,22 +95,6 @@ DeviceStorageRequestChild::
break;
}
case DeviceStorageResponseValue::TAvailableStorageResponse:
{
DS_LOG_INFO("available %u", mRequest->GetId());
AvailableStorageResponse r = aValue;
mRequest->Resolve(r.mountState());
break;
}
case DeviceStorageResponseValue::TStorageStatusResponse:
{
DS_LOG_INFO("status %u", mRequest->GetId());
StorageStatusResponse r = aValue;
mRequest->Resolve(r.storageStatus());
break;
}
case DeviceStorageResponseValue::TFormatStorageResponse:
{
DS_LOG_INFO("format %u", mRequest->GetId());
@@ -24,7 +24,7 @@ DeviceStorageRequestParent::DeviceStorageRequestParent(
const DeviceStorageParams& aParams)
: mParams(aParams)
, mMutex("DeviceStorageRequestParent::mMutex")
, mActorDestoryed(false)
, mActorDestroyed(false)
{
MOZ_COUNT_CTOR(DeviceStorageRequestParent);
@@ -164,32 +164,6 @@ DeviceStorageRequestParent::Dispatch()
break;
}
case DeviceStorageParams::TDeviceStorageAvailableParams:
{
DeviceStorageAvailableParams p = mParams;
RefPtr<DeviceStorageFile> dsf =
new DeviceStorageFile(p.type(), p.storageName());
RefPtr<PostAvailableResultEvent> r
= new PostAvailableResultEvent(this, dsf);
DebugOnly<nsresult> rv = NS_DispatchToMainThread(r);
MOZ_ASSERT(NS_SUCCEEDED(rv));
break;
}
case DeviceStorageParams::TDeviceStorageStatusParams:
{
DeviceStorageStatusParams p = mParams;
RefPtr<DeviceStorageFile> dsf =
new DeviceStorageFile(p.type(), p.storageName());
RefPtr<PostStatusResultEvent> r
= new PostStatusResultEvent(this, dsf);
DebugOnly<nsresult> rv = NS_DispatchToMainThread(r);
MOZ_ASSERT(NS_SUCCEEDED(rv));
break;
}
case DeviceStorageParams::TDeviceStorageFormatParams:
{
DeviceStorageFormatParams p = mParams;
@@ -418,7 +392,7 @@ void
DeviceStorageRequestParent::ActorDestroy(ActorDestroyReason)
{
MutexAutoLock lock(mMutex);
mActorDestoryed = true;
mActorDestroyed = true;
int32_t count = mRunnables.Length();
for (int32_t index = 0; index < count; index++) {
mRunnables[index]->Cancel();
@@ -441,7 +415,7 @@ DeviceStorageRequestParent::PostFreeSpaceResultEvent::CancelableRun() {
MOZ_ASSERT(NS_IsMainThread());
FreeSpaceStorageResponse response(mFreeSpace);
unused << mParent->Send__delete__(mParent, response);
Unused << mParent->Send__delete__(mParent, response);
return NS_OK;
}
@@ -463,7 +437,7 @@ DeviceStorageRequestParent::PostUsedSpaceResultEvent::CancelableRun() {
MOZ_ASSERT(NS_IsMainThread());
UsedSpaceStorageResponse response(mUsedSpace);
unused << mParent->Send__delete__(mParent, response);
Unused << mParent->Send__delete__(mParent, response);
return NS_OK;
}
@@ -481,7 +455,7 @@ DeviceStorageRequestParent::PostErrorEvent::CancelableRun() {
MOZ_ASSERT(NS_IsMainThread());
ErrorResponse response(mError);
unused << mParent->Send__delete__(mParent, response);
Unused << mParent->Send__delete__(mParent, response);
return NS_OK;
}
@@ -498,7 +472,7 @@ DeviceStorageRequestParent::PostSuccessEvent::CancelableRun() {
MOZ_ASSERT(NS_IsMainThread());
SuccessResponse response;
unused << mParent->Send__delete__(mParent, response);
Unused << mParent->Send__delete__(mParent, response);
return NS_OK;
}
@@ -535,14 +509,14 @@ DeviceStorageRequestParent::PostBlobSuccessEvent::CancelableRun() {
BlobParent* actor = cp->GetOrCreateActorForBlobImpl(blob);
if (!actor) {
ErrorResponse response(NS_LITERAL_STRING(POST_ERROR_EVENT_UNKNOWN));
unused << mParent->Send__delete__(mParent, response);
Unused << mParent->Send__delete__(mParent, response);
return NS_OK;
}
BlobResponse response;
response.blobParent() = actor;
unused << mParent->Send__delete__(mParent, response);
Unused << mParent->Send__delete__(mParent, response);
return NS_OK;
}
@@ -566,7 +540,7 @@ DeviceStorageRequestParent::PostEnumerationSuccessEvent::CancelableRun() {
MOZ_ASSERT(NS_IsMainThread());
EnumerationResponse response(mStorageType, mRelPath, mPaths);
unused << mParent->Send__delete__(mParent, response);
Unused << mParent->Send__delete__(mParent, response);
return NS_OK;
}
@@ -893,7 +867,7 @@ DeviceStorageRequestParent::PostPathResultEvent::CancelableRun()
MOZ_ASSERT(NS_IsMainThread());
SuccessResponse response;
unused << mParent->Send__delete__(mParent, response);
Unused << mParent->Send__delete__(mParent, response);
return NS_OK;
}
@@ -916,63 +890,7 @@ DeviceStorageRequestParent::PostFileDescriptorResultEvent::CancelableRun()
MOZ_ASSERT(NS_IsMainThread());
FileDescriptorResponse response(mFileDescriptor);
unused << mParent->Send__delete__(mParent, response);
return NS_OK;
}
DeviceStorageRequestParent::PostAvailableResultEvent::
PostAvailableResultEvent(DeviceStorageRequestParent* aParent,
DeviceStorageFile* aFile)
: CancelableRunnable(aParent)
, mFile(aFile)
{
}
DeviceStorageRequestParent::PostAvailableResultEvent::
~PostAvailableResultEvent()
{
}
nsresult
DeviceStorageRequestParent::PostAvailableResultEvent::CancelableRun()
{
MOZ_ASSERT(NS_IsMainThread());
nsString state = NS_LITERAL_STRING("unavailable");
if (mFile) {
mFile->GetStatus(state);
}
AvailableStorageResponse response(state);
unused << mParent->Send__delete__(mParent, response);
return NS_OK;
}
DeviceStorageRequestParent::PostStatusResultEvent::
PostStatusResultEvent(DeviceStorageRequestParent* aParent,
DeviceStorageFile* aFile)
: CancelableRunnable(aParent)
, mFile(aFile)
{
}
DeviceStorageRequestParent::PostStatusResultEvent::
~PostStatusResultEvent()
{
}
nsresult
DeviceStorageRequestParent::PostStatusResultEvent::CancelableRun()
{
MOZ_ASSERT(NS_IsMainThread());
nsString state = NS_LITERAL_STRING("undefined");
if (mFile) {
mFile->GetStorageStatus(state);
}
StorageStatusResponse response(state);
unused << mParent->Send__delete__(mParent, response);
Unused << mParent->Send__delete__(mParent, response);
return NS_OK;
}
@@ -1000,7 +918,7 @@ DeviceStorageRequestParent::PostFormatResultEvent::CancelableRun()
}
FormatStorageResponse response(state);
unused << mParent->Send__delete__(mParent, response);
Unused << mParent->Send__delete__(mParent, response);
return NS_OK;
}
@@ -1028,7 +946,7 @@ DeviceStorageRequestParent::PostMountResultEvent::CancelableRun()
}
MountStorageResponse response(state);
unused << mParent->Send__delete__(mParent, response);
Unused << mParent->Send__delete__(mParent, response);
return NS_OK;
}
@@ -1056,7 +974,7 @@ DeviceStorageRequestParent::PostUnmountResultEvent::CancelableRun()
}
UnmountStorageResponse response(state);
unused << mParent->Send__delete__(mParent, response);
Unused << mParent->Send__delete__(mParent, response);
return NS_OK;
}
+2 -22
View File
@@ -242,26 +242,6 @@ private:
uint64_t mUsedSpace;
};
class PostAvailableResultEvent : public CancelableRunnable
{
public:
PostAvailableResultEvent(DeviceStorageRequestParent* aParent, DeviceStorageFile* aFile);
virtual ~PostAvailableResultEvent();
virtual nsresult CancelableRun();
private:
RefPtr<DeviceStorageFile> mFile;
};
class PostStatusResultEvent : public CancelableRunnable
{
public:
PostStatusResultEvent(DeviceStorageRequestParent* aParent, DeviceStorageFile* aFile);
virtual ~PostStatusResultEvent();
virtual nsresult CancelableRun();
private:
RefPtr<DeviceStorageFile> mFile;
};
class PostFormatResultEvent : public CancelableRunnable
{
public:
@@ -295,7 +275,7 @@ private:
protected:
bool AddRunnable(CancelableRunnable* aRunnable) {
MutexAutoLock lock(mMutex);
if (mActorDestoryed)
if (mActorDestroyed)
return false;
mRunnables.AppendElement(aRunnable);
@@ -308,7 +288,7 @@ protected:
}
Mutex mMutex;
bool mActorDestoryed;
bool mActorDestroyed;
nsTArray<RefPtr<CancelableRunnable> > mRunnables;
};
@@ -53,16 +53,6 @@ struct UsedSpaceStorageResponse
uint64_t usedBytes;
};
struct AvailableStorageResponse
{
nsString mountState;
};
struct StorageStatusResponse
{
nsString storageStatus;
};
struct FormatStorageResponse
{
nsString mountState;
@@ -87,8 +77,6 @@ union DeviceStorageResponseValue
EnumerationResponse;
FreeSpaceStorageResponse;
UsedSpaceStorageResponse;
AvailableStorageResponse;
StorageStatusResponse;
FormatStorageResponse;
MountStorageResponse;
UnmountStorageResponse;
+2 -18
View File
@@ -2158,6 +2158,7 @@ public:
DeviceStorageAvailableRequest()
{
mAccess = DEVICE_STORAGE_ACCESS_READ;
mSendToParent = false;
DS_LOG_INFO("");
}
@@ -2169,15 +2170,6 @@ public:
}
return Resolve(state);
}
protected:
nsresult CreateSendParams(DeviceStorageParams& aParams) override
{
DeviceStorageAvailableParams params(mFile->mStorageType,
mFile->mStorageName);
aParams = params;
return NS_OK;
}
};
class DeviceStorageStatusRequest final
@@ -2187,6 +2179,7 @@ public:
DeviceStorageStatusRequest()
{
mAccess = DEVICE_STORAGE_ACCESS_READ;
mSendToParent = false;
DS_LOG_INFO("");
}
@@ -2198,15 +2191,6 @@ public:
}
return Resolve(state);
}
protected:
nsresult CreateSendParams(DeviceStorageParams& aParams) override
{
DeviceStorageStatusParams params(mFile->mStorageType,
mFile->mStorageName);
aParams = params;
return NS_OK;
}
};
class DeviceStorageWatchRequest final
+1 -1
View File
@@ -255,7 +255,7 @@ void
EventTargetChainItem::PreHandleEvent(EventChainPreVisitor& aVisitor)
{
aVisitor.Reset();
unused << mTarget->PreHandleEvent(aVisitor);
Unused << mTarget->PreHandleEvent(aVisitor);
SetForceContentDispatch(aVisitor.mForceContentDispatch);
SetWantsWillHandleEvent(aVisitor.mWantsWillHandleEvent);
SetMayHaveListenerManager(aVisitor.mMayHaveListenerManager);
+2 -2
View File
@@ -417,7 +417,7 @@ IMEStateManager::OnChangeFocusInternal(nsPresContext* aPresContext,
("ISM: IMEStateManager::OnChangeFocusInternal(), notifying previous "
"focused child process of parent process or another child process "
"getting focus"));
unused << sActiveTabParent->SendStopIMEStateManagement();
Unused << sActiveTabParent->SendStopIMEStateManagement();
}
nsCOMPtr<nsIWidget> widget =
@@ -445,7 +445,7 @@ IMEStateManager::OnChangeFocusInternal(nsPresContext* aPresContext,
// to be restored by the child process asynchronously. Therefore,
// some key events which are fired immediately after closing menu
// may not be handled by IME.
unused << newTabParent->
Unused << newTabParent->
SendMenuKeyboardListenerInstalled(sInstalledMenuKeyboardListener);
setIMEState = sInstalledMenuKeyboardListener;
} else if (focusActuallyChanging) {
+3 -3
View File
@@ -140,7 +140,7 @@ TextComposition::OnCompositionEventDiscarded(
if (mTabParent) {
// The composition event should be discarded in the child process too.
unused << mTabParent->SendCompositionEvent(*aCompositionEvent);
Unused << mTabParent->SendCompositionEvent(*aCompositionEvent);
}
// XXX If composition events are discarded, should we dispatch them with
@@ -218,7 +218,7 @@ TextComposition::DispatchCompositionEvent(
// If the content is a container of TabParent, composition should be in the
// remote process.
if (mTabParent) {
unused << mTabParent->SendCompositionEvent(*aCompositionEvent);
Unused << mTabParent->SendCompositionEvent(*aCompositionEvent);
aCompositionEvent->mFlags.mPropagationStopped = true;
if (aCompositionEvent->CausesDOMTextEvent()) {
mLastData = aCompositionEvent->mData;
@@ -386,7 +386,7 @@ TextComposition::HandleSelectionEvent(nsPresContext* aPresContext,
// If the content is a container of TabParent, composition should be in the
// remote process.
if (aTabParent) {
unused << aTabParent->SendSelectionEvent(*aSelectionEvent);
Unused << aTabParent->SendSelectionEvent(*aSelectionEvent);
aSelectionEvent->mFlags.mPropagationStopped = true;
return;
}
+2 -2
View File
@@ -781,8 +781,8 @@ FetchDriver::AsyncOnChannelRedirect(nsIChannel* aOldChannel,
// be ignored.
MOZ_ASSERT(!mFoundOpaqueRedirect);
mFoundOpaqueRedirect = true;
unused << OnStartRequest(aOldChannel, nullptr);
unused << OnStopRequest(aOldChannel, nullptr, NS_OK);
Unused << OnStartRequest(aOldChannel, nullptr);
Unused << OnStopRequest(aOldChannel, nullptr, NS_OK);
aOldChannel->Cancel(NS_BINDING_FAILED);
+2 -2
View File
@@ -90,7 +90,7 @@ GetRequestURLFromDocument(nsIDocument* aDocument, const nsAString& aInput,
// This fails with URIs with weird protocols, even when they are valid,
// so we ignore the failure
nsAutoCString credentials;
unused << resolvedURI->GetUserPass(credentials);
Unused << resolvedURI->GetUserPass(credentials);
if (!credentials.IsEmpty()) {
aRv.ThrowTypeError<MSG_URL_HAS_CREDENTIALS>(&aInput);
return;
@@ -129,7 +129,7 @@ GetRequestURLFromChrome(const nsAString& aInput, nsAString& aRequestURL,
// This fails with URIs with weird protocols, even when they are valid,
// so we ignore the failure
nsAutoCString credentials;
unused << uri->GetUserPass(credentials);
Unused << uri->GetUserPass(credentials);
if (!credentials.IsEmpty()) {
aRv.ThrowTypeError<MSG_URL_HAS_CREDENTIALS>(&aInput);
return;
+3 -3
View File
@@ -1003,7 +1003,7 @@ FileHandleThreadPool::Cleanup()
MOZ_ASSERT(completeCallback);
MOZ_ASSERT(completeCallback->mCallback);
unused << completeCallback->mCallback->Run();
Unused << completeCallback->mCallback->Run();
}
mCompleteCallbacks.Clear();
@@ -1651,7 +1651,7 @@ FileHandle::SendCompleteNotification(bool aAborted)
AssertIsOnBackgroundThread();
if (!IsActorDestroyed()) {
unused << SendComplete(aAborted);
Unused << SendComplete(aAborted);
}
}
@@ -2280,7 +2280,7 @@ ProgressRunnable::Run()
{
AssertIsOnBackgroundThread();
unused << mCopyFileHandleOp->SendProgress(mProgress, mProgressMax);
Unused << mCopyFileHandleOp->SendProgress(mProgress, mProgressMax);
mCopyFileHandleOp = nullptr;
+1 -1
View File
@@ -111,7 +111,7 @@ FileSystemTaskBase::HandleResult()
return;
}
if (mRequestParent && mRequestParent->IsRunning()) {
unused << mRequestParent->Send__delete__(mRequestParent,
Unused << mRequestParent->Send__delete__(mRequestParent,
GetRequestResult());
} else {
HandlerCallback();
+8 -8
View File
@@ -98,41 +98,41 @@ FMRadioParent::Notify(const FMRadioEventType& aType)
{
switch (aType) {
case FrequencyChanged:
unused << SendNotifyFrequencyChanged(
Unused << SendNotifyFrequencyChanged(
IFMRadioService::Singleton()->GetFrequency());
break;
case EnabledChanged:
unused << SendNotifyEnabledChanged(
Unused << SendNotifyEnabledChanged(
IFMRadioService::Singleton()->IsEnabled(),
IFMRadioService::Singleton()->GetFrequency());
break;
case RDSEnabledChanged:
unused << SendNotifyRDSEnabledChanged(
Unused << SendNotifyRDSEnabledChanged(
IFMRadioService::Singleton()->IsRDSEnabled());
break;
case PIChanged: {
Nullable<unsigned short> pi =
IFMRadioService::Singleton()->GetPi();
unused << SendNotifyPIChanged(!pi.IsNull(),
Unused << SendNotifyPIChanged(!pi.IsNull(),
pi.IsNull() ? 0 : pi.Value());
break;
}
case PTYChanged: {
Nullable<uint8_t> pty = IFMRadioService::Singleton()->GetPty();
unused << SendNotifyPTYChanged(!pty.IsNull(),
Unused << SendNotifyPTYChanged(!pty.IsNull(),
pty.IsNull() ? 0 : pty.Value());
break;
}
case PSChanged: {
nsAutoString psname;
IFMRadioService::Singleton()->GetPs(psname);
unused << SendNotifyPSChanged(psname);
Unused << SendNotifyPSChanged(psname);
break;
}
case RadiotextChanged: {
nsAutoString radiotext;
IFMRadioService::Singleton()->GetRt(radiotext);
unused << SendNotifyRadiotextChanged(radiotext);
Unused << SendNotifyRadiotextChanged(radiotext);
break;
}
case NewRDSGroup: {
@@ -140,7 +140,7 @@ FMRadioParent::Notify(const FMRadioEventType& aType)
DebugOnly<bool> rdsgroupset =
IFMRadioService::Singleton()->GetRdsgroup(group);
MOZ_ASSERT(rdsgroupset);
unused << SendNotifyNewRDSGroup(group);
Unused << SendNotifyNewRDSGroup(group);
break;
}
default:
+1 -1
View File
@@ -34,7 +34,7 @@ FMRadioRequestParent::Run()
MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!");
if (!mActorDestroyed) {
unused << Send__delete__(this, mResponseType);
Unused << Send__delete__(this, mResponseType);
}
return NS_OK;
+1 -1
View File
@@ -29,7 +29,7 @@ NotifyGamepadChange(const T& aInfo)
nsTArray<ContentParent*> t;
ContentParent::GetAll(t);
for(uint32_t i = 0; i < t.Length(); ++i) {
unused << t[i]->SendGamepadUpdate(e);
Unused << t[i]->SendGamepadUpdate(e);
}
// If we have a GamepadService in the main process, send directly to it.
if (GamepadService::IsServiceRunning()) {
+2 -2
View File
@@ -62,7 +62,7 @@ class nsIPrincipal;
// the geolocation enabled setting
#define GEO_SETTINGS_ENABLED "geolocation.enabled"
using mozilla::unused; // <snicker>
using mozilla::Unused; // <snicker>
using namespace mozilla;
using namespace mozilla::dom;
@@ -1271,7 +1271,7 @@ Geolocation::RemoveRequest(nsGeolocationRequest* aRequest)
(mPendingCallbacks.RemoveElement(aRequest) !=
mWatchingCallbacks.RemoveElement(aRequest));
unused << requestWasKnown;
Unused << requestWasKnown;
}
NS_IMETHODIMP
+1 -1
View File
@@ -37,7 +37,7 @@
#define GEO_ALA_TYPE_VALUE_FIXED "user-defined"
#define GEO_ALA_TYPE_VALUE_NONE "no-location"
using mozilla::unused;
using mozilla::Unused;
using namespace mozilla;
using namespace mozilla::dom;
+3 -10
View File
@@ -386,15 +386,6 @@ HTMLFormControlsCollection::NamedGetter(const nsAString& aName,
MOZ_ASSERT_UNREACHABLE("Should only have Elements and NodeLists here.");
}
static PLDHashOperator
CollectNames(const nsAString& aName,
nsISupports* /* unused */,
void* aClosure)
{
static_cast<nsTArray<nsString>*>(aClosure)->AppendElement(aName);
return PL_DHASH_NEXT;
}
void
HTMLFormControlsCollection::GetSupportedNames(unsigned aFlags,
nsTArray<nsString>& aNames)
@@ -407,7 +398,9 @@ HTMLFormControlsCollection::GetSupportedNames(unsigned aFlags,
// Just enumerate mNameLookupTable. This won't guarantee order, but
// that's OK, because the HTML5 spec doesn't define an order for
// this enumeration.
mNameLookupTable.EnumerateRead(CollectNames, &aNames);
for (auto iter = mNameLookupTable.Iter(); !iter.Done(); iter.Next()) {
aNames.AppendElement(iter.Key());
}
}
/* virtual */ JSObject*
+1 -12
View File
@@ -134,17 +134,6 @@ HTMLFormElement::~HTMLFormElement()
// nsISupports
static PLDHashOperator
ElementTraverser(const nsAString& key, HTMLInputElement* element,
void* userArg)
{
nsCycleCollectionTraversalCallback *cb =
static_cast<nsCycleCollectionTraversalCallback*>(userArg);
cb->NoteXPCOMChild(ToSupports(element));
return PL_DHASH_NEXT;
}
NS_IMPL_CYCLE_COLLECTION_CLASS(HTMLFormElement)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(HTMLFormElement,
@@ -152,7 +141,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(HTMLFormElement,
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mControls)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mImageNameLookupTable)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPastNameLookupTable)
tmp->mSelectedRadioButtons.EnumerateRead(ElementTraverser, &cb);
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSelectedRadioButtons)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(HTMLFormElement,
+24 -48
View File
@@ -736,9 +736,11 @@ void HTMLMediaElement::AbortExistingLoads()
if (mNetworkState != nsIDOMHTMLMediaElement::NETWORK_EMPTY) {
NS_ASSERTION(!mDecoder && !mSrcStream, "How did someone setup a new stream/decoder already?");
// ChangeNetworkState() will call UpdateAudioChannelPlayingState()
// indirectly which depends on mPaused. So we need to update mPaused first.
mPaused = true;
ChangeNetworkState(nsIDOMHTMLMediaElement::NETWORK_EMPTY);
ChangeReadyState(nsIDOMHTMLMediaElement::HAVE_NOTHING);
mPaused = true;
if (fireTimeUpdate) {
// Since we destroyed the decoder above, the current playback position
@@ -1498,7 +1500,7 @@ HTMLMediaElement::Seek(double aTime,
}
// Clamp the seek target to inside the seekable ranges.
RefPtr<dom::TimeRanges> seekable = new dom::TimeRanges();
RefPtr<dom::TimeRanges> seekable = new dom::TimeRanges(ToSupports(OwnerDoc()));
media::TimeIntervals seekableIntervals = mDecoder->GetSeekable();
if (seekableIntervals.IsInvalid()) {
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
@@ -1567,6 +1569,11 @@ HTMLMediaElement::Seek(double aTime,
// MediaDecoderReaders.
mPlayingBeforeSeek = IsPotentiallyPlaying();
// Set the Variable if the Seekstarted while active playing
if (mPlayingThroughTheAudioChannel) {
mPlayingThroughTheAudioChannelBeforeSeek = true;
}
// The media backend is responsible for dispatching the timeupdate
// event if it changes the playback position as a result of the seek.
LOG(LogLevel::Debug, ("%p SetCurrentTime(%f) starting seek", this, aTime));
@@ -1621,9 +1628,8 @@ NS_IMETHODIMP HTMLMediaElement::GetDuration(double* aDuration)
already_AddRefed<TimeRanges>
HTMLMediaElement::Seekable() const
{
RefPtr<TimeRanges> ranges = new TimeRanges();
if (mMediaSource ||
(mDecoder && mReadyState > nsIDOMHTMLMediaElement::HAVE_NOTHING)) {
RefPtr<TimeRanges> ranges = new TimeRanges(ToSupports(OwnerDoc()));
if (mDecoder && mReadyState > nsIDOMHTMLMediaElement::HAVE_NOTHING) {
mDecoder->GetSeekable().ToTimeRanges(ranges);
}
return ranges.forget();
@@ -1646,7 +1652,7 @@ NS_IMETHODIMP HTMLMediaElement::GetPaused(bool* aPaused)
already_AddRefed<TimeRanges>
HTMLMediaElement::Played()
{
RefPtr<TimeRanges> ranges = new TimeRanges();
RefPtr<TimeRanges> ranges = new TimeRanges(ToSupports(OwnerDoc()));
uint32_t timeRangeCount = 0;
if (mPlayed) {
@@ -1740,36 +1746,6 @@ NS_IMETHODIMP HTMLMediaElement::SetVolume(double aVolume)
return rv.StealNSResult();
}
// Helper struct with arguments for our hash iterator.
typedef struct MOZ_STACK_CLASS {
JSContext* cx;
JS::Handle<JSObject*> tags;
bool error;
} MetadataIterCx;
PLDHashOperator
HTMLMediaElement::BuildObjectFromTags(nsCStringHashKey::KeyType aKey,
nsCString aValue,
void* aUserArg)
{
MetadataIterCx* args = static_cast<MetadataIterCx*>(aUserArg);
nsString wideValue = NS_ConvertUTF8toUTF16(aValue);
JS::Rooted<JSString*> string(args->cx, JS_NewUCStringCopyZ(args->cx, wideValue.Data()));
if (!string) {
NS_WARNING("Failed to perform string copy");
args->error = true;
return PL_DHASH_STOP;
}
if (!JS_DefineProperty(args->cx, args->tags, aKey.Data(), string, JSPROP_ENUMERATE)) {
NS_WARNING("Failed to set metadata property");
args->error = true;
return PL_DHASH_STOP;
}
return PL_DHASH_NEXT;
}
void
HTMLMediaElement::MozGetMetadata(JSContext* cx,
JS::MutableHandle<JSObject*> aRetval,
@@ -1786,12 +1762,16 @@ HTMLMediaElement::MozGetMetadata(JSContext* cx,
return;
}
if (mTags) {
MetadataIterCx iter = {cx, tags, false};
mTags->EnumerateRead(BuildObjectFromTags, static_cast<void*>(&iter));
if (iter.error) {
NS_WARNING("couldn't create metadata object!");
aRv.Throw(NS_ERROR_FAILURE);
return;
for (auto iter = mTags->ConstIter(); !iter.Done(); iter.Next()) {
nsString wideValue = NS_ConvertUTF8toUTF16(iter.UserData());
JS::Rooted<JSString*> string(cx,
JS_NewUCStringCopyZ(cx, wideValue.Data()));
if (!string || !JS_DefineProperty(cx, tags, iter.Key().Data(), string,
JSPROP_ENUMERATE)) {
NS_WARNING("couldn't create metadata object!");
aRv.Throw(NS_ERROR_FAILURE);
return;
}
}
}
@@ -2055,7 +2035,7 @@ HTMLMediaElement::HTMLMediaElement(already_AddRefed<mozilla::dom::NodeInfo>& aNo
mDefaultPlaybackRate(1.0),
mPlaybackRate(1.0),
mPreservesPitch(true),
mPlayed(new TimeRanges),
mPlayed(new TimeRanges(ToSupports(OwnerDoc()))),
mCurrentPlayRangeStart(-1.0),
mBegun(false),
mLoadedDataFired(false),
@@ -3546,10 +3526,6 @@ void HTMLMediaElement::PlaybackEnded()
void HTMLMediaElement::SeekStarted()
{
DispatchAsyncEvent(NS_LITERAL_STRING("seeking"));
// Set the Variable if the Seekstarted while active playing
if(mPlayingThroughTheAudioChannel) {
mPlayingThroughTheAudioChannelBeforeSeek = true;
}
}
void HTMLMediaElement::SeekCompleted()
@@ -4458,7 +4434,7 @@ HTMLMediaElement::CopyInnerTo(Element* aDest)
already_AddRefed<TimeRanges>
HTMLMediaElement::Buffered() const
{
RefPtr<TimeRanges> ranges = new TimeRanges();
RefPtr<TimeRanges> ranges = new TimeRanges(ToSupports(OwnerDoc()));
if (mReadyState > nsIDOMHTMLMediaElement::HAVE_NOTHING) {
if (mDecoder) {
media::TimeIntervals buffered = mDecoder->GetBuffered();
+6 -17
View File
@@ -73,14 +73,6 @@ NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(HTMLPropertiesCollection)
NS_IMPL_CYCLE_COLLECTING_RELEASE(HTMLPropertiesCollection)
static PLDHashOperator
SetPropertyListDocument(const nsAString& aKey, PropertyNodeList* aEntry, void* aData)
{
aEntry->SetDocument(static_cast<nsIDocument*>(aData));
return PL_DHASH_NEXT;
}
void
HTMLPropertiesCollection::SetDocument(nsIDocument* aDocument) {
if (mDoc) {
@@ -90,7 +82,9 @@ HTMLPropertiesCollection::SetDocument(nsIDocument* aDocument) {
if (mDoc) {
mDoc->AddMutationObserver(this);
}
mNamedItemEntries.EnumerateRead(SetPropertyListDocument, aDocument);
for (auto iter = mNamedItemEntries.Iter(); !iter.Done(); iter.Next()) {
iter.UserData()->SetDocument(aDocument);
}
mIsDirty = true;
}
@@ -192,13 +186,6 @@ HTMLPropertiesCollection::ContentRemoved(nsIDocument *aDocument,
mIsDirty = true;
}
static PLDHashOperator
MarkDirty(const nsAString& aKey, PropertyNodeList* aEntry, void* aData)
{
aEntry->SetDirty();
return PL_DHASH_NEXT;
}
void
HTMLPropertiesCollection::EnsureFresh()
{
@@ -210,7 +197,9 @@ HTMLPropertiesCollection::EnsureFresh()
mProperties.Clear();
mNames->Clear();
// We don't clear NamedItemEntries because the PropertyNodeLists must be live.
mNamedItemEntries.EnumerateRead(MarkDirty, nullptr);
for (auto iter = mNamedItemEntries.Iter(); !iter.Done(); iter.Next()) {
iter.UserData()->SetDirty();
}
if (!mRoot->HasAttr(kNameSpaceID_None, nsGkAtoms::itemscope)) {
return;
}
+23 -6
View File
@@ -12,16 +12,27 @@
namespace mozilla {
namespace dom {
NS_IMPL_ISUPPORTS(TimeRanges, nsIDOMTimeRanges)
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(TimeRanges, mParent)
NS_IMPL_CYCLE_COLLECTING_ADDREF(TimeRanges)
NS_IMPL_CYCLE_COLLECTING_RELEASE(TimeRanges)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TimeRanges)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsIDOMTimeRanges)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
TimeRanges::TimeRanges()
: mParent(nullptr)
{
}
TimeRanges::TimeRanges(nsISupports* aParent)
: mParent(aParent)
{
MOZ_COUNT_CTOR(TimeRanges);
}
TimeRanges::~TimeRanges()
{
MOZ_COUNT_DTOR(TimeRanges);
}
NS_IMETHODIMP
@@ -166,10 +177,16 @@ TimeRanges::Find(double aTime, double aTolerance /* = 0 */)
return NoIndex;
}
bool
TimeRanges::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
JSObject*
TimeRanges::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
{
return TimeRangesBinding::Wrap(aCx, this, aGivenProto, aReflector);
return TimeRangesBinding::Wrap(aCx, this, aGivenProto);
}
nsISupports*
TimeRanges::GetParentObject() const
{
return mParent;
}
void
+10 -3
View File
@@ -25,13 +25,16 @@ namespace dom {
// Implements media TimeRanges:
// http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#timeranges
class TimeRanges final : public nsIDOMTimeRanges
class TimeRanges final : public nsIDOMTimeRanges,
public nsWrapperCache
{
public:
NS_DECL_ISUPPORTS
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(TimeRanges)
NS_DECL_NSIDOMTIMERANGES
TimeRanges();
explicit TimeRanges(nsISupports* aParent);
void Add(double aStart, double aEnd);
@@ -50,7 +53,9 @@ public:
// Mutate this TimeRange to be the intersection of this and aOtherRanges.
void Intersection(const TimeRanges* aOtherRanges);
bool WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
nsISupports* GetParentObject() const;
uint32_t Length() const
{
@@ -90,6 +95,8 @@ private:
nsAutoTArray<TimeRange,4> mRanges;
nsCOMPtr<nsISupports> mParent;
public:
typedef nsTArray<TimeRange>::index_type index_type;
static const index_type NoIndex = index_type(-1);
+26 -26
View File
@@ -5298,7 +5298,7 @@ public:
void
CloseDatabaseWhenIdle(const nsACString& aDatabaseId)
{
unused << CloseDatabaseWhenIdleInternal(aDatabaseId);
Unused << CloseDatabaseWhenIdleInternal(aDatabaseId);
}
void
@@ -9571,7 +9571,7 @@ RecvPIndexedDBPermissionRequestConstructor(
}
if (permission != PermissionRequestBase::kPermissionPrompt) {
unused <<
Unused <<
PIndexedDBPermissionRequestParent::Send__delete__(actor, permission);
}
@@ -9829,7 +9829,7 @@ DatabaseConnection::RollbackWriteTransaction()
// This may fail if SQLite already rolled back the transaction so ignore any
// errors.
unused << stmt->Execute();
Unused << stmt->Execute();
mInWriteTransaction = false;
}
@@ -9957,7 +9957,7 @@ DatabaseConnection::RollbackSavepoint()
// This may fail if SQLite already rolled back the savepoint so ignore any
// errors.
unused << stmt->Execute();
Unused << stmt->Execute();
return NS_OK;
}
@@ -10047,7 +10047,7 @@ DatabaseConnection::DoIdleProcessing(bool aNeedsCheckpoint)
// Release the connection's normal transaction. It's possible that it could
// fail, but that isn't a problem here.
unused << rollbackStmt->Execute();
Unused << rollbackStmt->Execute();
mInReadTransaction = false;
}
@@ -10072,7 +10072,7 @@ DatabaseConnection::DoIdleProcessing(bool aNeedsCheckpoint)
// Truncate the WAL if we were asked to or if we managed to free some space.
if (aNeedsCheckpoint || freedSomePages) {
rv = CheckpointInternal(CheckpointMode::Truncate);
unused << NS_WARN_IF(NS_FAILED(rv));
Unused << NS_WARN_IF(NS_FAILED(rv));
}
// Finally try to restart the read transaction if we rolled it back earlier.
@@ -10198,7 +10198,7 @@ DatabaseConnection::ReclaimFreePagesWhileIdle(
MOZ_ASSERT(mInWriteTransaction);
// Something failed, make sure we roll everything back.
unused << aRollbackStatement->Execute();
Unused << aRollbackStatement->Execute();
mInWriteTransaction = false;
@@ -11166,7 +11166,7 @@ ConnectionPool::Start(const nsID& aBackgroundChildLoggingId,
}
if (!transactionInfo->mBlockedOn.Count()) {
unused << ScheduleTransaction(transactionInfo,
Unused << ScheduleTransaction(transactionInfo,
/* aFromQueuedTransactions */ false);
}
@@ -11259,7 +11259,7 @@ ConnectionPool::WaitForDatabasesToComplete(nsTArray<nsCString>&& aDatabaseIds,
}
if (mayRunCallbackImmediately) {
unused << aCallback->Run();
Unused << aCallback->Run();
return;
}
@@ -11331,7 +11331,7 @@ ConnectionPool::Cleanup()
MOZ_ASSERT(completeCallback);
MOZ_ASSERT(completeCallback->mCallback);
unused << completeCallback->mCallback->Run();
Unused << completeCallback->mCallback->Run();
}
mCompleteCallbacks.Clear();
@@ -11857,7 +11857,7 @@ ConnectionPool::NoteClosedDatabase(DatabaseInfo* aDatabaseInfo)
for (uint32_t index = 0, count = scheduledTransactions.Length();
index < count;
index++) {
unused << ScheduleTransaction(scheduledTransactions[index],
Unused << ScheduleTransaction(scheduledTransactions[index],
/* aFromQueuedTransactions */ false);
}
@@ -11922,7 +11922,7 @@ ConnectionPool::MaybeFireCallback(DatabasesCompleteCallback* aCallback)
}
}
unused << aCallback->mCallback->Run();
Unused << aCallback->mCallback->Run();
return true;
}
@@ -12201,7 +12201,7 @@ FinishCallbackWrapper::Run()
mHasRunOnce = true;
unused << mCallback->Run();
Unused << mCallback->Run();
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
mOwningThread->Dispatch(this, NS_DISPATCH_NORMAL)));
@@ -12499,7 +12499,7 @@ TransactionInfo::Schedule()
MOZ_ASSERT(connectionPool);
connectionPool->AssertIsOnOwningThread();
unused <<
Unused <<
connectionPool->ScheduleTransaction(this,
/* aFromQueuedTransactions */ false);
}
@@ -12889,7 +12889,7 @@ WaitForTransactionsHelper::WaitForTransactions()
{
MOZ_ASSERT(mState == State::Initial);
unused << this->Run();
Unused << this->Run();
}
void
@@ -13121,7 +13121,7 @@ Database::Invalidate()
mInvalidated = true;
if (mActorWasAlive && !mActorDestroyed) {
unused << SendInvalidate();
Unused << SendInvalidate();
}
if (!Helper::InvalidateTransactions(mTransactions)) {
@@ -14727,7 +14727,7 @@ NormalTransaction::SendCompleteNotification(nsresult aResult)
AssertIsOnBackgroundThread();
if (!IsActorDestroyed()) {
unused << SendComplete(aResult);
Unused << SendComplete(aResult);
}
}
@@ -15026,7 +15026,7 @@ VersionChangeTransaction::SendCompleteNotification(nsresult aResult)
openDatabaseOp->mState = OpenDatabaseOp::State::SendingResults;
if (!IsActorDestroyed()) {
unused << SendComplete(aResult);
Unused << SendComplete(aResult);
}
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(openDatabaseOp->Run()));
@@ -16822,7 +16822,7 @@ QuotaClient::PerformIdleMaintenance()
if (kRunningXPCShellTests) {
// We don't want user activity to impact this code if we're running tests.
unused << Observe(nullptr, OBSERVER_TOPIC_IDLE, nullptr);
Unused << Observe(nullptr, OBSERVER_TOPIC_IDLE, nullptr);
} else if (!mIdleObserverRegistered) {
nsCOMPtr<nsIIdleService> idleService =
do_GetService(kIdleServiceContractId);
@@ -17967,7 +17967,7 @@ AutoProgressHandler::Unregister()
nsCOMPtr<mozIStorageProgressHandler> oldHandler;
nsresult rv = mConnection->RemoveProgressHandler(getter_AddRefs(oldHandler));
unused << NS_WARN_IF(NS_FAILED(rv));
Unused << NS_WARN_IF(NS_FAILED(rv));
MOZ_ASSERT_IF(NS_SUCCEEDED(rv), oldHandler == this);
}
@@ -20904,7 +20904,7 @@ OpenDatabaseOp::SendBlockedNotification()
MOZ_ASSERT(mState == State::WaitingForOtherDatabasesToClose);
if (!IsActorDestroyed()) {
unused << SendBlocked(mMetadata->mCommonMetadata.version());
Unused << SendBlocked(mMetadata->mCommonMetadata.version());
}
}
@@ -21067,7 +21067,7 @@ OpenDatabaseOp::SendResults()
response = ClampResultCode(mResultCode);
}
unused <<
Unused <<
PBackgroundIDBFactoryRequestParent::Send__delete__(this, response);
}
@@ -21793,7 +21793,7 @@ DeleteDatabaseOp::SendBlockedNotification()
MOZ_ASSERT(mState == State::WaitingForOtherDatabasesToClose);
if (!IsActorDestroyed()) {
unused << SendBlocked(0);
Unused << SendBlocked(0);
}
}
@@ -21812,7 +21812,7 @@ DeleteDatabaseOp::SendResults()
response = ClampResultCode(mResultCode);
}
unused <<
Unused <<
PBackgroundIDBFactoryRequestParent::Send__delete__(this, response);
}
@@ -22886,7 +22886,7 @@ CreateFileOp::SendResults()
response = ClampResultCode(mResultCode);
}
unused <<
Unused <<
PBackgroundIDBDatabaseRequestParent::Send__delete__(this, response);
}
@@ -27246,7 +27246,7 @@ PermissionRequestHelper::OnPromptComplete(PermissionValue aPermissionValue)
MOZ_ASSERT(NS_IsMainThread());
if (!mActorDestroyed) {
unused <<
Unused <<
PIndexedDBPermissionRequestParent::Send__delete__(this, aPermissionValue);
}
}
+2 -2
View File
@@ -273,7 +273,7 @@ CancelableRunnableWrapper::Cancel()
return NS_ERROR_UNEXPECTED;
}
unused << Run();
Unused << Run();
MOZ_ASSERT(!mRunnable);
return NS_OK;
@@ -4108,7 +4108,7 @@ BlobParent::NoteDyingRemoteBlobImpl()
mBlobImpl = nullptr;
mRemoteBlobImpl = nullptr;
unused << PBlobParent::Send__delete__(this);
Unused << PBlobParent::Send__delete__(this);
}
void
+4 -4
View File
@@ -12,7 +12,7 @@
#include "mozilla/dom/Element.h"
#include "mozilla/dom/TabParent.h"
using mozilla::unused;
using mozilla::Unused;
using namespace mozilla::dom;
NS_IMPL_ISUPPORTS(ColorPickerParent::ColorPickerShownCallback,
@@ -22,7 +22,7 @@ NS_IMETHODIMP
ColorPickerParent::ColorPickerShownCallback::Update(const nsAString& aColor)
{
if (mColorPickerParent) {
unused << mColorPickerParent->SendUpdate(nsString(aColor));
Unused << mColorPickerParent->SendUpdate(nsString(aColor));
}
return NS_OK;
}
@@ -31,7 +31,7 @@ NS_IMETHODIMP
ColorPickerParent::ColorPickerShownCallback::Done(const nsAString& aColor)
{
if (mColorPickerParent) {
unused << mColorPickerParent->Send__delete__(mColorPickerParent,
Unused << mColorPickerParent->Send__delete__(mColorPickerParent,
nsString(aColor));
}
return NS_OK;
@@ -68,7 +68,7 @@ bool
ColorPickerParent::RecvOpen()
{
if (!CreateColorPicker()) {
unused << Send__delete__(this, mInitialColor);
Unused << Send__delete__(this, mInitialColor);
return true;
}
+17 -17
View File
@@ -346,7 +346,7 @@ private:
}
// The XPCOM refcount drives the IPC lifecycle; see also
// DeallocPCycleCollectWithLogsChild.
unused << Send__delete__(this);
Unused << Send__delete__(this);
}
nsresult UnimplementedProperty()
@@ -807,7 +807,7 @@ ContentChild::ProvideWindowCommon(TabChild* aTabOpener,
ipcContext->get_PopupIPCTabContext().opener() = aTabOpener;
}
unused << SendPBrowserConstructor(
Unused << SendPBrowserConstructor(
// We release this ref in DeallocPBrowserChild
RefPtr<TabChild>(newChild).forget().take(),
tabId, *ipcContext, aChromeFlags,
@@ -2451,7 +2451,7 @@ OnFinishNuwaPreparation()
}
// This will create the actor.
unused << mozilla::dom::NuwaChild::GetSingleton();
Unused << mozilla::dom::NuwaChild::GetSingleton();
MakeNuwaProcess();
}
@@ -2576,17 +2576,17 @@ ContentChild::RecvFileSystemUpdate(const nsString& aFsName,
}
#else
// Remove warnings about unused arguments
unused << aFsName;
unused << aVolumeName;
unused << aState;
unused << aMountGeneration;
unused << aIsMediaPresent;
unused << aIsSharing;
unused << aIsFormatting;
unused << aIsFake;
unused << aIsUnmounting;
unused << aIsRemovable;
unused << aIsHotSwappable;
Unused << aFsName;
Unused << aVolumeName;
Unused << aState;
Unused << aMountGeneration;
Unused << aIsMediaPresent;
Unused << aIsSharing;
Unused << aIsFormatting;
Unused << aIsFake;
Unused << aIsUnmounting;
Unused << aIsRemovable;
Unused << aIsHotSwappable;
#endif
return true;
}
@@ -2601,7 +2601,7 @@ ContentChild::RecvVolumeRemoved(const nsString& aFsName)
}
#else
// Remove warnings about unused arguments
unused << aFsName;
Unused << aFsName;
#endif
return true;
}
@@ -2793,7 +2793,7 @@ ContentChild::RecvGatherProfile()
profileCString = EmptyCString();
}
unused << SendProfile(profileCString);
Unused << SendProfile(profileCString);
return true;
}
@@ -2904,7 +2904,7 @@ ContentChild::RecvShutdown()
// Ignore errors here. If this fails, the parent will kill us after a
// timeout.
unused << SendFinishShutdown();
Unused << SendFinishShutdown();
return true;
}
+66 -56
View File
@@ -531,13 +531,13 @@ public:
private:
virtual bool RecvCloseGCLog() override
{
unused << mSink->CloseGCLog();
Unused << mSink->CloseGCLog();
return true;
}
virtual bool RecvCloseCCLog() override
{
unused << mSink->CloseCCLog();
Unused << mSink->CloseCCLog();
return true;
}
@@ -548,7 +548,7 @@ private:
nsCOMPtr<nsIFile> gcLog, ccLog;
mSink->GetGcLog(getter_AddRefs(gcLog));
mSink->GetCcLog(getter_AddRefs(ccLog));
unused << mCallback->OnDump(gcLog, ccLog, /* parent = */ false);
Unused << mCallback->OnDump(gcLog, ccLog, /* parent = */ false);
return true;
}
@@ -1516,7 +1516,7 @@ ContentParent::Init()
// If accessibility is running in chrome process then start it in content
// process.
if (nsIPresShell::IsAccessibilityActive()) {
unused << SendActivateA11y();
Unused << SendActivateA11y();
}
#endif
}
@@ -1533,7 +1533,7 @@ ContentParent::ForwardKnownInfo()
RefPtr<nsVolumeService> vs = nsVolumeService::GetSingleton();
if (vs && !mIsForBrowser) {
vs->GetVolumesForIPC(&volumeInfo);
unused << SendVolumes(volumeInfo);
Unused << SendVolumes(volumeInfo);
}
#endif /* MOZ_WIDGET_GONK */
@@ -2212,7 +2212,7 @@ ContentParent::NotifyTabDestroyed(const TabId& aTabId,
// Need to close undeleted ContentPermissionRequestParents before tab is closed.
for (auto& permissionRequestParent : parentArray) {
nsTArray<PermissionChoice> emptyChoices;
unused << PContentPermissionRequestParent::Send__delete__(permissionRequestParent,
Unused << PContentPermissionRequestParent::Send__delete__(permissionRequestParent,
false,
emptyChoices);
}
@@ -2493,7 +2493,7 @@ ContentParent::InitInternal(ProcessPriority aInitialPriority,
nsCString vendor(gAppData->vendor);
// Sending all information to content process.
unused << SendAppInfo(version, buildID, name, UAName, ID, vendor);
Unused << SendAppInfo(version, buildID, name, UAName, ID, vendor);
}
// Initialize the message manager (and load delayed scripts) now that we
@@ -2533,7 +2533,7 @@ ContentParent::InitInternal(ProcessPriority aInitialPriority,
if (gAppData) {
// Sending all information to content process.
unused << SendAppInit();
Unused << SendAppInit();
}
nsStyleSheetService *sheetService = nsStyleSheetService::GetInstance();
@@ -2545,21 +2545,21 @@ ContentParent::InitInternal(ProcessPriority aInitialPriority,
for (uint32_t i = 0; i < agentSheets.Length(); i++) {
URIParams uri;
SerializeURI(agentSheets[i]->GetSheetURI(), uri);
unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::AGENT_SHEET);
Unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::AGENT_SHEET);
}
nsCOMArray<nsIStyleSheet>& userSheets = *sheetService->UserStyleSheets();
for (uint32_t i = 0; i < userSheets.Length(); i++) {
URIParams uri;
SerializeURI(userSheets[i]->GetSheetURI(), uri);
unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::USER_SHEET);
Unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::USER_SHEET);
}
nsCOMArray<nsIStyleSheet>& authorSheets = *sheetService->AuthorStyleSheets();
for (uint32_t i = 0; i < authorSheets.Length(); i++) {
URIParams uri;
SerializeURI(authorSheets[i]->GetSheetURI(), uri);
unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::AUTHOR_SHEET);
Unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::AUTHOR_SHEET);
}
}
@@ -3014,7 +3014,7 @@ ContentParent::OnNewProcessCreated(uint32_t aPid,
sNuwaPrefUpdates->Length() : 0;
// Resend pref updates to the forked child.
for (size_t i = 0; i < numNuwaPrefUpdates; i++) {
mozilla::unused << content->SendPreferenceUpdate(sNuwaPrefUpdates->ElementAt(i));
mozilla::Unused << content->SendPreferenceUpdate(sNuwaPrefUpdates->ElementAt(i));
}
// Update offline settings.
@@ -3028,8 +3028,8 @@ ContentParent::OnNewProcessCreated(uint32_t aPid,
RecvGetXPCOMProcessAttributes(&isOffline, &isConnected,
&isLangRTL, &unusedDictionaries,
&clipboardCaps, &domainPolicy, &initialData);
mozilla::unused << content->SendSetOffline(isOffline);
mozilla::unused << content->SendSetConnectivity(isConnected);
mozilla::Unused << content->SendSetOffline(isOffline);
mozilla::Unused << content->SendSetConnectivity(isConnected);
MOZ_ASSERT(!clipboardCaps.supportsSelectionClipboard() &&
!clipboardCaps.supportsFindClipboard(),
"Unexpected values");
@@ -3093,7 +3093,7 @@ ContentParent::Observe(nsISupports* aSubject,
if (!strcmp(aTopic, "memory-pressure") &&
!StringEndsWith(nsDependentString(aData),
NS_LITERAL_STRING("-no-forward"))) {
unused << SendFlushMemory(nsDependentString(aData));
Unused << SendFlushMemory(nsDependentString(aData));
}
// listening for remotePrefs...
else if (!strcmp(aTopic, "nsPref:changed")) {
@@ -3135,28 +3135,29 @@ ContentParent::Observe(nsISupports* aSubject,
else if (!strcmp(aTopic, "alertfinished") ||
!strcmp(aTopic, "alertclickcallback") ||
!strcmp(aTopic, "alertshow") ||
!strcmp(aTopic, "alertdisablecallback")) {
!strcmp(aTopic, "alertdisablecallback") ||
!strcmp(aTopic, "alertsettingscallback")) {
if (!SendNotifyAlertsObserver(nsDependentCString(aTopic),
nsDependentString(aData)))
return NS_ERROR_NOT_AVAILABLE;
}
else if (!strcmp(aTopic, "child-gc-request")){
unused << SendGarbageCollect();
Unused << SendGarbageCollect();
}
else if (!strcmp(aTopic, "child-cc-request")){
unused << SendCycleCollect();
Unused << SendCycleCollect();
}
else if (!strcmp(aTopic, "child-mmu-request")){
unused << SendMinimizeMemoryUsage();
Unused << SendMinimizeMemoryUsage();
}
else if (!strcmp(aTopic, "last-pb-context-exited")) {
unused << SendLastPrivateDocShellDestroyed();
Unused << SendLastPrivateDocShellDestroyed();
}
else if (!strcmp(aTopic, "file-watcher-update")) {
nsCString creason;
CopyUTF16toUTF8(aData, creason);
DeviceStorageFile* file = static_cast<DeviceStorageFile*>(aSubject);
unused << SendFilePathUpdate(file->mStorageType, file->mStorageName, file->mPath, creason);
Unused << SendFilePathUpdate(file->mStorageType, file->mStorageName, file->mPath, creason);
}
#ifdef MOZ_WIDGET_GONK
else if(!strcmp(aTopic, NS_VOLUME_STATE_CHANGED)) {
@@ -3189,17 +3190,17 @@ ContentParent::Observe(nsISupports* aSubject,
vol->GetIsRemovable(&isRemovable);
vol->GetIsHotSwappable(&isHotSwappable);
unused << SendFileSystemUpdate(volName, mountPoint, state,
Unused << SendFileSystemUpdate(volName, mountPoint, state,
mountGeneration, isMediaPresent,
isSharing, isFormatting, isFake,
isUnmounting, isRemovable, isHotSwappable);
} else if (!strcmp(aTopic, "phone-state-changed")) {
nsString state(aData);
unused << SendNotifyPhoneStateChange(state);
Unused << SendNotifyPhoneStateChange(state);
}
else if(!strcmp(aTopic, NS_VOLUME_REMOVED)) {
nsString volName(aData);
unused << SendVolumeRemoved(volName);
Unused << SendVolumeRemoved(volName);
}
#endif
#ifdef ACCESSIBILITY
@@ -3207,11 +3208,11 @@ ContentParent::Observe(nsISupports* aSubject,
// gets initiated in chrome process.
else if (aData && (*aData == '1') &&
!strcmp(aTopic, "a11y-init-or-shutdown")) {
unused << SendActivateA11y();
Unused << SendActivateA11y();
}
#endif
else if (!strcmp(aTopic, "app-theme-changed")) {
unused << SendOnAppThemeChanged();
Unused << SendOnAppThemeChanged();
}
#ifdef MOZ_ENABLE_PROFILER_SPS
else if (!strcmp(aTopic, "profiler-started")) {
@@ -3222,21 +3223,21 @@ ContentParent::Observe(nsISupports* aSubject,
params->GetInterval(&interval);
const nsTArray<nsCString>& features = params->GetFeatures();
const nsTArray<nsCString>& threadFilterNames = params->GetThreadFilterNames();
unused << SendStartProfiler(entries, interval, features, threadFilterNames);
Unused << SendStartProfiler(entries, interval, features, threadFilterNames);
}
else if (!strcmp(aTopic, "profiler-stopped")) {
unused << SendStopProfiler();
Unused << SendStopProfiler();
}
else if (!strcmp(aTopic, "profiler-paused")) {
unused << SendPauseProfiler(true);
Unused << SendPauseProfiler(true);
}
else if (!strcmp(aTopic, "profiler-resumed")) {
unused << SendPauseProfiler(false);
Unused << SendPauseProfiler(false);
}
else if (!strcmp(aTopic, "profiler-subprocess-gather")) {
mGatherer = static_cast<ProfileGatherer*>(aSubject);
mGatherer->WillGatherOOPProfile();
unused << SendGatherProfile();
Unused << SendGatherProfile();
}
else if (!strcmp(aTopic, "profiler-subprocess")) {
nsCOMPtr<nsIProfileSaveEvent> pse = do_QueryInterface(aSubject);
@@ -3249,7 +3250,7 @@ ContentParent::Observe(nsISupports* aSubject,
}
#endif
else if (!strcmp(aTopic, "gmp-changed")) {
unused << SendNotifyGMPsChanged();
Unused << SendNotifyGMPsChanged();
}
return NS_OK;
}
@@ -4157,7 +4158,7 @@ ContentParent::RecvGetSystemMemory(const uint64_t& aGetterId)
memoryTotal = mozilla::hal::GetTotalSystemMemoryLevel();
#endif
unused << SendSystemMemoryAvailable(aGetterId, memoryTotal);
Unused << SendSystemMemoryAvailable(aGetterId, memoryTotal);
return true;
}
@@ -4213,6 +4214,20 @@ ContentParent::RecvLoadURIExternal(const URIParams& uri)
return true;
}
bool
ContentParent::HasNotificationPermission(const IPC::Principal& aPrincipal)
{
#ifdef MOZ_CHILD_PERMISSIONS
uint32_t permission = mozilla::CheckPermission(this, aPrincipal,
"desktop-notification");
if (permission != nsIPermissionManager::ALLOW_ACTION) {
return false;
}
#endif /* MOZ_CHILD_PERMISSIONS */
return true;
}
bool
ContentParent::RecvShowAlertNotification(const nsString& aImageUrl, const nsString& aTitle,
const nsString& aText, const bool& aTextClickable,
@@ -4222,13 +4237,9 @@ ContentParent::RecvShowAlertNotification(const nsString& aImageUrl, const nsStri
const IPC::Principal& aPrincipal,
const bool& aInPrivateBrowsing)
{
#ifdef MOZ_CHILD_PERMISSIONS
uint32_t permission = mozilla::CheckPermission(this, aPrincipal,
"desktop-notification");
if (permission != nsIPermissionManager::ALLOW_ACTION) {
if (!HasNotificationPermission(aPrincipal)) {
return true;
}
#endif /* MOZ_CHILD_PERMISSIONS */
nsCOMPtr<nsIAlertsService> sysAlerts(do_GetService(NS_ALERTSERVICE_CONTRACTID));
if (sysAlerts) {
@@ -4243,13 +4254,9 @@ bool
ContentParent::RecvCloseAlert(const nsString& aName,
const IPC::Principal& aPrincipal)
{
#ifdef MOZ_CHILD_PERMISSIONS
uint32_t permission = mozilla::CheckPermission(this, aPrincipal,
"desktop-notification");
if (permission != nsIPermissionManager::ALLOW_ACTION) {
if (!HasNotificationPermission(aPrincipal)) {
return true;
}
#endif
nsCOMPtr<nsIAlertsService> sysAlerts(do_GetService(NS_ALERTSERVICE_CONTRACTID));
if (sysAlerts) {
@@ -4262,15 +4269,18 @@ ContentParent::RecvCloseAlert(const nsString& aName,
bool
ContentParent::RecvDisableNotifications(const IPC::Principal& aPrincipal)
{
#ifdef MOZ_CHILD_PERMISSIONS
uint32_t permission = mozilla::CheckPermission(this, aPrincipal,
"desktop-notification");
if (permission != nsIPermissionManager::ALLOW_ACTION) {
return true;
if (HasNotificationPermission(aPrincipal)) {
Unused << Notification::RemovePermission(aPrincipal);
}
#endif
return true;
}
unused << Notification::RemovePermission(aPrincipal);
bool
ContentParent::RecvOpenNotificationSettings(const IPC::Principal& aPrincipal)
{
if (HasNotificationPermission(aPrincipal)) {
Unused << Notification::OpenSettings(aPrincipal);
}
return true;
}
@@ -4423,7 +4433,7 @@ ContentParent::RecvSetGeolocationHigherAccuracy(const bool& aEnable)
NS_IMETHODIMP
ContentParent::HandleEvent(nsIDOMGeoPosition* postion)
{
unused << SendGeolocationUpdate(GeoPosition(postion));
Unused << SendGeolocationUpdate(GeoPosition(postion));
return NS_OK;
}
@@ -4434,7 +4444,7 @@ ContentParent::HandleEvent(nsIDOMGeoPositionError* postionError)
nsresult rv;
rv = postionError->GetCode(&errorCode);
NS_ENSURE_SUCCESS(rv,rv);
unused << SendGeolocationError(errorCode);
Unused << SendGeolocationError(errorCode);
return NS_OK;
}
@@ -5003,7 +5013,7 @@ ContentParent::NotifyUpdatedDictionaries()
spellChecker->GetDictionaryList(&dictionaries);
for (size_t i = 0; i < processes.Length(); ++i) {
unused << processes[i]->SendUpdateDictionaryList(dictionaries);
Unused << processes[i]->SendUpdateDictionaryList(dictionaries);
}
}
@@ -5129,7 +5139,7 @@ ContentParent::RecvPOfflineCacheUpdateConstructor(POfflineCacheUpdateParent* aAc
nsresult rv = update->Schedule(aManifestURI, aDocumentURI, aLoadingPrincipal, aStickDocument);
if (NS_FAILED(rv) && IsAlive()) {
// Inform the child of failure.
unused << update->SendFinish(false, false);
Unused << update->SendFinish(false, false);
}
return true;
@@ -5207,7 +5217,7 @@ ContentParent::MaybeInvokeDragSession(TabParent* aParent)
this);
uint32_t action;
session->GetDragAction(&action);
mozilla::unused << SendInvokeDragSession(dataTransfers, action);
mozilla::Unused << SendInvokeDragSession(dataTransfers, action);
}
}
}
@@ -5653,7 +5663,7 @@ NS_IMPL_ISUPPORTS(ParentIdleListener, nsIObserver)
NS_IMETHODIMP
ParentIdleListener::Observe(nsISupports*, const char* aTopic, const char16_t* aData) {
mozilla::unused << mParent->SendNotifyIdleObserver(mObserver,
mozilla::Unused << mParent->SendNotifyIdleObserver(mObserver,
nsDependentCString(aTopic),
nsDependentString(aData));
return NS_OK;
+4
View File
@@ -755,6 +755,8 @@ private:
virtual bool RecvSetURITitle(const URIParams& uri,
const nsString& title) override;
bool HasNotificationPermission(const IPC::Principal& aPrincipal);
virtual bool RecvShowAlertNotification(const nsString& aImageUrl, const nsString& aTitle,
const nsString& aText, const bool& aTextClickable,
const nsString& aCookie, const nsString& aName,
@@ -768,6 +770,8 @@ private:
virtual bool RecvDisableNotifications(const IPC::Principal& aPrincipal) override;
virtual bool RecvOpenNotificationSettings(const IPC::Principal& aPrincipal) override;
virtual bool RecvLoadURIExternal(const URIParams& uri) override;
virtual bool RecvSyncMessage(const nsString& aMsg,
+1 -1
View File
@@ -58,7 +58,7 @@ SetUpSandboxEnvironment()
// Change the gecko defined temp directory to our low integrity one.
// Undefine returns a failure if the property is not already set.
unused << nsDirectoryService::gService->Undefine(NS_OS_TEMP_DIR);
Unused << nsDirectoryService::gService->Undefine(NS_OS_TEMP_DIR);
rv = nsDirectoryService::gService->Set(NS_OS_TEMP_DIR, lowIntegrityTemp);
if (NS_WARN_IF(NS_FAILED(rv))) {
return;
+5 -5
View File
@@ -18,7 +18,7 @@
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/ipc/BlobParent.h"
using mozilla::unused;
using mozilla::Unused;
using namespace mozilla::dom;
NS_IMPL_ISUPPORTS(FilePickerParent::FilePickerShownCallback,
@@ -125,7 +125,7 @@ FilePickerParent::SendFiles(const nsTArray<RefPtr<BlobImpl>>& aBlobs)
InputFiles inblobs;
inblobs.blobsParent().SwapElements(blobs);
unused << Send__delete__(this, inblobs, mResult);
Unused << Send__delete__(this, inblobs, mResult);
}
void
@@ -134,7 +134,7 @@ FilePickerParent::Done(int16_t aResult)
mResult = aResult;
if (mResult != nsIFilePicker::returnOK) {
unused << Send__delete__(this, void_t(), mResult);
Unused << Send__delete__(this, void_t(), mResult);
return;
}
@@ -168,7 +168,7 @@ FilePickerParent::Done(int16_t aResult)
mRunnable = new FileSizeAndDateRunnable(this, blobs);
// Dispatch to background thread to do I/O:
if (!mRunnable->Dispatch()) {
unused << Send__delete__(this, void_t(), nsIFilePicker::returnCancel);
Unused << Send__delete__(this, void_t(), nsIFilePicker::returnCancel);
}
}
@@ -203,7 +203,7 @@ FilePickerParent::RecvOpen(const int16_t& aSelectedType,
const nsString& aDisplayDirectory)
{
if (!CreateFilePicker()) {
unused << Send__delete__(this, void_t(), nsIFilePicker::returnCancel);
Unused << Send__delete__(this, void_t(), nsIFilePicker::returnCancel);
return true;
}
+1 -1
View File
@@ -239,7 +239,7 @@ OnNuwaProcessReady()
NuwaChild* nuwaChild = NuwaChild::GetSingleton();
MOZ_ASSERT(nuwaChild);
mozilla::unused << nuwaChild->SendNotifyReady();
mozilla::Unused << nuwaChild->SendNotifyReady();
}
NS_EXPORT void
+2 -2
View File
@@ -125,7 +125,7 @@ NuwaParent::CloneProtocol(Channel* aChannel,
actor->ActorConstructed();
// The actor can finally be deleted after fully constructed.
mozilla::unused << actor->Send__delete__(actor);
mozilla::Unused << actor->Send__delete__(actor);
});
MOZ_ASSERT(nested);
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
@@ -232,7 +232,7 @@ NuwaParent::ForkNewProcess(uint32_t& aPid,
RefPtr<NuwaParent> self = this;
nsCOMPtr<nsIRunnable> runnable = NS_NewRunnableFunction([self] () -> void
{
mozilla::unused << self->SendFork();
mozilla::Unused << self->SendFork();
});
MOZ_ASSERT(runnable);
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(mWorkerThread->Dispatch(runnable,
+2
View File
@@ -843,6 +843,8 @@ parent:
DisableNotifications(Principal principal);
OpenNotificationSettings(Principal principal);
PPSMContentDownloader(uint32_t aCertType);
PExternalHelperApp(OptionalURIParams uri,
+1 -1
View File
@@ -308,7 +308,7 @@ SendTestOnlyNotification(const char* aMessage)
nsCOMPtr<nsIMessageBroadcaster> ppmm =
do_GetService("@mozilla.org/parentprocessmessagemanager;1");
mozilla::unused << ppmm->BroadcastAsyncMessage(
mozilla::Unused << ppmm->BroadcastAsyncMessage(
message, JS::NullHandleValue, JS::NullHandleValue, cx, 1);
}
+5 -5
View File
@@ -346,7 +346,7 @@ HangMonitorChild::NotifySlowScriptAsync(TabId aTabId,
unsigned aLineNo)
{
if (mIPCOpen) {
unused << SendHangEvidence(SlowScriptData(aTabId, aFileName, aLineNo));
Unused << SendHangEvidence(SlowScriptData(aTabId, aFileName, aLineNo));
}
}
@@ -425,7 +425,7 @@ HangMonitorChild::NotifyPluginHangAsync(uint32_t aPluginId)
// bounce back to parent on background thread
if (mIPCOpen) {
unused << SendHangEvidence(PluginHangData(aPluginId));
Unused << SendHangEvidence(PluginHangData(aPluginId));
}
}
@@ -619,7 +619,7 @@ HangMonitorParent::TerminateScript()
MOZ_RELEASE_ASSERT(MessageLoop::current() == MonitorLoop());
if (mIPCOpen) {
unused << SendTerminateScript();
Unused << SendTerminateScript();
}
}
@@ -629,7 +629,7 @@ HangMonitorParent::BeginStartingDebugger()
MOZ_RELEASE_ASSERT(MessageLoop::current() == MonitorLoop());
if (mIPCOpen) {
unused << SendBeginStartingDebugger();
Unused << SendBeginStartingDebugger();
}
}
@@ -639,7 +639,7 @@ HangMonitorParent::EndStartingDebugger()
MOZ_RELEASE_ASSERT(MessageLoop::current() == MonitorLoop());
if (mIPCOpen) {
unused << SendEndStartingDebugger();
Unused << SendEndStartingDebugger();
}
}
+3 -3
View File
@@ -1089,11 +1089,11 @@ ParticularProcessPriorityManager::SetPriorityNow(ProcessPriority aPriority,
ProcessPriorityManagerImpl::GetSingleton()->
NotifyProcessPriorityChanged(this, oldPriority);
unused << mContentParent->SendNotifyProcessPriorityChanged(mPriority);
Unused << mContentParent->SendNotifyProcessPriorityChanged(mPriority);
}
if (aPriority < PROCESS_PRIORITY_FOREGROUND) {
unused << mContentParent->SendFlushMemory(NS_LITERAL_STRING("lowering-priority"));
Unused << mContentParent->SendFlushMemory(NS_LITERAL_STRING("lowering-priority"));
}
FireTestOnlyObserverNotification("process-priority-set",
@@ -1307,7 +1307,7 @@ ProcessLRUPool::CalculateLRULevel(uint32_t aLRU)
// (End of buffer)
int exp;
unused << frexp(static_cast<double>(aLRU), &exp);
Unused << frexp(static_cast<double>(aLRU), &exp);
uint32_t level = std::max(exp - 1, 0);
return std::min(mLRUPoolLevels - 1, level);
+2 -2
View File
@@ -26,7 +26,7 @@ ScreenManagerParent::ScreenManagerParent(uint32_t* aNumberOfScreens,
MOZ_CRASH("Couldn't get nsIScreenManager from ScreenManagerParent.");
}
unused << RecvRefresh(aNumberOfScreens, aSystemDefaultScale, aSuccess);
Unused << RecvRefresh(aNumberOfScreens, aSystemDefaultScale, aSuccess);
}
bool
@@ -64,7 +64,7 @@ ScreenManagerParent::RecvScreenRefresh(const uint32_t& aId,
}
ScreenDetails details;
unused << ExtractScreenDetails(screen, details);
Unused << ExtractScreenDetails(screen, details);
*aRetVal = details;
*aSuccess = true;

Some files were not shown because too many files have changed in this diff Show More