author | Sylvestre Ledru <sledru@mozilla.com> |
Fri, 28 Dec 2018 15:48:06 +0000 | |
changeset 452057 | d57dde190f67e7964bb3a908d33a4d086da696b1 |
parent 452056 | 84b5a122d74e5dc681c67a5ca1ca774c6a72f0cc |
child 452058 | ee9c8c99151925557cdd83f4960f4093679d2293 |
child 452102 | 0cf7daf34a373c26eecab2b19baf7bff67756170 |
push id | 75310 |
push user | sledru@mozilla.com |
push date | Fri, 28 Dec 2018 15:50:59 +0000 |
treeherder | autoland@d57dde190f67 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | Ehsan |
bugs | 1516555 |
milestone | 66.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -8642,20 +8642,19 @@ nsresult nsDocShell::InternalLoad(nsDocS if (mUseStrictSecurityChecks && !aLoadState->TriggeringPrincipal()) { return NS_ERROR_FAILURE; } nsresult rv = NS_OK; mOriginalUriString.Truncate(); - MOZ_LOG( - gDocShellLeakLog, LogLevel::Debug, - ("DOCSHELL %p InternalLoad %s\n", this, - aLoadState->URI()->GetSpecOrDefault().get())); + MOZ_LOG(gDocShellLeakLog, LogLevel::Debug, + ("DOCSHELL %p InternalLoad %s\n", this, + aLoadState->URI()->GetSpecOrDefault().get())); // Initialize aDocShell/aRequest if (aDocShell) { *aDocShell = nullptr; } if (aRequest) { *aRequest = nullptr; }
--- a/docshell/base/nsDocShellLoadState.cpp +++ b/docshell/base/nsDocShellLoadState.cpp @@ -32,35 +32,35 @@ nsDocShellLoadState::nsDocShellLoadState mLoadFlags(0), mFirstParty(false), mTypeHint(VoidCString()), mFileName(VoidString()), mIsFromProcessingFrameAttributes(false) { MOZ_ASSERT(aURI, "Cannot create a LoadState with a null URI!"); } -nsDocShellLoadState::nsDocShellLoadState(DocShellLoadStateInit& aLoadState) -{ +nsDocShellLoadState::nsDocShellLoadState(DocShellLoadStateInit& aLoadState) { MOZ_ASSERT(aLoadState.URI(), "Cannot create a LoadState with a null URI!"); mResultPrincipalURIIsSome = aLoadState.ResultPrincipalURIIsSome(); mKeepResultPrincipalURIIfSet = aLoadState.KeepResultPrincipalURIIfSet(); mLoadReplace = aLoadState.LoadReplace(); mInheritPrincipal = aLoadState.InheritPrincipal(); mPrincipalIsExplicit = aLoadState.PrincipalIsExplicit(); mForceAllowDataURI = aLoadState.ForceAllowDataURI(); mOriginalFrameSrc = aLoadState.OriginalFrameSrc(); mSendReferrer = aLoadState.SendReferrer(); mReferrerPolicy = (mozilla::net::ReferrerPolicy)aLoadState.ReferrerPolicy(); mLoadType = aLoadState.LoadType(); mTarget = aLoadState.Target(); mLoadFlags = aLoadState.LoadFlags(); mFirstParty = aLoadState.FirstParty(); mTypeHint = aLoadState.TypeHint(); mFileName = aLoadState.FileName(); - mIsFromProcessingFrameAttributes = aLoadState.IsFromProcessingFrameAttributes(); + mIsFromProcessingFrameAttributes = + aLoadState.IsFromProcessingFrameAttributes(); mReferrer = aLoadState.Referrer(); mURI = aLoadState.URI(); mOriginalURI = aLoadState.OriginalURI(); mBaseURI = aLoadState.BaseURI(); mTriggeringPrincipal = aLoadState.TriggeringPrincipal(); mPrincipalToInherit = aLoadState.PrincipalToInherit(); } @@ -427,17 +427,18 @@ DocShellLoadStateInit nsDocShellLoadStat loadState.SendReferrer() = mSendReferrer; loadState.ReferrerPolicy() = mReferrerPolicy; loadState.LoadType() = mLoadType; loadState.Target() = mTarget; loadState.LoadFlags() = mLoadFlags; loadState.FirstParty() = mFirstParty; loadState.TypeHint() = mTypeHint; loadState.FileName() = mFileName; - loadState.IsFromProcessingFrameAttributes() = mIsFromProcessingFrameAttributes; + loadState.IsFromProcessingFrameAttributes() = + mIsFromProcessingFrameAttributes; loadState.Referrer() = mReferrer; loadState.URI() = mURI; loadState.OriginalURI() = mOriginalURI; loadState.BaseURI() = mBaseURI; loadState.TriggeringPrincipal() = mTriggeringPrincipal; loadState.PrincipalToInherit() = mPrincipalToInherit; return loadState; }
--- a/docshell/base/nsDocShellLoadState.h +++ b/docshell/base/nsDocShellLoadState.h @@ -17,18 +17,17 @@ class nsIInputStream; class nsISHEntry; class nsIURI; class nsIDocShell; class OriginAttibutes; namespace mozilla { namespace dom { class DocShellLoadStateInit; } -} - +} // namespace mozilla /** * nsDocShellLoadState contains setup information used in a nsIDocShell::loadURI * call. */ class nsDocShellLoadState final { public: NS_INLINE_DECL_REFCOUNTING(nsDocShellLoadState); @@ -185,16 +184,17 @@ class nsDocShellLoadState final { // When loading a document through nsDocShell::LoadURI(), a special set of // flags needs to be set based on other values in nsDocShellLoadState. This // function calculates those flags, before the LoadState is passed to // nsDocShell::InternalLoad. void CalculateLoadURIFlags(); mozilla::dom::DocShellLoadStateInit Serialize(); + protected: // Destructor can't be defaulted or inlined, as header doesn't have all type // includes it needs to do so. ~nsDocShellLoadState(); protected: // This is the referrer for the load. nsCOMPtr<nsIURI> mReferrer;
--- a/dom/base/PopupBlocker.cpp +++ b/dom/base/PopupBlocker.cpp @@ -12,17 +12,18 @@ namespace mozilla { namespace dom { namespace { static char* sPopupAllowedEvents; -static PopupBlocker::PopupControlState sPopupControlState = PopupBlocker::openAbused; +static PopupBlocker::PopupControlState sPopupControlState = + PopupBlocker::openAbused; static uint32_t sPopupStatePusherCount = 0; // This token is by default set to false. When a popup/filePicker is shown, it // is set to true. static bool sUnusedPopupToken = false; void PopupAllowedEventsChanged() { if (sPopupAllowedEvents) {
--- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -2536,20 +2536,18 @@ int32_t nsContentUtils::ComparePoints(ns // *after* of the valid DOM point? int32_t child1index = aParent1Cache ? aParent1Cache->ComputeIndexOf(parent, child1) : parent->ComputeIndexOf(child1); return child1index < aOffset2 ? -1 : 1; } // static -nsINode* -nsContentUtils::GetCommonAncestorUnderInteractiveContent(nsINode* aNode1, - nsINode* aNode2) -{ +nsINode* nsContentUtils::GetCommonAncestorUnderInteractiveContent( + nsINode* aNode1, nsINode* aNode2) { if (!aNode1 || !aNode2) { return nullptr; } if (aNode1 == aNode2) { return aNode1; }
--- a/dom/base/nsFocusManager.cpp +++ b/dom/base/nsFocusManager.cpp @@ -3144,17 +3144,18 @@ nsIContent* nsFocusManager::GetNextTabba if (contentToFocus) { return contentToFocus; } startContent = owner; owner = FindOwner(startContent); } - // If not found in shadow DOM, search from the top level shadow host in light DOM + // If not found in shadow DOM, search from the top level shadow host in light + // DOM *aStartContent = startContent; *aCurrentTabIndex = HostOrSlotTabIndexValue(startContent); return nullptr; } static nsIContent* GetTopLevelHost(nsIContent* aContent) { nsIContent* topLevelhost = nullptr; @@ -3378,17 +3379,18 @@ nsresult nsFocusManager::GetNextTabbable // "if ELEMENT is focusable, a shadow host, or a slot element, // append ELEMENT to NAVIGATION-ORDER." // and later in "For each element ELEMENT in NAVIGATION-ORDER: " // hosts and slots are handled before other elements. if (currentContent && IsHostOrSlot(currentContent)) { bool focusableHostSlot; int32_t tabIndex = HostOrSlotTabIndexValue(currentContent, &focusableHostSlot); - // Host or slot itself isn't focusable or going backwards, enter its scope. + // Host or slot itself isn't focusable or going backwards, enter its + // scope. if ((!aForward || !focusableHostSlot) && tabIndex >= 0 && (aIgnoreTabIndex || aCurrentTabIndex == tabIndex)) { nsIContent* contentToFocus = GetNextTabbableContentInScope( currentContent, currentContent, aOriginalStartContent, aForward, aForward ? 1 : 0, aIgnoreTabIndex, aForDocumentNavigation, true /* aSkipOwner */); if (contentToFocus) { NS_ADDREF(*aResultContent = contentToFocus);
--- a/dom/base/nsIDocument.h +++ b/dom/base/nsIDocument.h @@ -208,18 +208,18 @@ class CallbackObjectHolder; enum class CallerType : uint32_t; } // namespace dom } // namespace mozilla namespace mozilla { namespace net { class ChannelEventQueue; -} // namespace net -} // namespace mozilla +} // namespace net +} // namespace mozilla // Must be kept in sync with xpcom/rust/xpcom/src/interfaces/nonidl.rs #define NS_IDOCUMENT_IID \ { \ 0xce1f7627, 0x7109, 0x4977, { \ 0xba, 0x77, 0x49, 0x0f, 0xfd, 0xe0, 0x7a, 0xaa \ } \ } @@ -2451,19 +2451,17 @@ class nsIDocument : public nsINode, /** * Note a ChannelEventQueue which has been suspended on the document's behalf * to prevent XHRs from running content scripts while event handling is * suppressed. The document is responsible for resuming the queue after * event handling is unsuppressed. */ void AddSuspendedChannelEventQueue(mozilla::net::ChannelEventQueue* aQueue); - void SetHasDelayedRefreshEvent() { - mHasDelayedRefreshEvent = true; - } + void SetHasDelayedRefreshEvent() { mHasDelayedRefreshEvent = true; } /** * Increment https://html.spec.whatwg.org/#ignore-destructive-writes-counter */ void IncrementIgnoreDestructiveWritesCounter() { ++mIgnoreDestructiveWritesCounter; }
--- a/dom/clients/manager/ClientHandle.cpp +++ b/dom/clients/manager/ClientHandle.cpp @@ -134,17 +134,16 @@ RefPtr<ClientStatePromise> ClientHandle: outerPromise->Reject(aResult.get_nsresult(), __func__); }); return outerPromise.forget(); } RefPtr<GenericPromise> ClientHandle::PostMessage( StructuredCloneData& aData, const ServiceWorkerDescriptor& aSource) { - if (IsShutdown()) { return GenericPromise::CreateAndReject(NS_ERROR_DOM_INVALID_STATE_ERR, __func__); } ClientPostMessageArgs args; args.serviceWorker() = aSource.ToIPC();
--- a/dom/clients/manager/ClientManagerService.cpp +++ b/dom/clients/manager/ClientManagerService.cpp @@ -248,17 +248,16 @@ void ClientManagerService::RemoveManager AssertIsOnBackgroundThread(); MOZ_DIAGNOSTIC_ASSERT(aManager); DebugOnly<bool> removed = mManagerList.RemoveElement(aManager); MOZ_ASSERT(removed); } RefPtr<ClientOpPromise> ClientManagerService::Navigate( const ClientNavigateArgs& aArgs) { - ClientSourceParent* source = FindSource(aArgs.target().id(), aArgs.target().principalInfo()); if (!source) { return ClientOpPromise::CreateAndReject(NS_ERROR_FAILURE, __func__); } PClientManagerParent* manager = source->Manager(); MOZ_DIAGNOSTIC_ASSERT(manager);
--- a/dom/clients/manager/ClientSource.cpp +++ b/dom/clients/manager/ClientSource.cpp @@ -614,17 +614,16 @@ RefPtr<ClientOpPromise> ClientSource::Cl }) ->Track(*holder); return outerPromise.forget(); } RefPtr<ClientOpPromise> ClientSource::GetInfoAndState( const ClientGetInfoAndStateArgs& aArgs) { - ClientState state; nsresult rv = SnapshotState(&state); if (NS_FAILED(rv)) { return ClientOpPromise::CreateAndReject(rv, __func__); } return ClientOpPromise::CreateAndResolve( ClientInfoAndState(mClientInfo.ToIPC(), state.ToIPC()), __func__);
--- a/dom/events/EventStateManager.cpp +++ b/dom/events/EventStateManager.cpp @@ -338,22 +338,23 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION( NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIObserver) NS_INTERFACE_MAP_ENTRY(nsIObserver) NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) NS_INTERFACE_MAP_END NS_IMPL_CYCLE_COLLECTING_ADDREF(EventStateManager) NS_IMPL_CYCLE_COLLECTING_RELEASE(EventStateManager) -NS_IMPL_CYCLE_COLLECTION( - EventStateManager, mCurrentTargetContent, mGestureDownContent, - mGestureDownFrameOwner, mLastLeftMouseDownContent, - mLastMiddleMouseDownContent, mLastRightMouseDownContent, mActiveContent, - mHoverContent, mURLTargetContent, mMouseEnterLeaveHelper, - mPointersEnterLeaveHelper, mDocument, mIMEContentObserver, mAccessKeys) +NS_IMPL_CYCLE_COLLECTION(EventStateManager, mCurrentTargetContent, + mGestureDownContent, mGestureDownFrameOwner, + mLastLeftMouseDownContent, mLastMiddleMouseDownContent, + mLastRightMouseDownContent, mActiveContent, + mHoverContent, mURLTargetContent, + mMouseEnterLeaveHelper, mPointersEnterLeaveHelper, + mDocument, mIMEContentObserver, mAccessKeys) void EventStateManager::ReleaseCurrentIMEContentObserver() { if (mIMEContentObserver) { mIMEContentObserver->DisconnectFromEventStateManager(); } mIMEContentObserver = nullptr; } @@ -2947,18 +2948,17 @@ nsresult EventStateManager::PostHandleEv HandleCrossProcessEvent(aEvent, aStatus); // NOTE: the above call may have destroyed aTargetFrame, please use // mCurrentTarget henceforth. This is to avoid using it accidentally: aTargetFrame = nullptr; // Most of the events we handle below require a frame. // Add special cases here. if (!mCurrentTarget && aEvent->mMessage != eMouseUp && - aEvent->mMessage != eMouseDown && - aEvent->mMessage != eDragEnter && + aEvent->mMessage != eMouseDown && aEvent->mMessage != eDragEnter && aEvent->mMessage != eDragOver) { return NS_OK; } // Keep the prescontext alive, we might need it after event dispatch RefPtr<nsPresContext> presContext = aPresContext; nsresult ret = NS_OK; @@ -4604,52 +4604,52 @@ nsresult EventStateManager::SetClickCoun } switch (aEvent->button) { case WidgetMouseEvent::eLeftButton: if (aEvent->mMessage == eMouseDown) { mLastLeftMouseDownContent = mouseContent; } else if (aEvent->mMessage == eMouseUp) { aEvent->mClickTarget = - nsContentUtils::GetCommonAncestorUnderInteractiveContent( - mouseContent, mLastLeftMouseDownContent); + nsContentUtils::GetCommonAncestorUnderInteractiveContent( + mouseContent, mLastLeftMouseDownContent); if (aEvent->mClickTarget) { aEvent->mClickCount = mLClickCount; mLClickCount = 0; } else { aEvent->mClickCount = 0; } mLastLeftMouseDownContent = nullptr; } break; case WidgetMouseEvent::eMiddleButton: if (aEvent->mMessage == eMouseDown) { mLastMiddleMouseDownContent = mouseContent; } else if (aEvent->mMessage == eMouseUp) { aEvent->mClickTarget = - nsContentUtils::GetCommonAncestorUnderInteractiveContent( - mouseContent, mLastMiddleMouseDownContent); - if (aEvent->mClickTarget) { + nsContentUtils::GetCommonAncestorUnderInteractiveContent( + mouseContent, mLastMiddleMouseDownContent); + if (aEvent->mClickTarget) { aEvent->mClickCount = mMClickCount; mMClickCount = 0; } else { aEvent->mClickCount = 0; } mLastMiddleMouseDownContent = nullptr; } break; case WidgetMouseEvent::eRightButton: if (aEvent->mMessage == eMouseDown) { mLastRightMouseDownContent = mouseContent; } else if (aEvent->mMessage == eMouseUp) { aEvent->mClickTarget = - nsContentUtils::GetCommonAncestorUnderInteractiveContent( - mouseContent, mLastRightMouseDownContent); + nsContentUtils::GetCommonAncestorUnderInteractiveContent( + mouseContent, mLastRightMouseDownContent); if (aEvent->mClickTarget) { aEvent->mClickCount = mRClickCount; mRClickCount = 0; } else { aEvent->mClickCount = 0; } mLastRightMouseDownContent = nullptr; } @@ -4749,17 +4749,17 @@ nsresult EventStateManager::PostHandleMo MOZ_ASSERT(aStatus); nsCOMPtr<nsIPresShell> presShell = mPresContext->GetPresShell(); if (!presShell) { return NS_OK; } nsCOMPtr<nsIContent> clickTarget = - do_QueryInterface(aMouseUpEvent->mClickTarget); + do_QueryInterface(aMouseUpEvent->mClickTarget); NS_ENSURE_STATE(clickTarget); // Fire click events if the event target is still available. // Note that do not include the eMouseUp event's status since we ignore it // for compatibility with the other browsers. nsEventStatus status = nsEventStatus_eIgnore; nsresult rv = DispatchClickEvents(presShell, aMouseUpEvent, &status, clickTarget, aOverrideClickTarget);
--- a/dom/file/MutableBlobStorage.cpp +++ b/dom/file/MutableBlobStorage.cpp @@ -502,33 +502,33 @@ bool MutableBlobStorage::ShouldBeTempora bool MutableBlobStorage::MaybeCreateTemporaryFile( const MutexAutoLock& aProofOfLock) { mStorageState = eWaitingForTemporaryFile; if (!NS_IsMainThread()) { RefPtr<MutableBlobStorage> self = this; nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction( - "MutableBlobStorage::MaybeCreateTemporaryFile", - [self]() { + "MutableBlobStorage::MaybeCreateTemporaryFile", [self]() { MutexAutoLock lock(self->mMutex); self->MaybeCreateTemporaryFileOnMainThread(lock); if (!self->mActor) { self->ErrorPropagated(NS_ERROR_FAILURE); } }); EventTarget()->Dispatch(r.forget(), NS_DISPATCH_NORMAL); return true; } MaybeCreateTemporaryFileOnMainThread(aProofOfLock); return !!mActor; } -void MutableBlobStorage::MaybeCreateTemporaryFileOnMainThread(const MutexAutoLock& aProofOfLock) { +void MutableBlobStorage::MaybeCreateTemporaryFileOnMainThread( + const MutexAutoLock& aProofOfLock) { MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(!mActor); mozilla::ipc::PBackgroundChild* actorChild = mozilla::ipc::BackgroundChild::GetOrCreateForCurrentThread(); if (NS_WARN_IF(!actorChild)) { return; }
--- a/dom/html/HTMLButtonElement.cpp +++ b/dom/html/HTMLButtonElement.cpp @@ -164,20 +164,20 @@ void HTMLButtonElement::GetEventTargetPa return; } // Track whether we're in the outermost Dispatch invocation that will // cause activation of the input. That is, if we're a click event, or a // DOMActivate that was dispatched directly, this will be set, but if we're // a DOMActivate dispatched from click handling, it will not be set. WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent(); - bool outerActivateEvent = ((mouseEvent && mouseEvent->IsLeftClickEvent()) || - (aVisitor.mEvent->mMessage == eLegacyDOMActivate && - !mInInternalActivate && - aVisitor.mEvent->mOriginalTarget == this)); + bool outerActivateEvent = + ((mouseEvent && mouseEvent->IsLeftClickEvent()) || + (aVisitor.mEvent->mMessage == eLegacyDOMActivate && + !mInInternalActivate && aVisitor.mEvent->mOriginalTarget == this)); if (outerActivateEvent) { aVisitor.mItemFlags |= NS_OUTER_ACTIVATE_EVENT; if (mType == NS_FORM_BUTTON_SUBMIT && mForm && !aVisitor.mEvent->mFlags.mMultiplePreActionsPrevented) { aVisitor.mEvent->mFlags.mMultiplePreActionsPrevented = true; aVisitor.mItemFlags |= NS_IN_SUBMIT_CLICK; // tell the form that we are about to enter a click handler.
--- a/dom/html/HTMLInputElement.cpp +++ b/dom/html/HTMLInputElement.cpp @@ -130,20 +130,20 @@ namespace dom { // First bits are needed for the control type. #define NS_OUTER_ACTIVATE_EVENT (1 << 9) #define NS_ORIGINAL_CHECKED_VALUE (1 << 10) #define NS_NO_CONTENT_DISPATCH (1 << 11) #define NS_ORIGINAL_INDETERMINATE_VALUE (1 << 12) #define NS_PRE_HANDLE_BLUR_EVENT (1 << 13) #define NS_PRE_HANDLE_INPUT_EVENT (1 << 14) #define NS_IN_SUBMIT_CLICK (1 << 15) -#define NS_CONTROL_TYPE(bits) \ - ((bits) & ~(NS_OUTER_ACTIVATE_EVENT | NS_ORIGINAL_CHECKED_VALUE | \ - NS_NO_CONTENT_DISPATCH | NS_ORIGINAL_INDETERMINATE_VALUE | \ - NS_PRE_HANDLE_BLUR_EVENT | NS_PRE_HANDLE_INPUT_EVENT | \ +#define NS_CONTROL_TYPE(bits) \ + ((bits) & ~(NS_OUTER_ACTIVATE_EVENT | NS_ORIGINAL_CHECKED_VALUE | \ + NS_NO_CONTENT_DISPATCH | NS_ORIGINAL_INDETERMINATE_VALUE | \ + NS_PRE_HANDLE_BLUR_EVENT | NS_PRE_HANDLE_INPUT_EVENT | \ NS_IN_SUBMIT_CLICK)) // whether textfields should be selected once focused: // -1: no, 1: yes, 0: uninitialized static int32_t gSelectTextFieldOnFocus; UploadLastDir* HTMLInputElement::gUploadLastDir; static const nsAttrValue::EnumTable kInputTypeTable[] = {
--- a/dom/html/HTMLTrackElement.cpp +++ b/dom/html/HTMLTrackElement.cpp @@ -300,17 +300,17 @@ void HTMLTrackElement::LoadResource(RefP nsIDocument* doc = OwnerDoc(); if (!doc) { return; } // 9. End the synchronous section, continuing the remaining steps in parallel. nsCOMPtr<nsIRunnable> runnable = NS_NewRunnableFunction( "dom::HTMLTrackElement::LoadResource", - [ self = RefPtr<HTMLTrackElement>(this), uri, secFlags ]() { + [self = RefPtr<HTMLTrackElement>(this), uri, secFlags]() { if (!self->mListener) { // Shutdown got called, abort. return; } nsCOMPtr<nsIChannel> channel; nsCOMPtr<nsILoadGroup> loadGroup = self->OwnerDoc()->GetDocumentLoadGroup(); nsresult rv = NS_NewChannel(
--- a/dom/ipc/DocShellMessageUtils.cpp +++ b/dom/ipc/DocShellMessageUtils.cpp @@ -6,23 +6,26 @@ #include "mozilla/dom/DocShellMessageUtils.h" #include "nsISerializable.h" #include "nsSerializationHelper.h" namespace mozilla { namespace ipc { -void IPDLParamTraits<nsDocShellLoadState>::Write(IPC::Message* aMsg, IProtocol* aActor, nsDocShellLoadState* aParam) { +void IPDLParamTraits<nsDocShellLoadState>::Write(IPC::Message* aMsg, + IProtocol* aActor, + nsDocShellLoadState* aParam) { MOZ_RELEASE_ASSERT(aParam); WriteIPDLParam(aMsg, aActor, aParam->Serialize()); } -bool IPDLParamTraits<nsDocShellLoadState>::Read(const IPC::Message* aMsg, PickleIterator* aIter, - IProtocol* aActor, RefPtr<nsDocShellLoadState>* aResult) { +bool IPDLParamTraits<nsDocShellLoadState>::Read( + const IPC::Message* aMsg, PickleIterator* aIter, IProtocol* aActor, + RefPtr<nsDocShellLoadState>* aResult) { DocShellLoadStateInit loadState; if (!ReadIPDLParam(aMsg, aIter, aActor, &loadState)) { return false; } // Assert if we somehow don't have a URI in our IPDL type, because we can't // construct anything out of it. This mimics the assertion in the constructor // for nsDocShellLoadState, but makes it clearer that the
--- a/dom/ipc/DocShellMessageUtils.h +++ b/dom/ipc/DocShellMessageUtils.h @@ -11,17 +11,18 @@ #include "nsCOMPtr.h" #include "nsDocShellLoadState.h" namespace mozilla { namespace ipc { template <> struct IPDLParamTraits<nsDocShellLoadState> { - static void Write(IPC::Message* aMsg, IProtocol* aActor, nsDocShellLoadState* aParam); + static void Write(IPC::Message* aMsg, IProtocol* aActor, + nsDocShellLoadState* aParam); static bool Read(const IPC::Message* aMsg, PickleIterator* aIter, IProtocol* aActor, RefPtr<nsDocShellLoadState>* aResult); }; } // namespace ipc } // namespace mozilla #endif // mozilla_dom_docshell_message_utils_h__
--- a/dom/localstorage/ActorsParent.cpp +++ b/dom/localstorage/ActorsParent.cpp @@ -239,20 +239,18 @@ const uint32_t kShadowJournalSizeLimit = bool IsOnConnectionThread(); void AssertIsOnConnectionThread(); /******************************************************************************* * SQLite functions ******************************************************************************/ -int32_t -MakeSchemaVersion(uint32_t aMajorSchemaVersion, - uint32_t aMinorSchemaVersion) -{ +int32_t MakeSchemaVersion(uint32_t aMajorSchemaVersion, + uint32_t aMinorSchemaVersion) { return int32_t((aMajorSchemaVersion << 4) + aMinorSchemaVersion); } nsCString GetArchivedOriginHashKey(const nsACString& aOriginSuffix, const nsACString& aOriginNoSuffix) { return aOriginSuffix + NS_LITERAL_CSTRING(":") + aOriginNoSuffix; } @@ -288,19 +286,17 @@ nsresult CreateTables(mozIStorageConnect rv = aConnection->SetSchemaVersion(kSQLiteSchemaVersion); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } return NS_OK; } -nsresult -UpgradeSchemaFrom1_0To2_0(mozIStorageConnection* aConnection) -{ +nsresult UpgradeSchemaFrom1_0To2_0(mozIStorageConnection* aConnection) { AssertIsOnIOThread(); MOZ_ASSERT(aConnection); nsresult rv = aConnection->ExecuteSimpleSQL(NS_LITERAL_CSTRING( "ALTER TABLE database ADD COLUMN usage INTEGER NOT NULL DEFAULT 0;")); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } @@ -1017,17 +1013,17 @@ nsresult DetachShadowDatabase(mozIStorag nsresult GetUsageFile(const nsAString& aDirectoryPath, nsIFile** aUsageFile) { MOZ_ASSERT(IsOnIOThread() || IsOnConnectionThread()); MOZ_ASSERT(!aDirectoryPath.IsEmpty()); MOZ_ASSERT(aUsageFile); nsCOMPtr<nsIFile> usageFile; nsresult rv = - NS_NewLocalFile(aDirectoryPath, false, getter_AddRefs(usageFile)); + NS_NewLocalFile(aDirectoryPath, false, getter_AddRefs(usageFile)); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } rv = usageFile->Append(NS_LITERAL_STRING(USAGE_FILE_NAME)); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } @@ -1039,17 +1035,17 @@ nsresult GetUsageFile(const nsAString& a nsresult GetUsageJournalFile(const nsAString& aDirectoryPath, nsIFile** aUsageJournalFile) { MOZ_ASSERT(IsOnIOThread() || IsOnConnectionThread()); MOZ_ASSERT(!aDirectoryPath.IsEmpty()); MOZ_ASSERT(aUsageJournalFile); nsCOMPtr<nsIFile> usageJournalFile; nsresult rv = - NS_NewLocalFile(aDirectoryPath, false, getter_AddRefs(usageJournalFile)); + NS_NewLocalFile(aDirectoryPath, false, getter_AddRefs(usageJournalFile)); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } rv = usageJournalFile->Append(NS_LITERAL_STRING(USAGE_JOURNAL_FILE_NAME)); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } @@ -2887,20 +2883,19 @@ nsresult GetUsage(mozIStorageConnection* "AND originAttributes = :originAttributes;"), getter_AddRefs(stmt)); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } rv = aArchivedOriginScope->BindToStatement(stmt); } else { - rv = aConnection->CreateStatement( - NS_LITERAL_CSTRING("SELECT usage " - "FROM database"), - getter_AddRefs(stmt)); + rv = aConnection->CreateStatement(NS_LITERAL_CSTRING("SELECT usage " + "FROM database"), + getter_AddRefs(stmt)); } if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } bool hasResult; rv = stmt->ExecuteStep(&hasResult); if (NS_WARN_IF(NS_FAILED(rv))) { @@ -3387,20 +3382,19 @@ nsresult WriteOptimizer::PerformWrites(C return rv; } rv = stmt->Execute(); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } - rv = aConnection->GetCachedStatement( - NS_LITERAL_CSTRING("SELECT usage " - "FROM database"), - &stmt); + rv = aConnection->GetCachedStatement(NS_LITERAL_CSTRING("SELECT usage " + "FROM database"), + &stmt); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } bool hasResult; rv = stmt->ExecuteStep(&hasResult); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; @@ -4040,21 +4034,21 @@ nsresult Connection::FlushOp::DoDatastor shadowDatabaseLock.reset(); } rv = usageJournalFile->Remove(false); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } - RefPtr<Runnable> runnable = NS_NewRunnableFunction( - "dom::localstorage::UpdateUsageRunnable", - [origin = mConnection->Origin(), usage]() { - UpdateUsageForOrigin(origin, usage); - }); + RefPtr<Runnable> runnable = + NS_NewRunnableFunction("dom::localstorage::UpdateUsageRunnable", + [origin = mConnection->Origin(), usage]() { + UpdateUsageForOrigin(origin, usage); + }); MOZ_ALWAYS_SUCCEEDS( quotaManager->IOThread()->Dispatch(runnable, NS_DISPATCH_NORMAL)); return NS_OK; } nsresult Connection::CloseOp::DoDatastoreWork() { @@ -4109,19 +4103,18 @@ void ConnectionThread::AssertIsOnConnect already_AddRefed<Connection> ConnectionThread::CreateConnection( const nsACString& aOrigin, const nsAString& aDirectoryPath, nsAutoPtr<ArchivedOriginScope>&& aArchivedOriginScope) { AssertIsOnOwningThread(); MOZ_ASSERT(!aOrigin.IsEmpty()); MOZ_ASSERT(!mConnections.GetWeak(aOrigin)); - RefPtr<Connection> connection = - new Connection(this, aOrigin, aDirectoryPath, - std::move(aArchivedOriginScope)); + RefPtr<Connection> connection = new Connection( + this, aOrigin, aDirectoryPath, std::move(aArchivedOriginScope)); mConnections.Put(aOrigin, connection); return connection.forget(); } void ConnectionThread::Shutdown() { AssertIsOnOwningThread(); MOZ_ASSERT(mThread);
--- a/dom/localstorage/LSObject.cpp +++ b/dom/localstorage/LSObject.cpp @@ -28,32 +28,31 @@ class RequestHelper; StaticMutex gRequestHelperMutex; nsISerialEventTarget* gSyncLoopEventTarget = nullptr; /** * Tracks whether a sync message has been received to the main thread but not * yet processed. Used by RequestHelper logic to abort effectively synchronous * calls if a sync IPC message is received which could result in deadlock. * This is a boolean because, by definition, the parent can only send one sync * message to the child at a time. -*/ + */ bool gPendingSyncMessage = false; /* * Wrapper for the pushed event queue. The wrapper automatically dispatches * runnables to the main thread when pushed event queue is no longer active. * This exists because the event loop spinning can be aborted. */ class NestedEventTargetWrapper final : public nsISerialEventTarget { nsCOMPtr<nsISerialEventTarget> mNestedEventTarget; bool mDisconnected; public: explicit NestedEventTargetWrapper(nsISerialEventTarget* aNestedEventTarget) - : mNestedEventTarget(aNestedEventTarget) - , mDisconnected(false) {} + : mNestedEventTarget(aNestedEventTarget), mDisconnected(false) {} private: ~NestedEventTargetWrapper() {} NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIEVENTTARGET_FULL }; @@ -339,17 +338,17 @@ void LSObject::OnSyncMessageReceived() { gPendingSyncMessage = true; } if (target) { RefPtr<Runnable> runnable = NS_NewRunnableFunction("LSObject::CheckFlagRunnable", []() {}); MOZ_ALWAYS_SUCCEEDS( - target->Dispatch(runnable.forget(), NS_DISPATCH_NORMAL)); + target->Dispatch(runnable.forget(), NS_DISPATCH_NORMAL)); } } // static void LSObject::OnSyncMessageHandled() { StaticMutexAutoLock lock(gRequestHelperMutex); gPendingSyncMessage = false; } @@ -896,24 +895,26 @@ void LSObject::LastRelease() { DropDatabase(); } NS_IMPL_ISUPPORTS(NestedEventTargetWrapper, nsIEventTarget, nsISerialEventTarget); NS_IMETHODIMP_(bool) NestedEventTargetWrapper::IsOnCurrentThreadInfallible() { - MOZ_CRASH("IsOnCurrentThreadInfallible should never be called on " - "NestedEventTargetWrapper"); + MOZ_CRASH( + "IsOnCurrentThreadInfallible should never be called on " + "NestedEventTargetWrapper"); } NS_IMETHODIMP NestedEventTargetWrapper::IsOnCurrentThread(bool* aResult) { - MOZ_CRASH("IsOnCurrentThread should never be called on " - "NestedEventTargetWrapper"); + MOZ_CRASH( + "IsOnCurrentThread should never be called on " + "NestedEventTargetWrapper"); } NS_IMETHODIMP NestedEventTargetWrapper::Dispatch(already_AddRefed<nsIRunnable> aEvent, uint32_t aFlags) { MOZ_ASSERT(mNestedEventTarget); if (mDisconnected) { @@ -937,25 +938,27 @@ NestedEventTargetWrapper::Dispatch(alrea } return NS_OK; } NS_IMETHODIMP NestedEventTargetWrapper::DispatchFromScript(nsIRunnable* aEvent, uint32_t aFlags) { - MOZ_CRASH("DispatchFromScript should never be called on " - "NestedEventTargetWrapper"); + MOZ_CRASH( + "DispatchFromScript should never be called on " + "NestedEventTargetWrapper"); } NS_IMETHODIMP NestedEventTargetWrapper::DelayedDispatch(already_AddRefed<nsIRunnable> aEvent, uint32_t aDelayMs) { - MOZ_CRASH("DelayedDispatch should never be called on " - "NestedEventTargetWrapper"); + MOZ_CRASH( + "DelayedDispatch should never be called on " + "NestedEventTargetWrapper"); } nsresult RequestHelper::StartAndReturnResponse(LSRequestResponse& aResponse) { AssertIsOnOwningThread(); // Normally, we would use the standard way of blocking the thread using // a monitor. // The problem is that BackgroundChild::GetOrCreateForCurrentThread() @@ -978,17 +981,17 @@ nsresult RequestHelper::StartAndReturnRe mNestedEventTarget = queue->PushEventQueue(); MOZ_ASSERT(mNestedEventTarget); auto autoPopEventQueue = mozilla::MakeScopeExit( [&] { queue->PopEventQueue(mNestedEventTarget); }); mNestedEventTargetWrapper = - new NestedEventTargetWrapper(mNestedEventTarget); + new NestedEventTargetWrapper(mNestedEventTarget); nsCOMPtr<nsIEventTarget> domFileThread = IPCBlobInputStreamThread::GetOrCreate(); if (NS_WARN_IF(!domFileThread)) { return NS_ERROR_FAILURE; } nsresult rv;
--- a/gfx/2d/Factory.cpp +++ b/gfx/2d/Factory.cpp @@ -1072,17 +1072,18 @@ void CriticalLogger::OutputMessage(const void CriticalLogger::CrashAction(LogReason aReason) { if (Factory::GetLogForwarder()) { Factory::GetLogForwarder()->CrashAction(aReason); } } #ifdef WIN32 void LogWStr(const wchar_t* aWStr, std::stringstream& aOut) { - int n = WideCharToMultiByte(CP_ACP, 0, aWStr, -1, nullptr, 0, nullptr, nullptr); + int n = + WideCharToMultiByte(CP_ACP, 0, aWStr, -1, nullptr, 0, nullptr, nullptr); if (n > 1) { std::vector<char> str(n); WideCharToMultiByte(CP_ACP, 0, aWStr, -1, str.data(), n, nullptr, nullptr); aOut << str.data(); } } #endif
--- a/gfx/2d/ScaledFontDWrite.cpp +++ b/gfx/2d/ScaledFontDWrite.cpp @@ -347,62 +347,71 @@ static bool GetDWriteFamilyName(const Re static void GetFontFileNames(RefPtr<IDWriteFontFace> aFontFace, std::vector<WCHAR>& aFamilyName, std::vector<WCHAR>& aFileNames) { MOZ_ASSERT(aFamilyName.size() >= 1 && aFamilyName.back() == 0); UINT32 numFiles; HRESULT hr = aFontFace->GetFiles(&numFiles, nullptr); if (FAILED(hr)) { - gfxCriticalNote << "Failed getting file count for font \"" << &aFamilyName[0] << "\""; + gfxCriticalNote << "Failed getting file count for font \"" + << &aFamilyName[0] << "\""; return; } else if (!numFiles) { gfxCriticalNote << "No files found for font \"" << &aFamilyName[0] << "\""; return; } std::vector<RefPtr<IDWriteFontFile>> files; files.resize(numFiles); hr = aFontFace->GetFiles(&numFiles, getter_AddRefs(files[0])); if (FAILED(hr)) { - gfxCriticalNote << "Failed getting files for font \"" << &aFamilyName[0] << "\""; + gfxCriticalNote << "Failed getting files for font \"" << &aFamilyName[0] + << "\""; return; } - for(auto& file : files) { + for (auto& file : files) { const void* key; UINT32 keySize; hr = file->GetReferenceKey(&key, &keySize); if (FAILED(hr)) { - gfxCriticalNote << "Failed getting file ref key for font \"" << &aFamilyName[0] << "\""; + gfxCriticalNote << "Failed getting file ref key for font \"" + << &aFamilyName[0] << "\""; return; } RefPtr<IDWriteFontFileLoader> loader; hr = file->GetLoader(getter_AddRefs(loader)); if (FAILED(hr)) { - gfxCriticalNote << "Failed getting file loader for font \"" << &aFamilyName[0] << "\""; + gfxCriticalNote << "Failed getting file loader for font \"" + << &aFamilyName[0] << "\""; return; } RefPtr<IDWriteLocalFontFileLoader> localLoader; - loader->QueryInterface(__uuidof(IDWriteLocalFontFileLoader), (void**)getter_AddRefs(localLoader)); + loader->QueryInterface(__uuidof(IDWriteLocalFontFileLoader), + (void**)getter_AddRefs(localLoader)); if (!localLoader) { - gfxCriticalNote << "Failed querying loader interface for font \"" << &aFamilyName[0] << "\""; + gfxCriticalNote << "Failed querying loader interface for font \"" + << &aFamilyName[0] << "\""; return; } UINT32 pathLen; hr = localLoader->GetFilePathLengthFromKey(key, keySize, &pathLen); if (FAILED(hr)) { - gfxCriticalNote << "Failed getting path length for font \"" << &aFamilyName[0] << "\""; + gfxCriticalNote << "Failed getting path length for font \"" + << &aFamilyName[0] << "\""; return; } size_t offset = aFileNames.size(); aFileNames.resize(offset + pathLen + 1); - hr = localLoader->GetFilePathFromKey(key, keySize, &aFileNames[offset], pathLen + 1); + hr = localLoader->GetFilePathFromKey(key, keySize, &aFileNames[offset], + pathLen + 1); if (FAILED(hr)) { aFileNames.resize(offset); - gfxCriticalNote << "Failed getting path for font \"" << &aFamilyName[0] << "\""; + gfxCriticalNote << "Failed getting path for font \"" << &aFamilyName[0] + << "\""; return; } MOZ_ASSERT(aFileNames.back() == 0); DWORD attribs = GetFileAttributesW(&aFileNames[offset]); if (attribs == INVALID_FILE_ATTRIBUTES) { gfxCriticalNote << "sending font family \"" << &aFamilyName[0] << "\" with invalid file \"" << &aFileNames[offset] << "\"";
--- a/gfx/layers/TextureSourceProvider.h +++ b/gfx/layers/TextureSourceProvider.h @@ -81,18 +81,18 @@ class TextureSourceProvider { virtual void Destroy(); void FlushPendingNotifyNotUsed(); // If this provider is also a Compositor, return the compositor. Otherwise // return null. virtual Compositor* AsCompositor() { return nullptr; } - // If this provider is also a CompositorOGL, return the compositor. Otherwise return - // nullptr. + // If this provider is also a CompositorOGL, return the compositor. Otherwise + // return nullptr. virtual CompositorOGL* AsCompositorOGL() { return nullptr; } #ifdef XP_WIN // On Windows, if this provides Direct3D textures, it must expose the device. virtual ID3D11Device* GetD3D11Device() const { return nullptr; } #endif // If this provides OpenGL textures, it must expose the GLContext.
--- a/gfx/layers/apz/src/APZCTreeManager.cpp +++ b/gfx/layers/apz/src/APZCTreeManager.cpp @@ -812,17 +812,18 @@ void APZCTreeManager::NotifyScrollbarDra controller->NotifyAsyncScrollbarDragInitiated(aDragBlockId, aGuid.mScrollId, aDirection); } void APZCTreeManager::NotifyScrollbarDragRejected( const ScrollableLayerGuid& aGuid) const { RefPtr<GeckoContentController> controller = GetContentController(aGuid.mLayersId); - MOZ_ASSERT(controller); // If you hit this crash and have STR, please file a bug! + // If you hit this crash and have STR, please file a bug! + MOZ_ASSERT(controller); if (controller) { controller->NotifyAsyncScrollbarDragRejected(aGuid.mScrollId); } } void APZCTreeManager::NotifyAutoscrollRejected( const ScrollableLayerGuid& aGuid) const { RefPtr<GeckoContentController> controller =
--- a/gfx/layers/opengl/TextureHostOGL.cpp +++ b/gfx/layers/opengl/TextureHostOGL.cpp @@ -103,30 +103,27 @@ static gl::TextureImage::Flags FlagsToGL return static_cast<gl::TextureImage::Flags>(result); } TextureImageTextureSourceOGL::TextureImageTextureSourceOGL( CompositorOGL* aCompositor, TextureFlags aFlags) : mGL(aCompositor->gl()), mCompositor(aCompositor), mFlags(aFlags), - mIterating(false) -{ + mIterating(false) { if (mCompositor) { mCompositor->RegisterTextureSource(this); } } -TextureImageTextureSourceOGL::~TextureImageTextureSourceOGL() -{ +TextureImageTextureSourceOGL::~TextureImageTextureSourceOGL() { DeallocateDeviceData(); } -void TextureImageTextureSourceOGL::DeallocateDeviceData() -{ +void TextureImageTextureSourceOGL::DeallocateDeviceData() { mTexImage = nullptr; mGL = nullptr; if (mCompositor) { mCompositor->UnregisterTextureSource(this); } SetUpdateSerial(0); } @@ -203,17 +200,18 @@ void TextureImageTextureSourceOGL::Ensur void TextureImageTextureSourceOGL::SetTextureSourceProvider( TextureSourceProvider* aProvider) { GLContext* newGL = aProvider ? aProvider->GetGLContext() : nullptr; if (!newGL || mGL != newGL) { DeallocateDeviceData(); } mGL = newGL; - CompositorOGL* compositor = aProvider ? aProvider->AsCompositorOGL() : nullptr; + CompositorOGL* compositor = + aProvider ? aProvider->AsCompositorOGL() : nullptr; if (mCompositor != compositor) { if (mCompositor) { mCompositor->UnregisterTextureSource(this); } if (compositor) { compositor->RegisterTextureSource(this); } mCompositor = compositor;
--- a/gfx/layers/wr/WebRenderBridgeChild.cpp +++ b/gfx/layers/wr/WebRenderBridgeChild.cpp @@ -225,17 +225,19 @@ static void WriteFontDescriptor(const ui *sink->mFontKey = sink->mWrBridge->GetNextFontKey(); #ifdef XP_WIN // FIXME: Debugging kluge for bug 1455848. Remove once debugged! nsTArray<uint8_t> data; data.AppendElements(aData, aLength); sink->mWrBridge->SendValidateFontDescriptor(data); - aLength = uint32_t(wcsnlen_s((const wchar_t*)aData, aLength / sizeof(wchar_t)) * sizeof(wchar_t)); + aLength = + uint32_t(wcsnlen_s((const wchar_t*)aData, aLength / sizeof(wchar_t)) * + sizeof(wchar_t)); #endif sink->mResources->AddFontDescriptor( *sink->mFontKey, Range<uint8_t>(const_cast<uint8_t*>(aData), aLength), aIndex); } void WebRenderBridgeChild::PushGlyphs(
--- a/gfx/layers/wr/WebRenderBridgeParent.cpp +++ b/gfx/layers/wr/WebRenderBridgeParent.cpp @@ -712,35 +712,35 @@ mozilla::ipc::IPCResult WebRenderBridgeP nsTArray<uint8_t> data(aData); wchar_t* family = (wchar_t*)data.Elements(); size_t remaining = data.Length() / sizeof(wchar_t); size_t familyLength = wcsnlen_s(family, remaining); MOZ_ASSERT(familyLength < remaining && family[familyLength] == 0); remaining -= familyLength + 1; wchar_t* files = family + familyLength + 1; BOOL exists = FALSE; - if (RefPtr<IDWriteFontCollection> systemFonts = Factory::GetDWriteSystemFonts()) { + if (RefPtr<IDWriteFontCollection> systemFonts = + Factory::GetDWriteSystemFonts()) { UINT32 idx; systemFonts->FindFamilyName(family, &idx, &exists); } if (!remaining) { - gfxCriticalNote << (exists ? "found" : "MISSING") - << " font family \"" << family - << "\" has no files!"; + gfxCriticalNote << (exists ? "found" : "MISSING") << " font family \"" + << family << "\" has no files!"; } while (remaining > 0) { size_t fileLength = wcsnlen_s(files, remaining); MOZ_ASSERT(fileLength < remaining && files[fileLength] == 0); DWORD attribs = GetFileAttributesW(files); if (!exists || attribs == INVALID_FILE_ATTRIBUTES) { - gfxCriticalNote << (exists ? "found" : "MISSING") - << " font family \"" << family - << "\" has " << (attribs == INVALID_FILE_ATTRIBUTES ? "INVALID" : "valid") - << " file \"" << files - << "\""; + gfxCriticalNote << (exists ? "found" : "MISSING") << " font family \"" + << family << "\" has " + << (attribs == INVALID_FILE_ATTRIBUTES ? "INVALID" + : "valid") + << " file \"" << files << "\""; } remaining -= fileLength + 1; files += fileLength + 1; } #endif return IPC_OK(); }
--- a/gfx/layers/wr/WebRenderCommandBuilder.cpp +++ b/gfx/layers/wr/WebRenderCommandBuilder.cpp @@ -2224,17 +2224,16 @@ Maybe<wr::WrImageMask> WebRenderCommandB const LayoutDeviceRect& aBounds) { RefPtr<WebRenderMaskData> maskData = CreateOrRecycleWebRenderUserData<WebRenderMaskData>(aMaskItem); if (!maskData) { return Nothing(); } - bool snap; nsRect bounds = aMaskItem->GetBounds(aDisplayListBuilder, &snap); if (bounds.IsEmpty()) { return Nothing(); } const int32_t appUnitsPerDevPixel = aMaskItem->Frame()->PresContext()->AppUnitsPerDevPixel(); @@ -2257,35 +2256,35 @@ Maybe<wr::WrImageMask> WebRenderCommandB nsPoint maskOffset = aMaskItem->ToReferenceFrame() - bounds.TopLeft(); nsRect dirtyRect; if (aMaskItem->IsInvalid(dirtyRect) || !itemRect.IsEqualInterior(maskData->mItemRect) || !(aMaskItem->Frame()->StyleSVGReset()->mMask == maskData->mMaskStyle) || maskOffset != maskData->mMaskOffset || !sameScale) { - IntSize size = itemRect.Size().ToUnknownSize(); std::vector<RefPtr<ScaledFont>> fonts; RefPtr<WebRenderDrawEventRecorder> recorder = - MakeAndAddRef<WebRenderDrawEventRecorder>([&]( - MemStream& aStream, std::vector<RefPtr<ScaledFont>>& aScaledFonts) { - size_t count = aScaledFonts.size(); - aStream.write((const char*)&count, sizeof(count)); + MakeAndAddRef<WebRenderDrawEventRecorder>( + [&](MemStream& aStream, + std::vector<RefPtr<ScaledFont>>& aScaledFonts) { + size_t count = aScaledFonts.size(); + aStream.write((const char*)&count, sizeof(count)); - for (auto& scaled : aScaledFonts) { - BlobFont font = {mManager->WrBridge()->GetFontKeyForScaledFont( - scaled, &aResources), - scaled}; - aStream.write((const char*)&font, sizeof(font)); - } + for (auto& scaled : aScaledFonts) { + BlobFont font = {mManager->WrBridge()->GetFontKeyForScaledFont( + scaled, &aResources), + scaled}; + aStream.write((const char*)&font, sizeof(font)); + } - fonts = std::move(aScaledFonts); - }); + fonts = std::move(aScaledFonts); + }); RefPtr<DrawTarget> dummyDt = Factory::CreateDrawTarget( BackendType::SKIA, IntSize(1, 1), SurfaceFormat::A8); RefPtr<DrawTarget> dt = Factory::CreateRecordingDrawTarget(recorder, dummyDt, size); RefPtr<gfxContext> context = gfxContext::CreateOrNull(dt); MOZ_ASSERT(context);
--- a/gfx/layers/wr/WebRenderLayerManager.cpp +++ b/gfx/layers/wr/WebRenderLayerManager.cpp @@ -660,17 +660,16 @@ void WebRenderLayerManager::ScheduleComp void WebRenderLayerManager::SetRoot(Layer* aLayer) { // This should never get called MOZ_ASSERT(false); } already_AddRefed<PersistentBufferProvider> WebRenderLayerManager::CreatePersistentBufferProvider( const gfx::IntSize& aSize, gfx::SurfaceFormat aFormat) { - // Ensure devices initialization for canvas 2d. The devices are lazily // initialized with WebRender to reduce memory usage. gfxPlatform::GetPlatform()->EnsureDevicesInitialized(); if (gfxPrefs::PersistentBufferProviderSharedEnabled()) { RefPtr<PersistentBufferProvider> provider = PersistentBufferProviderShared::Create(aSize, aFormat, AsKnowsCompositor());
--- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -912,19 +912,19 @@ void gfxPlatform::Init() { #elif defined(ANDROID) gPlatform = new gfxAndroidPlatform; #else #error "No gfxPlatform implementation available" #endif gPlatform->InitAcceleration(); gPlatform->InitWebRenderConfig(); // When using WebRender, we defer initialization of the D3D11 devices until - // the (rare) cases where they're used. Note that the GPU process where WebRender - // runs doesn't initialize gfxPlatform and performs explicit initialization of - // the bits it needs. + // the (rare) cases where they're used. Note that the GPU process where + // WebRender runs doesn't initialize gfxPlatform and performs explicit + // initialization of the bits it needs. if (!gfxVars::UseWebRender()) { gPlatform->EnsureDevicesInitialized(); } gPlatform->InitOMTPConfig(); if (gfxConfig::IsEnabled(Feature::GPU_PROCESS)) { GPUProcessManager* gpu = GPUProcessManager::Get(); gpu->LaunchGPUProcess();
--- a/gfx/thebes/gfxPlatform.h +++ b/gfx/thebes/gfxPlatform.h @@ -747,17 +747,17 @@ class gfxPlatform : public mozilla::laye // you probably want to use gfxVars::UseWebRender() instead of this static bool WebRenderEnvvarEnabled(); void NotifyFrameStats(nsTArray<mozilla::layers::FrameStats>&& aFrameStats); virtual void OnMemoryPressure( mozilla::layers::MemoryPressureReason aWhy) override; - virtual void EnsureDevicesInitialized() {}; + virtual void EnsureDevicesInitialized(){}; virtual bool DevicesInitialized() { return true; }; protected: gfxPlatform(); virtual ~gfxPlatform(); virtual bool HasBattery() { return true; }
--- a/gfx/thebes/gfxWindowsPlatform.cpp +++ b/gfx/thebes/gfxWindowsPlatform.cpp @@ -1476,21 +1476,17 @@ void gfxWindowsPlatform::InitializeD3D11 void gfxWindowsPlatform::EnsureDevicesInitialized() { if (!mInitializedDevices) { mInitializedDevices = true; InitializeDevices(); UpdateBackendPrefs(); } } -bool -gfxWindowsPlatform::DevicesInitialized() { - - return mInitializedDevices; -} +bool gfxWindowsPlatform::DevicesInitialized() { return mInitializedDevices; } void gfxWindowsPlatform::InitializeDevices() { MOZ_ASSERT(NS_IsMainThread()); if (XRE_IsParentProcess()) { // If we're the UI process, and the GPU process is enabled, then we don't // initialize any DirectX devices. We do leave them enabled in gfxConfig // though. If the GPU process fails to create these devices it will send
--- a/gfx/vr/VRDisplayClient.cpp +++ b/gfx/vr/VRDisplayClient.cpp @@ -150,18 +150,18 @@ void VRDisplayClient::FireGamepadEvents( } // Do not process any further events for removed controllers continue; } // Send events to notify that new controllers are added RefPtr<dom::Gamepad> existing = gamepadManager->GetGamepad(gamepadId, dom::GamepadServiceType::VR); - // ControllerState in OpenVR action-based API gets delay to query btn and axis count. - // So, we need to check if they are more than zero. + // ControllerState in OpenVR action-based API gets delay to query btn and + // axis count. So, we need to check if they are more than zero. if ((lastState.controllerName[0] == '\0' || !existing) && (state.numButtons > 0 || state.numAxes > 0)) { dom::GamepadAdded info(NS_ConvertUTF8toUTF16(state.controllerName), dom::GamepadMappingType::_empty, state.hand, mDisplayInfo.mDisplayID, state.numButtons, state.numAxes, state.numHaptics); dom::GamepadChangeEventBody body(info); dom::GamepadChangeEvent event(gamepadId, dom::GamepadServiceType::VR,
--- a/gfx/vr/service/binding/OpenVRKnucklesBinding.h +++ b/gfx/vr/service/binding/OpenVRKnucklesBinding.h @@ -6,17 +6,18 @@ #ifndef GFX_VR_BLINDING_OPENVRKNUCKLESBINDING_H #define GFX_VR_BLINDING_OPENVRKNUCKLESBINDING_H namespace mozilla { namespace gfx { struct OpenVRKnucklesBinding { - const char* binding = + const char* binding = + // clang-format off "{\n" " \"version\" : \"0.1\", \n" " \"controller_type\" : \"knuckles\", \n" " \"description\" : \"Bindings for Firefox OpenVR for the Knuckles controller\", \n" " \"name\" : \"Firefox bindings for Knuckles Controller\", \n" " \"bindings\" : { \n" " \"/actions/firefox\" : { \n" " \"poses\" : [ \n" @@ -285,14 +286,15 @@ struct OpenVRKnucklesBinding { " }, \n" " \"mode\" : \"trigger\", \n" " \"path\" : \"/user/hand/right/input/finger/pinky\" \n" " } \n" " ]\n" " }\n" " }\n" "}"; + // clang-format on }; -} // namespace mozilla -} // namespace gfx +} // namespace gfx +} // namespace mozilla -#endif // GFX_VR_BLINDING_OPENVRKNUCKLESBINDING_H \ No newline at end of file +#endif // GFX_VR_BLINDING_OPENVRKNUCKLESBINDING_H
--- a/gfx/vr/service/binding/OpenVRViveBinding.h +++ b/gfx/vr/service/binding/OpenVRViveBinding.h @@ -6,17 +6,18 @@ #ifndef GFX_VR_BLINDING_OPENVRVIVEBINDING_H #define GFX_VR_BLINDING_OPENVRVIVEBINDING_H namespace mozilla { namespace gfx { struct OpenVRViveBinding { - const char* binding = + const char* binding = + // clang-format off "{\n" " \"version\" : \"0.1\", \n" " \"controller_type\" : \"vive_controller\", \n" " \"description\" : \"Bindings for Firefox OpenVR for the Vive controller\", \n" " \"name\" : \"Firefox bindings for Vive Controller\", \n" " \"bindings\" : { \n" " \"/actions/firefox\" : { \n" " \"poses\" : [ \n" @@ -159,14 +160,15 @@ struct OpenVRViveBinding { " },\n" " \"mode\" : \"button\", \n" " \"path\" : \"/user/hand/right/input/system\" \n" " } \n" " ]\n" " }\n" " }\n" "}"; + // clang-format on }; -} // namespace mozilla -} // namespace gfx +} // namespace gfx +} // namespace mozilla -#endif // GFX_VR_BLINDING_OPENVRVIVEBINDING_H \ No newline at end of file +#endif // GFX_VR_BLINDING_OPENVRVIVEBINDING_H
--- a/gfx/vr/service/binding/OpenVRWMRBinding.h +++ b/gfx/vr/service/binding/OpenVRWMRBinding.h @@ -5,20 +5,20 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef GFX_VR_BLINDING_OPENVRWMRBINDING_H #define GFX_VR_BLINDING_OPENVRWMRBINDING_H namespace mozilla { namespace gfx { -struct OpenVRWMRBinding -{ - //OpenVRWMRBinding(); +struct OpenVRWMRBinding { + // OpenVRWMRBinding(); const char* binding = + // clang-format off "{\n" " \"version\" : \"0.1\", \n" " \"controller_type\" : \"holographic_controller\", \n" " \"description\" : \"Bindings for Firefox OpenVR for the Windows Mixed Reality controller\", \n" " \"name\" : \"Firefox bindings for Mixed Reality Controller\", \n" " \"bindings\" : { \n" " \"/actions/firefox\" : { \n" " \"poses\" : [ \n" @@ -179,14 +179,15 @@ struct OpenVRWMRBinding " }, \n" " \"mode\" : \"joystick\", \n" " \"path\" : \"/user/hand/right/input/joystick\" \n" " } \n" " ]\n" " }\n" " }\n" "}"; + // clang-format on }; -} // namespace mozilla -} // namespace gfx +} // namespace gfx +} // namespace mozilla -#endif // GFX_VR_BLINDING_OPENVRWMRBINDING_H \ No newline at end of file +#endif // GFX_VR_BLINDING_OPENVRWMRBINDING_H
--- a/gfx/webrender_bindings/RenderThread.cpp +++ b/gfx/webrender_bindings/RenderThread.cpp @@ -320,17 +320,17 @@ static void NotifyDidRender(layers::Comp auto info = aInfo->Raw(); for (uintptr_t i = 0; i < info.epochs.length; i++) { aBridge->NotifyPipelineRendered( info.epochs.data[i].pipeline_id, info.epochs.data[i].epoch, aCompositeStartId, aCompositeStart, aRenderStart, aEnd, &aStats); } - + if (aBridge->GetWrBridge()) { aBridge->GetWrBridge()->CompositeIfNeeded(); } } static void NotifyDidStartRender(layers::CompositorBridgeParent* aBridge) { // Starting a render will change increment mRenderingCount, and potentially // change whether we can allow the bridge to intiate another frame.
--- a/gfx/webrender_bindings/WebRenderAPI.cpp +++ b/gfx/webrender_bindings/WebRenderAPI.cpp @@ -75,19 +75,19 @@ class NewRenderer : public RendererEvent if (!wr_window_new( aWindowId, mSize.width, mSize.height, supportLowPriorityTransactions, gfxPrefs::WebRenderPictureCaching(), compositor->gl(), aRenderThread.ProgramCache() ? aRenderThread.ProgramCache()->Raw() : nullptr, aRenderThread.Shaders() ? aRenderThread.Shaders()->RawShaders() : nullptr, - aRenderThread.ThreadPool().Raw(), - &WebRenderMallocSizeOf, &WebRenderMallocEnclosingSizeOf, - mDocHandle, &wrRenderer, mMaxTextureSize)) { + aRenderThread.ThreadPool().Raw(), &WebRenderMallocSizeOf, + &WebRenderMallocEnclosingSizeOf, mDocHandle, &wrRenderer, + mMaxTextureSize)) { // wr_window_new puts a message into gfxCriticalNote if it returns false return; } MOZ_ASSERT(wrRenderer); RefPtr<RenderThread> thread = &aRenderThread; auto renderer = MakeUnique<RendererOGL>(std::move(thread), std::move(compositor),
--- a/js/public/Id.h +++ b/js/public/Id.h @@ -49,18 +49,20 @@ struct PropertyKey { PropertyKey id; id.asBits = bits; return id; } bool operator==(const PropertyKey& rhs) const { return asBits == rhs.asBits; } bool operator!=(const PropertyKey& rhs) const { return asBits != rhs.asBits; } - MOZ_ALWAYS_INLINE bool isInt() const { return !!(asBits & JSID_TYPE_INT_BIT); } - + MOZ_ALWAYS_INLINE bool isInt() const { + return !!(asBits & JSID_TYPE_INT_BIT); + } + } JS_HAZ_GC_POINTER; } // namespace JS using jsid = JS::PropertyKey; #define JSID_BITS(id) (id.asBits)
--- a/js/public/Promise.h +++ b/js/public/Promise.h @@ -342,11 +342,11 @@ extern JS_PUBLIC_API void InitDispatchTo * enough for cycle collection, which needs to have roots dropped earlier so * that the cycle collector can transitively remove roots for a future GC. For * these and other cases, the set of pending async tasks can be canceled * with this call earlier than JSRuntime destruction. */ extern JS_PUBLIC_API void ShutdownAsyncTasks(JSContext* cx); -} // namespace JS +} // namespace JS -#endif // js_Promise_h +#endif // js_Promise_h
--- a/js/src/gc/Barrier.h +++ b/js/src/gc/Barrier.h @@ -45,19 +45,21 @@ * To understand the pre-barrier, let's consider how incremental GC works. The * GC itself is divided into "slices". Between each slice, JS code is allowed to * run. Each slice should be short so that the user doesn't notice the * interruptions. In our GC, the structure of the slices is as follows: * * 1. ... JS work, which leads to a request to do GC ... * 2. [first GC slice, which performs all root marking and (maybe) more marking] * 3. ... more JS work is allowed to run ... - * 4. [GC mark slice, which runs entirely in GCRuntime::markUntilBudgetExhausted] + * 4. [GC mark slice, which runs entirely in + * GCRuntime::markUntilBudgetExhausted] * 5. ... more JS work ... - * 6. [GC mark slice, which runs entirely in GCRuntime::markUntilBudgetExhausted] + * 6. [GC mark slice, which runs entirely in + * GCRuntime::markUntilBudgetExhausted] * 7. ... more JS work ... * 8. [GC marking finishes; sweeping done non-incrementally; GC is done] * 9. ... JS continues uninterrupted now that GC is finishes ... * * Of course, there may be a different number of slices depending on how much * marking is to be done. * * The danger inherent in this scheme is that the JS code in steps 3, 5, and 7
--- a/js/src/gc/GC.cpp +++ b/js/src/gc/GC.cpp @@ -5111,20 +5111,20 @@ void js::gc::DelayCrossCompartmentGrayMa } obj = NextIncomingCrossCompartmentPointer(obj, false); } MOZ_ASSERT(found); #endif } void GCRuntime::markIncomingCrossCompartmentPointers(MarkColor color) { - gcstats::AutoPhase ap( - stats(), - color == MarkColor::Black ? gcstats::PhaseKind::SWEEP_MARK_INCOMING_BLACK - : gcstats::PhaseKind::SWEEP_MARK_INCOMING_GRAY); + gcstats::AutoPhase ap(stats(), + color == MarkColor::Black + ? gcstats::PhaseKind::SWEEP_MARK_INCOMING_BLACK + : gcstats::PhaseKind::SWEEP_MARK_INCOMING_GRAY); bool unlinkList = color == MarkColor::Gray; for (SweepGroupCompartmentsIter c(rt); !c.done(); c.next()) { MOZ_ASSERT(c->zone()->isGCMarking()); MOZ_ASSERT_IF(color == MarkColor::Gray, c->zone()->isGCMarkingBlackAndGray()); MOZ_ASSERT_IF(c->gcIncomingGrayPointers,
--- a/js/src/gc/GCRuntime.h +++ b/js/src/gc/GCRuntime.h @@ -579,18 +579,17 @@ class GCRuntime { * * ResetIncremental if we "reset" an existing incremental GC, which would * force us to run another cycle or * * Ok otherwise. */ MOZ_MUST_USE IncrementalResult gcCycle(bool nonincrementalByAPI, SliceBudget budget, JS::gcreason::Reason reason); bool shouldRepeatForDeadZone(JS::gcreason::Reason reason); - void incrementalSlice(SliceBudget& budget, - JS::gcreason::Reason reason, + void incrementalSlice(SliceBudget& budget, JS::gcreason::Reason reason, AutoGCSession& session); MOZ_MUST_USE bool shouldCollectNurseryForSlice(bool nonincrementalByAPI, SliceBudget& budget); friend class AutoCallGCCallbacks; void maybeCallGCCallback(JSGCStatus status); void pushZealSelectedObjects();
--- a/js/src/gc/Heap.h +++ b/js/src/gc/Heap.h @@ -234,19 +234,20 @@ class Arena { /* * When recursive marking uses too much stack we delay marking of * arenas and link them into a list for later processing. This * uses the following fields. */ size_t onDelayedMarkingList_ : 1; size_t hasDelayedMarking_ : 1; size_t nextDelayedMarkingArena_ : JS_BITS_PER_WORD - 8 - 1 - 1; - static_assert(ArenaShift >= 8 + 1 + 1, - "Arena::nextDelayedMarkingArena_ packing assumes that ArenaShift has " - "enough bits to cover allocKind and delayed marking state."); + static_assert( + ArenaShift >= 8 + 1 + 1, + "Arena::nextDelayedMarkingArena_ packing assumes that ArenaShift has " + "enough bits to cover allocKind and delayed marking state."); union { /* * For arenas in zones other than the atoms zone, if non-null, points * to an ArenaCellSet that represents the set of cells in this arena * that are in the nursery's store buffer. */ ArenaCellSet* bufferedCells_; @@ -383,19 +384,17 @@ class Arena { } static bool isAligned(uintptr_t thing, size_t thingSize) { /* Things ends at the arena end. */ uintptr_t tailOffset = ArenaSize - (thing & ArenaMask); return tailOffset % thingSize == 0; } - bool onDelayedMarkingList() const { - return onDelayedMarkingList_; - } + bool onDelayedMarkingList() const { return onDelayedMarkingList_; } Arena* getNextDelayedMarking() const { MOZ_ASSERT(onDelayedMarkingList_); return reinterpret_cast<Arena*>(nextDelayedMarkingArena_ << ArenaShift); } void setNextDelayedMarkingArena(Arena* arena) { MOZ_ASSERT(!(uintptr_t(arena) & ArenaMask));
--- a/js/src/gc/Marking.cpp +++ b/js/src/gc/Marking.cpp @@ -966,18 +966,18 @@ static bool TraceKindParticipatesInCC(JS template <typename T> bool js::GCMarker::mark(T* thing) { if (IsInsideNursery(thing)) { return false; } AssertShouldMarkInZone(thing); TenuredCell* cell = TenuredCell::fromPointer(thing); - MarkColor color = TypeParticipatesInCC<T>::value ? markColor() - : MarkColor::Black; + MarkColor color = + TypeParticipatesInCC<T>::value ? markColor() : MarkColor::Black; markCount++; return cell->markIfUnmarked(color); } /*** Inline, Eager GC Marking ***********************************************/ // Each of the eager, inline marking paths is directly preceeded by the // out-of-line, generic tracing code for comparison. Both paths must end up @@ -2409,42 +2409,40 @@ void GCMarker::stop() { for (GCZonesIter zone(runtime()); !zone.done(); zone.next()) { if (!zone->gcWeakKeys().clear()) { oomUnsafe.crash("clearing weak keys in GCMarker::stop()"); } } } template <typename F> -inline void GCMarker::forEachDelayedMarkingArena(F&& f) -{ +inline void GCMarker::forEachDelayedMarkingArena(F&& f) { Arena* arena = delayedMarkingList; Arena* next; while (arena) { next = arena->getNextDelayedMarking(); f(arena); arena = next; } } void GCMarker::reset() { color = MarkColor::Black; stack.clear(); MOZ_ASSERT(isMarkStackEmpty()); - forEachDelayedMarkingArena( - [&](Arena* arena) { - MOZ_ASSERT(arena->onDelayedMarkingList()); - arena->clearDelayedMarkingState(); + forEachDelayedMarkingArena([&](Arena* arena) { + MOZ_ASSERT(arena->onDelayedMarkingList()); + arena->clearDelayedMarkingState(); #ifdef DEBUG - MOZ_ASSERT(markLaterArenas); - markLaterArenas--; + MOZ_ASSERT(markLaterArenas); + markLaterArenas--; #endif - }); + }); delayedMarkingList = nullptr; MOZ_ASSERT(isDrained()); MOZ_ASSERT(!markLaterArenas); } void GCMarker::setMarkColor(gc::MarkColor newColor) { if (color == newColor) { @@ -2596,18 +2594,17 @@ bool GCMarker::processDelayedMarkingList SliceBudget& budget) { // Marking delayed children may add more arenas to the list, including arenas // we are currently or have previously processed. Handle this by setting a // flag on arenas we think we've processed which is cleared if they are // re-added. Iterate the list until the flag is set on all arenas. do { delayedMarkingWorkAdded = false; - for (Arena* arena = delayedMarkingList; - arena; + for (Arena* arena = delayedMarkingList; arena; arena = arena->getNextDelayedMarking()) { if (!arena->hasDelayedMarking() || (color == MarkColor::Gray && !ArenaCanHaveGrayThings(arena))) { continue; } arena->setHasDelayedMarking(false); markDelayedChildren(arena, color); budget.step(150); @@ -2640,59 +2637,57 @@ bool GCMarker::markAllDelayedChildren(Sl // pass so if we yield during the first pass we will have to restart and // process all the arenas over again. If there are enough arenas we may never // finish during our timeslice. Disallowing yield during the first pass // ensures that the list will at least shrink by one arena every time. MOZ_ASSERT(delayedMarkingList); bool finished; - finished = processDelayedMarkingList(MarkColor::Gray, - false, /* don't yield */ + finished = processDelayedMarkingList(MarkColor::Gray, false, /* don't yield */ budget); MOZ_ASSERT(finished); - forEachDelayedMarkingArena( - [&](Arena* arena) { - MOZ_ASSERT(!arena->hasDelayedMarking()); - arena->setHasDelayedMarking(true); - }); + forEachDelayedMarkingArena([&](Arena* arena) { + MOZ_ASSERT(!arena->hasDelayedMarking()); + arena->setHasDelayedMarking(true); + }); finished = processDelayedMarkingList(MarkColor::Black, true, /* yield if over budget */ budget); // Rebuild the list, removing processed arenas. Arena* listTail = nullptr; - forEachDelayedMarkingArena( - [&](Arena* arena) { - if (!arena->hasDelayedMarking()) { - arena->clearDelayedMarkingState(); + forEachDelayedMarkingArena([&](Arena* arena) { + if (!arena->hasDelayedMarking()) { + arena->clearDelayedMarkingState(); #ifdef DEBUG - MOZ_ASSERT(markLaterArenas); - markLaterArenas--; + MOZ_ASSERT(markLaterArenas); + markLaterArenas--; #endif - return; - } - - appendToDelayedMarkingList(&listTail, arena); - }); + return; + } + + appendToDelayedMarkingList(&listTail, arena); + }); appendToDelayedMarkingList(&listTail, nullptr); if (!finished) { return false; } MOZ_ASSERT(!delayedMarkingList); MOZ_ASSERT(!markLaterArenas); return true; } -inline void GCMarker::appendToDelayedMarkingList(Arena** listTail, Arena* arena) { +inline void GCMarker::appendToDelayedMarkingList(Arena** listTail, + Arena* arena) { if (*listTail) { (*listTail)->updateNextDelayedMarkingArena(arena); } else { delayedMarkingList = arena; } *listTail = arena; } @@ -3560,27 +3555,25 @@ class UnmarkGrayTracer : public JS::Call void onChild(const JS::GCCellPtr& thing) override; #ifdef DEBUG TracerKind getTracerKind() const override { return TracerKind::UnmarkGray; } #endif }; -static bool -IsCCTraceKindInternal(JS::TraceKind kind) -{ - switch (kind) { -#define EXPAND_IS_CC_TRACE_KIND(name, _, addToCCKind) \ - case JS::TraceKind::name: \ - return addToCCKind; -JS_FOR_EACH_TRACEKIND(EXPAND_IS_CC_TRACE_KIND) - default: - MOZ_CRASH("Unexpected trace kind"); - } +static bool IsCCTraceKindInternal(JS::TraceKind kind) { + switch (kind) { +#define EXPAND_IS_CC_TRACE_KIND(name, _, addToCCKind) \ + case JS::TraceKind::name: \ + return addToCCKind; + JS_FOR_EACH_TRACEKIND(EXPAND_IS_CC_TRACE_KIND) + default: + MOZ_CRASH("Unexpected trace kind"); + } } void UnmarkGrayTracer::onChild(const JS::GCCellPtr& thing) { Cell* cell = thing.asCell(); // Cells in the nursery cannot be gray, and nor can certain kinds of tenured // cells. These must necessarily point only to black edges. if (!cell->isTenured() ||
--- a/js/src/gc/Nursery.cpp +++ b/js/src/gc/Nursery.cpp @@ -688,18 +688,17 @@ inline void js::Nursery::startProfile(Pr } inline void js::Nursery::endProfile(ProfileKey key) { profileDurations_[key] = ReallyNow() - startTimes_[key]; totalDurations_[key] += profileDurations_[key]; } bool js::Nursery::needIdleTimeCollection() const { - uint32_t threshold = - tunables().nurseryFreeThresholdForIdleCollection(); + uint32_t threshold = tunables().nurseryFreeThresholdForIdleCollection(); return minorGCRequested() || freeSpace() < threshold; } static inline bool IsFullStoreBufferReason(JS::gcreason::Reason reason) { return reason == JS::gcreason::FULL_WHOLE_CELL_BUFFER || reason == JS::gcreason::FULL_GENERIC_BUFFER || reason == JS::gcreason::FULL_VALUE_BUFFER || reason == JS::gcreason::FULL_CELL_PTR_BUFFER || @@ -765,18 +764,18 @@ void js::Nursery::collect(JS::gcreason:: // the nursery is full, look for object groups that are getting promoted // excessively and try to pretenure them. startProfile(ProfileKey::Pretenure); bool validPromotionRate; const float promotionRate = calcPromotionRate(&validPromotionRate); uint32_t pretenureCount = 0; bool shouldPretenure = tunables().attemptPretenuring() && ((validPromotionRate && - promotionRate > tunables().pretenureThreshold()) || - IsFullStoreBufferReason(reason)); + promotionRate > tunables().pretenureThreshold()) || + IsFullStoreBufferReason(reason)); if (shouldPretenure) { JSContext* cx = rt->mainContextFromOwnThread(); for (auto& entry : tenureCounts.entries) { if (entry.count >= tunables().pretenureGroupThreshold()) { ObjectGroup* group = entry.group; AutoRealm ar(cx, group); AutoSweepObjectGroup sweep(group); @@ -1256,17 +1255,18 @@ uintptr_t js::Nursery::currentEnd() cons MOZ_ASSERT(currentEnd_ == chunk(currentChunk_).end()); return currentEnd_; } gcstats::Statistics& js::Nursery::stats() const { return runtime()->gc.stats(); } -MOZ_ALWAYS_INLINE const js::gc::GCSchedulingTunables& js::Nursery::tunables() const { +MOZ_ALWAYS_INLINE const js::gc::GCSchedulingTunables& js::Nursery::tunables() + const { return runtime()->gc.tunables; } void js::Nursery::sweepDictionaryModeObjects() { for (auto obj : dictionaryModeObjects_) { if (!IsForwarded(obj)) { obj->sweepDictionaryListPointer(); } else {
--- a/js/src/gc/Verifier.cpp +++ b/js/src/gc/Verifier.cpp @@ -770,18 +770,18 @@ bool js::gc::CheckWeakMapEntryMarking(co // Debugger weak maps can have keys in different zones. Zone* keyZone = GetCellZoneFromAnyThread(key); MOZ_ASSERT_IF(!map->allowKeysInOtherZones(), keyZone == zone || keyZone->isAtomsZone()); Zone* valueZone = GetCellZoneFromAnyThread(value); MOZ_ASSERT(valueZone == zone || valueZone->isAtomsZone()); - CellColor mapColor = map->markColor == MarkColor::Black ? CellColor::Black - : CellColor::Gray; + CellColor mapColor = + map->markColor == MarkColor::Black ? CellColor::Black : CellColor::Gray; MOZ_ASSERT_IF(object, GetCellColor(object) == mapColor); CellColor keyColor = GetCellColor(key); CellColor valueColor = valueZone->isGCMarking() ? GetCellColor(value) : CellColor::Black; if (valueColor < Min(mapColor, keyColor)) { fprintf(stderr, "WeakMap value is less marked than map and key\n");
--- a/js/src/jit/arm64/Assembler-arm64.h +++ b/js/src/jit/arm64/Assembler-arm64.h @@ -212,26 +212,22 @@ class Assembler : public vixl::Assembler ARMBuffer::PoolEntry* pe = nullptr); BufferOffset immPool64Branch(RepatchLabel* label, ARMBuffer::PoolEntry* pe, vixl::Condition c); BufferOffset fImmPool(ARMFPRegister dest, uint8_t* value, vixl::LoadLiteralOp op, const LiteralDoc& doc); BufferOffset fImmPool64(ARMFPRegister dest, double value); BufferOffset fImmPool32(ARMFPRegister dest, float value); - uint32_t currentOffset() const { - return nextOffset().getOffset(); - } + uint32_t currentOffset() const { return nextOffset().getOffset(); } void bind(Label* label) { bind(label, nextOffset()); } void bind(Label* label, BufferOffset boff); void bind(RepatchLabel* label); - void bind(CodeLabel* label) { - label->target()->bind(currentOffset()); - } + void bind(CodeLabel* label) { label->target()->bind(currentOffset()); } bool oom() const { return AssemblerShared::oom() || armbuffer_.oom() || jumpRelocations_.oom() || dataRelocations_.oom(); } void copyJumpRelocationTable(uint8_t* dest) const { if (jumpRelocations_.length()) {
--- a/js/src/jit/arm64/CodeGenerator-arm64.cpp +++ b/js/src/jit/arm64/CodeGenerator-arm64.cpp @@ -797,18 +797,17 @@ class js::jit::OutOfLineTableSwitch MTableSwitch* mir_; CodeLabel jumpLabel_; void accept(CodeGeneratorARM64* codegen) override { codegen->visitOutOfLineTableSwitch(this); } public: - OutOfLineTableSwitch(MTableSwitch* mir) - : mir_(mir) {} + OutOfLineTableSwitch(MTableSwitch* mir) : mir_(mir) {} MTableSwitch* mir() const { return mir_; } CodeLabel* jumpLabel() { return &jumpLabel_; } }; void CodeGeneratorARM64::visitOutOfLineTableSwitch(OutOfLineTableSwitch* ool) { MTableSwitch* mir = ool->mir(); @@ -847,17 +846,17 @@ void CodeGeneratorARM64::emitTableSwitch // Because the target code has not yet been generated, we cannot know the // instruction offsets for use as jump targets. Therefore we construct // an OutOfLineTableSwitch that winds up holding the jump table. // // Because the jump table is generated as part of out-of-line code, // it is generated after all the regular codegen, so the jump targets // are guaranteed to exist when generating the jump table. - OutOfLineTableSwitch* ool = new(alloc()) OutOfLineTableSwitch(mir); + OutOfLineTableSwitch* ool = new (alloc()) OutOfLineTableSwitch(mir); addOutOfLineCode(ool, mir); // Use the index to get the address of the jump target from the table. masm.mov(ool->jumpLabel(), base); BaseIndex pointer(base, index, ScalePointer); // Load the target from the jump table and branch to it. masm.branchToComputedAddress(pointer);
--- a/js/src/jit/arm64/LIR-arm64.h +++ b/js/src/jit/arm64/LIR-arm64.h @@ -172,18 +172,18 @@ class LTableSwitch : public LInstruction }; // Takes a tableswitch with an integer to decide class LTableSwitchV : public LInstructionHelper<0, BOX_PIECES, 3> { public: LIR_HEADER(TableSwitchV); LTableSwitchV(const LBoxAllocation& input, const LDefinition& inputCopy, - const LDefinition& floatCopy, const LDefinition& jumpTablePointer, - MTableSwitch* ins) + const LDefinition& floatCopy, + const LDefinition& jumpTablePointer, MTableSwitch* ins) : LInstructionHelper(classOpcode) { setBoxOperand(InputValue, input); setTemp(0, inputCopy); setTemp(1, floatCopy); setTemp(2, jumpTablePointer); setMir(ins); }
--- a/js/src/jit/arm64/Lowering-arm64.cpp +++ b/js/src/jit/arm64/Lowering-arm64.cpp @@ -227,36 +227,35 @@ void LIRGeneratorARM64::lowerModI(MMod* lowerUMod(mod); return; } if (mod->rhs()->isConstant()) { int32_t rhs = mod->rhs()->toConstant()->toInt32(); int32_t shift = FloorLog2(rhs); if (rhs > 0 && 1 << shift == rhs) { - LModPowTwoI* lir = new(alloc()) LModPowTwoI(useRegister(mod->lhs()), shift); + LModPowTwoI* lir = + new (alloc()) LModPowTwoI(useRegister(mod->lhs()), shift); if (mod->fallible()) { assignSnapshot(lir, Bailout_DoubleOutput); } define(lir, mod); return; } else if (shift < 31 && (1 << (shift + 1)) - 1 == rhs) { - LModMaskI* lir = new(alloc()) LModMaskI(useRegister(mod->lhs()), - temp(), - temp(), - shift + 1); + LModMaskI* lir = new (alloc()) + LModMaskI(useRegister(mod->lhs()), temp(), temp(), shift + 1); if (mod->fallible()) { assignSnapshot(lir, Bailout_DoubleOutput); } define(lir, mod); } } - LModI* lir = new(alloc()) LModI(useRegister(mod->lhs()), - useRegister(mod->rhs()), temp()); + LModI* lir = new (alloc()) + LModI(useRegister(mod->lhs()), useRegister(mod->rhs()), temp()); if (mod->fallible()) { assignSnapshot(lir, Bailout_DoubleOutput); } define(lir, mod); } void LIRGeneratorARM64::lowerDivI64(MDiv* div) { MOZ_CRASH("NYI"); } @@ -271,18 +270,18 @@ void LIRGenerator::visitPowHalf(MPowHalf LTableSwitch* LIRGeneratorARM64::newLTableSwitch(const LAllocation& in, const LDefinition& inputCopy, MTableSwitch* tableswitch) { return new (alloc()) LTableSwitch(in, inputCopy, temp(), tableswitch); } LTableSwitchV* LIRGeneratorARM64::newLTableSwitchV(MTableSwitch* tableswitch) { - return new(alloc()) LTableSwitchV(useBox(tableswitch->getOperand(0)), - temp(), tempDouble(), temp(), tableswitch); + return new (alloc()) LTableSwitchV(useBox(tableswitch->getOperand(0)), temp(), + tempDouble(), temp(), tableswitch); } void LIRGeneratorARM64::lowerUrshD(MUrsh* mir) { MDefinition* lhs = mir->lhs(); MDefinition* rhs = mir->rhs(); MOZ_ASSERT(lhs->type() == MIRType::Int32); MOZ_ASSERT(rhs->type() == MIRType::Int32); @@ -310,18 +309,18 @@ void LIRGenerator::visitWasmNeg(MWasmNeg void LIRGenerator::visitWasmSelect(MWasmSelect* ins) { MOZ_CRASH("visitWasmSelect"); } void LIRGeneratorARM64::lowerUDiv(MDiv* div) { MOZ_CRASH("lowerUDiv"); } void LIRGeneratorARM64::lowerUMod(MMod* mod) { - LUMod* lir = new(alloc()) LUMod(useRegister(mod->getOperand(0)), - useRegister(mod->getOperand(1))); + LUMod* lir = new (alloc()) + LUMod(useRegister(mod->getOperand(0)), useRegister(mod->getOperand(1))); if (mod->fallible()) { assignSnapshot(lir, Bailout_DoubleOutput); } define(lir, mod); } void LIRGenerator::visitWasmUnsignedToDouble(MWasmUnsignedToDouble* ins) { MOZ_CRASH("visitWasmUnsignedToDouble");
--- a/js/src/jsapi-tests/testGCGrayMarking.cpp +++ b/js/src/jsapi-tests/testGCGrayMarking.cpp @@ -652,17 +652,18 @@ JSObject* GetCrossCompartmentWrapper(JSO } JSObject* AllocWeakmapKeyObject() { JS::RootedObject delegate(cx, JS_NewPlainObject(cx)); if (!delegate) { return nullptr; } - JS::RootedObject key(cx, js::Wrapper::New(cx, delegate, &js::Wrapper::singleton)); + JS::RootedObject key(cx, + js::Wrapper::New(cx, delegate, &js::Wrapper::singleton)); EvictNursery(); return key; } JSObject* AllocObjectChain(size_t length) { // Allocate a chain of linked JSObjects.
--- a/js/src/jsapi-tests/testWeakMap.cpp +++ b/js/src/jsapi-tests/testWeakMap.cpp @@ -146,18 +146,18 @@ static size_t DelegateObjectMoved(JSObje MOZ_RELEASE_ASSERT(keyDelegate == old); keyDelegate = obj; return 0; } JSObject* newKey() { static const js::Class keyClass = { - "keyWithDelegate", JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(1), - JS_NULL_CLASS_OPS, JS_NULL_CLASS_SPEC, + "keyWithDelegate", JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(1), + JS_NULL_CLASS_OPS, JS_NULL_CLASS_SPEC, JS_NULL_CLASS_EXT, JS_NULL_OBJECT_OPS}; JS::RootedObject key(cx, JS_NewObject(cx, Jsvalify(&keyClass))); if (!key) { return nullptr; } return key;
--- a/js/src/vm/Stack.cpp +++ b/js/src/vm/Stack.cpp @@ -2014,20 +2014,19 @@ uint32_t JS::ProfilingFrameIterator::ext if (isWasm()) { frames[offset] = physicalFrame.value(); frames[offset].label = wasmIter().label(); return 1; } // Extract the stack for the entry. Assume maximum inlining depth is <64 const char* labels[64]; - uint32_t depth = - entry.callStackAtAddr(cx_->runtime(), - jsJitIter().resumePCinCurrentFrame(), - labels, ArrayLength(labels)); + uint32_t depth = entry.callStackAtAddr(cx_->runtime(), + jsJitIter().resumePCinCurrentFrame(), + labels, ArrayLength(labels)); MOZ_ASSERT(depth < ArrayLength(labels)); for (uint32_t i = 0; i < depth; i++) { if (offset + i >= end) { return i; } frames[offset + i] = physicalFrame.value(); frames[offset + i].label = labels[i]; }
--- a/js/src/wasm/WasmInstance.cpp +++ b/js/src/wasm/WasmInstance.cpp @@ -701,17 +701,18 @@ Instance::tableInit(Instance* instance, } } JS_ReportErrorNumberASCII(TlsContext.get(), GetErrorMessage, nullptr, JSMSG_WASM_OUT_OF_BOUNDS); return -1; } -/* static */ void* /* nullptr to signal trap; pointer to table location otherwise */ +/* static */ void* /* nullptr to signal trap; pointer to table location + otherwise */ Instance::tableGet(Instance* instance, uint32_t index, uint32_t tableIndex) { const Table& table = *instance->tables()[tableIndex]; MOZ_RELEASE_ASSERT(table.kind() == TableKind::AnyRef); if (index >= table.length()) { JS_ReportErrorNumberASCII(TlsContext.get(), GetErrorMessage, nullptr, JSMSG_WASM_TABLE_OUT_OF_BOUNDS); return nullptr; } @@ -899,19 +900,17 @@ void CopyValPostBarriered(uint8_t* dst, if (x) { JSObject::writeBarrierPost((JSObject**)dst, nullptr, x); } break; } case ValType::NullRef: { break; } - default: { - MOZ_CRASH("unexpected Val type"); - } + default: { MOZ_CRASH("unexpected Val type"); } } } Instance::Instance(JSContext* cx, Handle<WasmInstanceObject*> object, SharedCode code, UniqueTlsData tlsDataIn, HandleWasmMemoryObject memory, SharedTableVector&& tables, StructTypeDescrVector&& structTypeDescrs, Handle<FunctionVector> funcImports,
--- a/js/src/wasm/WasmJS.cpp +++ b/js/src/wasm/WasmJS.cpp @@ -2309,17 +2309,18 @@ const Class WasmGlobalObject::class_ = { return; } switch (global->type().code()) { case ValType::AnyRef: if (!global->cell()->anyref.isNull()) { // TODO/AnyRef-boxing: With boxed immediates and strings, the write // barrier is going to have to be more complicated. ASSERT_ANYREF_IS_JSOBJECT; - TraceManuallyBarrieredEdge(trc, global->cell()->anyref.asJSObjectAddress(), + TraceManuallyBarrieredEdge(trc, + global->cell()->anyref.asJSObjectAddress(), "wasm anyref global"); } break; case ValType::I32: case ValType::F32: case ValType::I64: case ValType::F64: break; @@ -2381,17 +2382,18 @@ const Class WasmGlobalObject::class_ = { break; case ValType::AnyRef: MOZ_ASSERT(cell->anyref.isNull(), "no prebarriers needed"); cell->anyref = val.anyref(); if (!cell->anyref.isNull()) { // TODO/AnyRef-boxing: With boxed immediates and strings, the write // barrier is going to have to be more complicated. ASSERT_ANYREF_IS_JSOBJECT; - JSObject::writeBarrierPost(&cell->anyref, nullptr, cell->anyref.asJSObject()); + JSObject::writeBarrierPost(&cell->anyref, nullptr, + cell->anyref.asJSObject()); } break; case ValType::Ref: MOZ_CRASH("Ref NYI"); } obj->initReservedSlot(TYPE_SLOT, Int32Value(int32_t(val.type().bitsUnsafe())));
--- a/js/src/wasm/WasmJS.h +++ b/js/src/wasm/WasmJS.h @@ -150,17 +150,17 @@ class WasmGlobalObject : public NativeOb public: // For exposed globals the Cell holds the value of the global; the // instance's global area holds a pointer to the Cell. union Cell { int32_t i32; int64_t i64; float f32; double f64; - JSObject* ref; // Note, this breaks an abstraction boundary + JSObject* ref; // Note, this breaks an abstraction boundary wasm::AnyRef anyref; Cell() : i64(0) {} ~Cell() {} }; static const unsigned RESERVED_SLOTS = 3; static const Class class_; static const JSPropertySpec properties[];
--- a/js/src/wasm/WasmTypes.cpp +++ b/js/src/wasm/WasmTypes.cpp @@ -92,17 +92,18 @@ Val::Val(const LitVal& val) { void Val::trace(JSTracer* trc) { if (type_.isValid()) { if (type_.isRef() && u.ref_) { TraceManuallyBarrieredEdge(trc, &u.ref_, "wasm ref/anyref global"); } else if (type_ == ValType::AnyRef && !u.anyref_.isNull()) { // TODO/AnyRef-boxing: With boxed immediates and strings, the write // barrier is going to have to be more complicated. ASSERT_ANYREF_IS_JSOBJECT; - TraceManuallyBarrieredEdge(trc, u.anyref_.asJSObjectAddress(), "wasm ref/anyref global"); + TraceManuallyBarrieredEdge(trc, u.anyref_.asJSObjectAddress(), + "wasm ref/anyref global"); } } } void AnyRef::trace(JSTracer* trc) { if (value_) { TraceManuallyBarrieredEdge(trc, &value_, "wasm anyref referent"); }
--- a/js/src/wasm/WasmTypes.h +++ b/js/src/wasm/WasmTypes.h @@ -557,45 +557,31 @@ class AnyRef { JSObject* value_; explicit AnyRef(JSObject* p) : value_(p) { MOZ_ASSERT(((uintptr_t)p & 0x03) == 0); } public: // Given a void* that comes from compiled wasm code, turn it into AnyRef. - static AnyRef fromCompiledCode(void* p) { - return AnyRef((JSObject*)p); - } + static AnyRef fromCompiledCode(void* p) { return AnyRef((JSObject*)p); } // Given a JSObject* that comes from JS, turn it into AnyRef. - static AnyRef fromJSObject(JSObject* p) { - return AnyRef(p); - } + static AnyRef fromJSObject(JSObject* p) { return AnyRef(p); } // Generate an AnyRef null pointer. - static AnyRef null() { - return AnyRef(nullptr); - } - - bool isNull() { - return value_ == nullptr; - } - - void* forCompiledCode() const { - return value_; - } - - JSObject* asJSObject() { - return value_; - } - - JSObject** asJSObjectAddress() { - return &value_; - } + static AnyRef null() { return AnyRef(nullptr); } + + bool isNull() { return value_ == nullptr; } + + void* forCompiledCode() const { return value_; } + + JSObject* asJSObject() { return value_; } + + JSObject** asJSObjectAddress() { return &value_; } void trace(JSTracer* trc); // Tags (to be developed further) static constexpr uintptr_t AnyRefTagMask = 1; static constexpr uintptr_t AnyRefObjTag = 0; }; @@ -693,17 +679,17 @@ class LitVal { protected: ValType type_; union U { U() : i32_(0) {} uint32_t i32_; uint64_t i64_; float f32_; double f64_; - JSObject* ref_; // Note, this breaks an abstraction boundary + JSObject* ref_; // Note, this breaks an abstraction boundary AnyRef anyref_; } u; public: LitVal() : type_(), u{} {} explicit LitVal(uint32_t i32) : type_(ValType::I32) { u.i32_ = i32; } explicit LitVal(uint64_t i64) : type_(ValType::I64) { u.i64_ = i64; } @@ -762,19 +748,17 @@ class LitVal { class MOZ_NON_PARAM Val : public LitVal { public: Val() : LitVal() {} explicit Val(const LitVal& val); explicit Val(uint32_t i32) : LitVal(i32) {} explicit Val(uint64_t i64) : LitVal(i64) {} explicit Val(float f32) : LitVal(f32) {} explicit Val(double f64) : LitVal(f64) {} - explicit Val(AnyRef val) : LitVal(AnyRef::null()) { - u.anyref_ = val; - } + explicit Val(AnyRef val) : LitVal(AnyRef::null()) { u.anyref_ = val; } explicit Val(ValType type, JSObject* obj) : LitVal(type, (JSObject*)nullptr) { u.ref_ = obj; } void trace(JSTracer* trc); }; typedef Rooted<Val> RootedVal; typedef Handle<Val> HandleVal;
--- a/js/xpconnect/loader/mozJSSubScriptLoader.cpp +++ b/js/xpconnect/loader/mozJSSubScriptLoader.cpp @@ -382,20 +382,22 @@ AsyncScriptLoader::OnStreamComplete(nsII if (EvalScript(cx, targetObj, loadScope, &retval, uri, mCache, mCache && !mWantReturnValue, &script)) { autoPromise.ResolvePromise(retval); } return NS_OK; } -nsresult mozJSSubScriptLoader::ReadScriptAsync( - nsIURI* uri, HandleObject targetObj, HandleObject loadScope, - nsIIOService* serv, bool wantReturnValue, bool cache, - MutableHandleValue retval) { +nsresult mozJSSubScriptLoader::ReadScriptAsync(nsIURI* uri, + HandleObject targetObj, + HandleObject loadScope, + nsIIOService* serv, + bool wantReturnValue, bool cache, + MutableHandleValue retval) { nsCOMPtr<nsIGlobalObject> globalObject = xpc::NativeGlobal(targetObj); ErrorResult result; AutoJSAPI jsapi; if (NS_WARN_IF(!jsapi.Init(globalObject))) { return NS_ERROR_UNEXPECTED; } @@ -661,19 +663,18 @@ nsresult mozJSSubScriptLoader::DoLoadSub return ReadScriptAsync(uri, targetObj, loadScope, serv, options.wantReturnValue, !!cache, retval); } if (script) { // |script| came from the cache, so don't bother writing it // |back there. cache = nullptr; - } else if (!ReadScript(uri, cx, targetObj, - static_cast<const char*>(uriStr.get()), serv, - options.wantReturnValue, useCompilationScope, - &script)) { + } else if (!ReadScript( + uri, cx, targetObj, static_cast<const char*>(uriStr.get()), + serv, options.wantReturnValue, useCompilationScope, &script)) { return NS_OK; } Unused << EvalScript(cx, targetObj, loadScope, retval, uri, !!cache, !ignoreCache && !options.wantReturnValue, &script); return NS_OK; }
--- a/js/xpconnect/src/XPCJSRuntime.cpp +++ b/js/xpconnect/src/XPCJSRuntime.cpp @@ -2847,17 +2847,18 @@ static nsresult ReadSourceFromFilename(J if (NS_FAILED(rv)) { return rv; } MOZ_ASSERT(bytesRead > 0, "stream promised more bytes before EOF"); ptr += bytesRead; } rv = ScriptLoader::ConvertToUTF16(scriptChannel, buf.get(), rawLen, - NS_LITERAL_STRING("UTF-8"), nullptr, *src, *len); + NS_LITERAL_STRING("UTF-8"), nullptr, *src, + *len); NS_ENSURE_SUCCESS(rv, rv); if (!*src) { return NS_ERROR_FAILURE; } // Historically this method used JS_malloc() which updates the GC memory // accounting. Since ConvertToUTF16() now uses js_malloc() instead we
--- a/js/xpconnect/src/XPCWrappedNative.cpp +++ b/js/xpconnect/src/XPCWrappedNative.cpp @@ -1,20 +1,20 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* Wrapper object for reflecting native xpcom objects into JavaScript. */ -#if(__GNUC__ && __linux__ && __PPC64__ && _LITTLE_ENDIAN) +#if (__GNUC__ && __linux__ && __PPC64__ && _LITTLE_ENDIAN) // Stack protection generates incorrect code currently with gcc on ppc64le // (bug 1512162). -#define MOZ_GCC_STACK_PROTECTOR_DISABLED 1 // removed at end of file +#define MOZ_GCC_STACK_PROTECTOR_DISABLED 1 // removed at end of file #pragma GCC push_options #pragma GCC optimize("no-stack-protector") #endif #include "xpcprivate.h" #include "mozilla/jsipc/CrossProcessObjectWrappers.h" #include "nsWrapperCacheInlines.h" #include "XPCLog.h"
--- a/js/xpconnect/src/XPCWrappedNativeJSOps.cpp +++ b/js/xpconnect/src/XPCWrappedNativeJSOps.cpp @@ -657,18 +657,17 @@ static const js::ClassOps XPC_WN_NoHelpe nullptr, // mayResolve XPC_WN_NoHelper_Finalize, // finalize nullptr, // call nullptr, // construct nullptr, // hasInstance XPCWrappedNative::Trace, // trace }; -const js::ClassExtension XPC_WN_JSClassExtension = { - WrappedNativeObjectMoved}; +const js::ClassExtension XPC_WN_JSClassExtension = {WrappedNativeObjectMoved}; const js::Class XPC_WN_NoHelper_JSClass = { "XPCWrappedNative_NoHelper", XPC_WRAPPER_FLAGS | JSCLASS_IS_WRAPPED_NATIVE | JSCLASS_PRIVATE_IS_NSISUPPORTS | JSCLASS_FOREGROUND_FINALIZE, &XPC_WN_NoHelper_JSClassOps, JS_NULL_CLASS_SPEC, &XPC_WN_JSClassExtension,
--- a/js/xpconnect/src/xpcprivate.h +++ b/js/xpconnect/src/xpcprivate.h @@ -1271,19 +1271,17 @@ class XPCWrappedNativeProto final { void DebugDump(int16_t depth); void TraceSelf(JSTracer* trc) { if (mJSProtoObject) { mJSProtoObject.trace(trc, "XPCWrappedNativeProto::mJSProtoObject"); } } - void TraceJS(JSTracer* trc) { - TraceSelf(trc); - } + void TraceJS(JSTracer* trc) { TraceSelf(trc); } void WriteBarrierPre(JSContext* cx) { if (JS::IsIncrementalBarrierNeeded(cx) && mJSProtoObject) { mJSProtoObject.writeBarrierPre(cx); } } // NOP. This is just here to make the AutoMarkingPtr code compile.
--- a/layout/base/PresShell.cpp +++ b/layout/base/PresShell.cpp @@ -2032,18 +2032,18 @@ void PresShell::FireResizeEvent() { } // If event handling is suppressed, repost the resize event to the refresh // driver. The event is marked as delayed so that the refresh driver does not // continue ticking. if (mDocument->EventHandlingSuppressed()) { if (MOZ_LIKELY(!mDocument->GetBFCacheEntry())) { mDocument->SetHasDelayedRefreshEvent(); - mPresContext->RefreshDriver()->AddResizeEventFlushObserver - (this, /* aDelayed = */ true); + mPresContext->RefreshDriver()->AddResizeEventFlushObserver( + this, /* aDelayed = */ true); } return; } mResizeEventPending = false; // Send resize event from here. WidgetEvent event(true, mozilla::eResize);
--- a/layout/base/nsRefreshDriver.cpp +++ b/layout/base/nsRefreshDriver.cpp @@ -1156,17 +1156,18 @@ void nsRefreshDriver::DispatchVisualView // the current events being dispatched, we'll dispatch them on the next tick. VisualViewportResizeEventArray events; events.SwapElements(mVisualViewportResizeEvents); for (auto& event : events) { event->Run(); } } -void nsRefreshDriver::PostScrollEvent(mozilla::Runnable* aScrollEvent, bool aDelayed) { +void nsRefreshDriver::PostScrollEvent(mozilla::Runnable* aScrollEvent, + bool aDelayed) { if (aDelayed) { mDelayedScrollEvents.AppendElement(aScrollEvent); } else { mScrollEvents.AppendElement(aScrollEvent); EnsureTimerStarted(); } }
--- a/layout/base/nsRefreshDriver.h +++ b/layout/base/nsRefreshDriver.h @@ -183,20 +183,22 @@ class nsRefreshDriver final : public moz * @returns whether the operation succeeded, or void in the case of removal. */ bool AddImageRequest(imgIRequest* aRequest); void RemoveImageRequest(imgIRequest* aRequest); /** * Add / remove presshells which have pending resize event. */ - void AddResizeEventFlushObserver(nsIPresShell* aShell, bool aDelayed = false) { - MOZ_DIAGNOSTIC_ASSERT(!mResizeEventFlushObservers.Contains(aShell) && - !mDelayedResizeEventFlushObservers.Contains(aShell), - "Double-adding resize event flush observer"); + void AddResizeEventFlushObserver(nsIPresShell* aShell, + bool aDelayed = false) { + MOZ_DIAGNOSTIC_ASSERT( + !mResizeEventFlushObservers.Contains(aShell) && + !mDelayedResizeEventFlushObservers.Contains(aShell), + "Double-adding resize event flush observer"); if (aDelayed) { mDelayedResizeEventFlushObservers.AppendElement(aShell); } else { mResizeEventFlushObservers.AppendElement(aShell); EnsureTimerStarted(); } }
--- a/layout/forms/nsHTMLButtonControlFrame.cpp +++ b/layout/forms/nsHTMLButtonControlFrame.cpp @@ -99,18 +99,17 @@ void nsHTMLButtonControlFrame::BuildDisp DisplayListClipState::AutoSaveRestore clipState(aBuilder); if (ShouldClipPaintingToBorderBox()) { nsMargin border = StyleBorder()->GetComputedBorder(); nsRect rect(aBuilder->ToReferenceFrame(this), GetSize()); rect.Deflate(border); nscoord radii[8]; bool hasRadii = GetPaddingBoxBorderRadii(radii); - clipState.ClipContainingBlockDescendants(rect, - hasRadii ? radii : nullptr); + clipState.ClipContainingBlockDescendants(rect, hasRadii ? radii : nullptr); } BuildDisplayListForChild(aBuilder, mFrames.FirstChild(), set, DISPLAY_CHILD_FORCE_PSEUDO_STACKING_CONTEXT); // Put the foreground outline and focus rects on top of the children set.Content()->AppendToTop(&onTop); set.MoveTo(aLists);
--- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -4851,19 +4851,21 @@ void ScrollFrameHelper::CurPosAttributeC isSmooth ? nsIScrollableFrame::SMOOTH : nsIScrollableFrame::INSTANT, nsGkAtoms::scrollbars, &allowedRange); } // 'this' might be destroyed here } /* ============= Scroll events ========== */ -ScrollFrameHelper::ScrollEvent::ScrollEvent(ScrollFrameHelper* aHelper, bool aDelayed) +ScrollFrameHelper::ScrollEvent::ScrollEvent(ScrollFrameHelper* aHelper, + bool aDelayed) : Runnable("ScrollFrameHelper::ScrollEvent"), mHelper(aHelper) { - mHelper->mOuter->PresContext()->RefreshDriver()->PostScrollEvent(this, aDelayed); + mHelper->mOuter->PresContext()->RefreshDriver()->PostScrollEvent(this, + aDelayed); } NS_IMETHODIMP ScrollFrameHelper::ScrollEvent::Run() { if (mHelper) { mHelper->FireScrollEvent(); } return NS_OK;
--- a/media/libdav1d/config.h +++ b/media/libdav1d/config.h @@ -8,17 +8,16 @@ #endif #if defined(__arm__) || defined(_M_ARM) #define ARCH_ARM 1 #else #define ARCH_ARM 0 #endif - #if defined(__i386__) || defined(_M_IX86) #define ARCH_X86_32 1 #else #define ARCH_X86_32 0 #endif #if defined(__x86_64__) || defined(_M_X64) #define ARCH_X86_64 1 @@ -41,26 +40,26 @@ #define HAVE_ASM 1 #else #define HAVE_ASM 0 #endif // Set memory aligment #if defined(__ANDROID__) && (ARCH_ARM == 1 || ARCH_X86_32 == 1) #define HAVE_MEMALIGN 1 -#elif ARCH_X86_64 == 1 && (defined(_WIN32) || defined(__CYGWIN__)) && defined(MOZ_ASAN) +#elif ARCH_X86_64 == 1 && (defined(_WIN32) || defined(__CYGWIN__)) && \ + defined(MOZ_ASAN) #define HAVE_ALIGNED_MALLOC 1 #else #define HAVE_POSIX_MEMALIGN 1 #endif -// unistd.h is used by tools, which we do not -// built, so we do not really care. +// unistd.h is used by tools, which we do not +// built, so we do not really care. #define HAVE_UNISTD_H 1 // Important when asm is enabled #if defined(__APPLE__) #define PREFIX 1 #endif // aligment is 32 in evry case #define STACK_ALIGNMENT 32 -
--- a/netwerk/base/nsLoadGroup.cpp +++ b/netwerk/base/nsLoadGroup.cpp @@ -108,22 +108,18 @@ nsLoadGroup::~nsLoadGroup() { } LOG(("LOADGROUP [%p]: Destroyed.\n", this)); } //////////////////////////////////////////////////////////////////////////////// // nsISupports methods: -NS_IMPL_ISUPPORTS(nsLoadGroup, - nsILoadGroup, - nsILoadGroupChild, - nsIRequest, - nsISupportsPriority, - nsISupportsWeakReference) +NS_IMPL_ISUPPORTS(nsLoadGroup, nsILoadGroup, nsILoadGroupChild, nsIRequest, + nsISupportsPriority, nsISupportsWeakReference) //////////////////////////////////////////////////////////////////////////////// // nsIRequest methods: NS_IMETHODIMP nsLoadGroup::GetName(nsACString &result) { // XXX is this the right "name" for a load group?
--- a/netwerk/base/nsSocketTransportService2.cpp +++ b/netwerk/base/nsSocketTransportService2.cpp @@ -1633,21 +1633,18 @@ void nsSocketTransportService::GetSocket nsTArray<SocketInfo> *data) { MOZ_ASSERT(OnSocketThread(), "not on socket thread"); for (uint32_t i = 0; i < mActiveCount; i++) AnalyzeConnection(data, &mActiveList[i], true); for (uint32_t i = 0; i < mIdleCount; i++) AnalyzeConnection(data, &mIdleList[i], false); } -bool -nsSocketTransportService::IsTelemetryEnabledAndNotSleepPhase() -{ - return Telemetry::CanRecordPrereleaseData() && - !mSleepPhase; +bool nsSocketTransportService::IsTelemetryEnabledAndNotSleepPhase() { + return Telemetry::CanRecordPrereleaseData() && !mSleepPhase; } #if defined(XP_WIN) void nsSocketTransportService::StartPollWatchdog() { // Start off the timer from a runnable off of the main thread in order to // avoid a deadlock, see bug 1370448. RefPtr<nsSocketTransportService> self(this); NS_DispatchToMainThread(NS_NewRunnableFunction(
--- a/netwerk/ipc/ChannelEventQueue.cpp +++ b/netwerk/ipc/ChannelEventQueue.cpp @@ -163,18 +163,17 @@ void ChannelEventQueue::ResumeInternal() target = mEventQueue[0]->GetEventTarget(); MOZ_ASSERT(target); Unused << NS_WARN_IF( NS_FAILED(target->Dispatch(event.forget(), NS_DISPATCH_NORMAL))); } } -bool -ChannelEventQueue::MaybeSuspendIfEventsAreSuppressed() { +bool ChannelEventQueue::MaybeSuspendIfEventsAreSuppressed() { // We only ever need to suppress events on the main thread, since this is // where content scripts can run. if (!NS_IsMainThread()) { return false; } // Only suppress events for queues associated with XHRs, as these can cause // content scripts to run. @@ -191,31 +190,30 @@ ChannelEventQueue::MaybeSuspendIfEventsA if (!loadInfo) { return false; } // Figure out if this is for an XHR, if we haven't done so already. if (!mHasCheckedForXMLHttpRequest) { nsContentPolicyType contentType = loadInfo->InternalContentPolicyType(); mForXMLHttpRequest = - (contentType == nsIContentPolicy::TYPE_INTERNAL_XMLHTTPREQUEST); + (contentType == nsIContentPolicy::TYPE_INTERNAL_XMLHTTPREQUEST); mHasCheckedForXMLHttpRequest = true; if (!mForXMLHttpRequest) { return false; } } // Suspend the queue if the associated document has suppressed event handling, // *and* it is not in the middle of a synchronous operation that might require // XHR events to be processed (such as a synchronous XHR). nsCOMPtr<nsIDocument> document; loadInfo->GetLoadingDocument(getter_AddRefs(document)); - if (document && - document->EventHandlingSuppressed() && + if (document && document->EventHandlingSuppressed() && !document->IsInSyncOperation()) { document->AddSuspendedChannelEventQueue(this); SuspendInternal(); return true; } return false; }
--- a/netwerk/ipc/ChannelEventQueue.h +++ b/netwerk/ipc/ChannelEventQueue.h @@ -175,19 +175,19 @@ inline void ChannelEventQueue::RunOrEnqu // To guarantee that the running event and all the events generated within // it will be finished before events on other threads. RecursiveMutexAutoLock lock(mRunningMutex); { MutexAutoLock lock(mMutex); - bool enqueue = - !!mForcedCount || mSuspended || mFlushing || !mEventQueue.IsEmpty() || - MaybeSuspendIfEventsAreSuppressed(); + bool enqueue = !!mForcedCount || mSuspended || mFlushing || + !mEventQueue.IsEmpty() || + MaybeSuspendIfEventsAreSuppressed(); if (enqueue) { mEventQueue.AppendElement(std::move(event)); return; } nsCOMPtr<nsIEventTarget> target = event->GetEventTarget(); MOZ_ASSERT(target); @@ -296,19 +296,18 @@ inline void ChannelEventQueue::CompleteR inline void ChannelEventQueue::MaybeFlushQueue() { // Don't flush if forced queuing on, we're already being flushed, or // suspended, or there's nothing to flush bool flushQueue = false; { MutexAutoLock lock(mMutex); - flushQueue = - !mForcedCount && !mFlushing && !mSuspended && !mEventQueue.IsEmpty() && - !MaybeSuspendIfEventsAreSuppressed(); + flushQueue = !mForcedCount && !mFlushing && !mSuspended && + !mEventQueue.IsEmpty() && !MaybeSuspendIfEventsAreSuppressed(); // Only one thread is allowed to run FlushQueue at a time. if (flushQueue) { mFlushing = true; } } if (flushQueue) {
--- a/netwerk/protocol/http/nsHttpHandler.h +++ b/netwerk/protocol/http/nsHttpHandler.h @@ -100,17 +100,17 @@ class nsHttpHandler final : public nsIHt uint16_t GetFallbackSynTimeout() { return mFallbackSynTimeout; } bool FastFallbackToIPv4() { return mFastFallbackToIPv4; } uint32_t MaxSocketCount(); bool EnforceAssocReq() { return mEnforceAssocReq; } bool IsPersistentHttpsCachingEnabled() { return mEnablePersistentHttpsCaching; } - + bool IsSpdyEnabled() { return mEnableSpdy; } bool IsHttp2Enabled() { return mHttp2Enabled; } bool EnforceHttp2TlsProfile() { return mEnforceHttp2TlsProfile; } bool CoalesceSpdy() { return mCoalesceSpdy; } bool UseSpdyPersistentSettings() { return mSpdyPersistentSettings; } uint32_t SpdySendingChunkSize() { return mSpdySendingChunkSize; } uint32_t SpdySendBufferSize() { return mSpdySendBufferSize; } uint32_t SpdyPushAllowance() { return mSpdyPushAllowance; }
--- a/parser/html/nsHtml5StreamParser.cpp +++ b/parser/html/nsHtml5StreamParser.cpp @@ -677,21 +677,19 @@ nsresult nsHtml5StreamParser::SniffStrea return SetupDecodingAndWriteSniffingBufferAndCurrentSegment(aFromSegment); } if (!mMetaScanner && (mMode == NORMAL || mMode == VIEW_SOURCE_HTML || mMode == LOAD_AS_DATA)) { mMetaScanner = new nsHtml5MetaScanner(mTreeBuilder); } - if (mSniffingLength + aFromSegment.Length() >= - SNIFFING_BUFFER_SIZE) { + if (mSniffingLength + aFromSegment.Length() >= SNIFFING_BUFFER_SIZE) { // this is the last buffer - uint32_t countToSniffingLimit = - SNIFFING_BUFFER_SIZE - mSniffingLength; + uint32_t countToSniffingLimit = SNIFFING_BUFFER_SIZE - mSniffingLength; if (mMode == NORMAL || mMode == VIEW_SOURCE_HTML || mMode == LOAD_AS_DATA) { nsHtml5ByteReadable readable( aFromSegment.Elements(), aFromSegment.Elements() + countToSniffingLimit); nsAutoCString charset; auto encoding = mMetaScanner->sniff(&readable); // Due to the way nsHtml5Portability reports OOM, ask the tree buider nsresult rv; @@ -750,18 +748,17 @@ nsresult nsHtml5StreamParser::SniffStrea mCharsetSource = kCharsetFromMetaPrescan; mFeedChardetIfEncoding = nullptr; mTreeBuilder->SetDocumentCharset(mEncoding, mCharsetSource); return SetupDecodingAndWriteSniffingBufferAndCurrentSegment(aFromSegment); } } if (!mSniffingBuffer) { - mSniffingBuffer = MakeUniqueFallible<uint8_t[]>( - SNIFFING_BUFFER_SIZE); + mSniffingBuffer = MakeUniqueFallible<uint8_t[]>(SNIFFING_BUFFER_SIZE); if (!mSniffingBuffer) { return NS_ERROR_OUT_OF_MEMORY; } } memcpy(&mSniffingBuffer[mSniffingLength], aFromSegment.Elements(), aFromSegment.Length()); mSniffingLength += aFromSegment.Length(); return NS_OK; @@ -800,27 +797,27 @@ nsresult nsHtml5StreamParser::WriteStrea mTreeBuilder->TryToEnableEncodingMenu(); } } src = src.From(read); totalRead += read; mLastBuffer->AdvanceEnd(written); if (result == kOutputFull) { RefPtr<nsHtml5OwningUTF16Buffer> newBuf = - nsHtml5OwningUTF16Buffer::FalliblyCreate( - READ_BUFFER_SIZE); + nsHtml5OwningUTF16Buffer::FalliblyCreate(READ_BUFFER_SIZE); if (!newBuf) { MarkAsBroken(NS_ERROR_OUT_OF_MEMORY); return NS_ERROR_OUT_OF_MEMORY; } mLastBuffer = (mLastBuffer->next = newBuf.forget()); } else { MOZ_ASSERT(totalRead == aFromSegment.Length(), "The Unicode decoder consumed the wrong number of bytes."); - if (mDecodingLocalFileAsUTF8 && mLocalFileBytesBuffered == LOCAL_FILE_UTF_8_BUFFER_SIZE) { + if (mDecodingLocalFileAsUTF8 && + mLocalFileBytesBuffered == LOCAL_FILE_UTF_8_BUFFER_SIZE) { CommitLocalFileToUTF8(); } return NS_OK; } } } void nsHtml5StreamParser::ReDecodeLocalFile() { @@ -836,18 +833,17 @@ void nsHtml5StreamParser::ReDecodeLocalF mLastBuffer->setEnd(0); // Decode again for (auto&& buffer : mBufferedLocalFileData) { DoDataAvailable(buffer); } } -void nsHtml5StreamParser::CommitLocalFileToUTF8() -{ +void nsHtml5StreamParser::CommitLocalFileToUTF8() { MOZ_ASSERT(mDecodingLocalFileAsUTF8); mDecodingLocalFileAsUTF8 = false; mFeedChardetIfEncoding = nullptr; mEncoding = UTF_8_ENCODING; mCharsetSource = kCharsetFromFileURLGuess; mTreeBuilder->SetDocumentCharset(mEncoding, mCharsetSource); if (recordreplay::IsRecordingOrReplaying()) { @@ -950,18 +946,17 @@ nsresult nsHtml5StreamParser::OnStartReq * If you move the following line, be very careful not to cause * WillBuildModel to be called before the document has had its * script global object set. */ rv = mExecutor->WillBuildModel(eDTDMode_unknown); NS_ENSURE_SUCCESS(rv, rv); RefPtr<nsHtml5OwningUTF16Buffer> newBuf = - nsHtml5OwningUTF16Buffer::FalliblyCreate( - READ_BUFFER_SIZE); + nsHtml5OwningUTF16Buffer::FalliblyCreate(READ_BUFFER_SIZE); if (!newBuf) { // marks this stream parser as terminated, // which prevents entry to code paths that // would use mFirstBuffer or mLastBuffer. return mExecutor->MarkAsBroken(NS_ERROR_OUT_OF_MEMORY); } MOZ_ASSERT(!mFirstBuffer, "How come we have the first buffer set?"); MOZ_ASSERT(!mLastBuffer, "How come we have the last buffer set?"); @@ -1114,18 +1109,17 @@ void nsHtml5StreamParser::DoStopRequest( if (mEncoding == UTF_8_ENCODING) { mTreeBuilder->TryToEnableEncodingMenu(); } } MOZ_ASSERT(read == 0, "How come an empty span was read form?"); mLastBuffer->AdvanceEnd(written); if (result == kOutputFull) { RefPtr<nsHtml5OwningUTF16Buffer> newBuf = - nsHtml5OwningUTF16Buffer::FalliblyCreate( - READ_BUFFER_SIZE); + nsHtml5OwningUTF16Buffer::FalliblyCreate(READ_BUFFER_SIZE); if (!newBuf) { MarkAsBroken(NS_ERROR_OUT_OF_MEMORY); return; } mLastBuffer = (mLastBuffer->next = newBuf.forget()); } else { if (mDecodingLocalFileAsUTF8) { MOZ_ASSERT(mLocalFileBytesBuffered < LOCAL_FILE_UTF_8_BUFFER_SIZE); @@ -1168,18 +1162,18 @@ nsresult nsHtml5StreamParser::OnStopRequ } nsCOMPtr<nsIRunnable> stopper = new nsHtml5RequestStopper(this); if (NS_FAILED(mEventTarget->Dispatch(stopper, nsIThread::DISPATCH_NORMAL))) { NS_WARNING("Dispatching StopRequest event failed."); } return NS_OK; } -void nsHtml5StreamParser::DoDataAvailableBuffer(mozilla::Buffer<uint8_t>&& aBuffer) -{ +void nsHtml5StreamParser::DoDataAvailableBuffer( + mozilla::Buffer<uint8_t>&& aBuffer) { if (MOZ_LIKELY(!mDecodingLocalFileAsUTF8)) { DoDataAvailable(aBuffer); return; } CheckedInt<size_t> bufferedPlusLength(aBuffer.Length()); bufferedPlusLength += mLocalFileBytesBuffered; if (!bufferedPlusLength.isValid()) { MarkAsBroken(NS_ERROR_OUT_OF_MEMORY); @@ -1223,32 +1217,32 @@ void nsHtml5StreamParser::DoDataAvailabl // Do this clean-up here to avoid use-after-free when // DoDataAvailable is passed a span pointing into an // element of mBufferedLocalFileData. if (!mDecodingLocalFileAsUTF8) { mBufferedLocalFileData.Clear(); } } - void nsHtml5StreamParser::DoDataAvailable(Span<const uint8_t> aBuffer) { NS_ASSERTION(IsParserThread(), "Wrong thread!"); MOZ_RELEASE_ASSERT(STREAM_BEING_READ == mStreamState, "DoDataAvailable called when stream not open."); mTokenizerMutex.AssertCurrentThreadOwns(); if (IsTerminated()) { return; } nsresult rv; if (HasDecoder()) { if ((mFeedChardetIfEncoding == mEncoding) && !mDecodingLocalFileAsUTF8) { bool dontFeed; - mChardet->DoIt((const char*)aBuffer.Elements(), aBuffer.Length(), &dontFeed); + mChardet->DoIt((const char*)aBuffer.Elements(), aBuffer.Length(), + &dontFeed); if (dontFeed) { mFeedChardetIfEncoding = nullptr; } } rv = WriteStreamBytes(aBuffer); } else { rv = SniffStreamBytes(aBuffer); }
--- a/parser/html/nsHtml5StreamParser.h +++ b/parser/html/nsHtml5StreamParser.h @@ -102,17 +102,17 @@ enum eHtml5StreamState { class nsHtml5StreamParser final : public nsICharsetDetectionObserver { template <typename T> using NotNull = mozilla::NotNull<T>; using Encoding = mozilla::Encoding; const uint32_t SNIFFING_BUFFER_SIZE = 1024; const uint32_t READ_BUFFER_SIZE = 1024; - const uint32_t LOCAL_FILE_UTF_8_BUFFER_SIZE = 1024*1024*4; // 4 MB + const uint32_t LOCAL_FILE_UTF_8_BUFFER_SIZE = 1024 * 1024 * 4; // 4 MB friend class nsHtml5RequestStopper; friend class nsHtml5DataAvailable; friend class nsHtml5StreamParserContinuation; friend class nsHtml5TimerKungFu; friend class nsHtml5StreamParserPtr; public:
--- a/toolkit/components/reputationservice/LoginReputation.cpp +++ b/toolkit/components/reputationservice/LoginReputation.cpp @@ -447,17 +447,19 @@ nsresult LoginReputationService::Finish( NS_IMETHODIMP LoginReputationService::Observe(nsISupports* aSubject, const char* aTopic, const char16_t* aData) { if (!strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) { nsDependentString data(aData); if (data.EqualsLiteral(PREF_PP_ENABLED)) { - nsresult rv = StaticPrefs::browser_safebrowsing_passwords_enabled() ? Enable() : Disable(); + nsresult rv = StaticPrefs::browser_safebrowsing_passwords_enabled() + ? Enable() + : Disable(); Unused << NS_WARN_IF(NS_FAILED(rv)); } } else if (!strcmp(aTopic, "quit-application")) { // Prepare to shutdown, won't allow any query request after 'gShuttingDown' // is set. gShuttingDown = true; } else if (!strcmp(aTopic, "profile-before-change")) { gShuttingDown = true;
--- a/toolkit/mozapps/update/updater/updater.cpp +++ b/toolkit/mozapps/update/updater/updater.cpp @@ -2963,19 +2963,19 @@ int NS_main(int argc, NS_tchar **argv) { // Continue to update since the parent application sometimes doesn't // exit (see bug 1375242) so any fixes to the parent application will // be applied instead of leaving the client in a broken state. LOG(("The parent process didn't exit! Continuing with update.")); } } } #else - if (pid > 0) { - waitpid(pid, nullptr, 0); - } + if (pid > 0) { + waitpid(pid, nullptr, 0); + } #endif #ifdef XP_WIN if (sReplaceRequest || sStagedUpdate) { // On Windows, when performing a stage or replace request the current // working directory for the process must be changed so it isn't locked. NS_tchar sysDir[MAX_PATH + 1] = {L'\0'}; if (GetSystemDirectoryW(sysDir, MAX_PATH + 1)) {
--- a/toolkit/recordreplay/ProcessRedirectDarwin.cpp +++ b/toolkit/recordreplay/ProcessRedirectDarwin.cpp @@ -156,39 +156,39 @@ void ReplayInvokeCallback(size_t aCallba } /////////////////////////////////////////////////////////////////////////////// // Middleman Call Helpers /////////////////////////////////////////////////////////////////////////////// // List of the Objective C classes which messages might be sent to directly. static const char* gStaticClassNames[] = { - // Standard classes. - "NSAutoreleasePool", - "NSBezierPath", - "NSButtonCell", - "NSColor", - "NSComboBoxCell", - "NSDictionary", - "NSGraphicsContext", - "NSFont", - "NSFontManager", - "NSLevelIndicatorCell", - "NSNumber", - "NSPopUpButtonCell", - "NSProgressBarCell", - "NSString", - "NSWindow", + // Standard classes. + "NSAutoreleasePool", + "NSBezierPath", + "NSButtonCell", + "NSColor", + "NSComboBoxCell", + "NSDictionary", + "NSGraphicsContext", + "NSFont", + "NSFontManager", + "NSLevelIndicatorCell", + "NSNumber", + "NSPopUpButtonCell", + "NSProgressBarCell", + "NSString", + "NSWindow", - // Gecko defined classes. - "CellDrawView", - "CheckboxCell", - "RadioButtonCell", - "SearchFieldCellWithFocusRing", - "ToolbarSearchFieldCellWithFocusRing", + // Gecko defined classes. + "CellDrawView", + "CheckboxCell", + "RadioButtonCell", + "SearchFieldCellWithFocusRing", + "ToolbarSearchFieldCellWithFocusRing", }; // Objective C classes for each of the above class names. static Class* gStaticClasses; // Inputs that originate from static data in the replaying process itself // rather than from previous middleman calls. enum class ObjCInputKind { @@ -201,19 +201,17 @@ struct CFConstantString { Class mClass; size_t mStuff; char* mData; size_t mLength; }; static Class gCFConstantStringClass; -static void -InitializeStaticClasses() -{ +static void InitializeStaticClasses() { gStaticClasses = new Class[ArrayLength(gStaticClassNames)]; for (size_t i = 0; i < ArrayLength(gStaticClassNames); i++) { gStaticClasses[i] = objc_lookUpClass(gStaticClassNames[i]); MOZ_RELEASE_ASSERT(gStaticClasses[i]); } gCFConstantStringClass = objc_lookUpClass("__NSCFConstantString");
--- a/toolkit/xre/nsAppRunner.cpp +++ b/toolkit/xre/nsAppRunner.cpp @@ -5117,17 +5117,16 @@ extern "C" void GeckoCrashOOL(const char const char* aReason) { MOZ_CrashOOL(aFilename, aLine, aReason); } // From toolkit/library/rust/shared/lib.rs extern "C" void install_rust_panic_hook(); extern "C" void install_rust_oom_hook(); - struct InstallRustHooks { InstallRustHooks() { install_rust_panic_hook(); install_rust_oom_hook(); } }; InstallRustHooks sInstallRustHooks;
--- a/widget/gtk/nsNativeThemeGTK.cpp +++ b/widget/gtk/nsNativeThemeGTK.cpp @@ -1087,24 +1087,22 @@ bool nsNativeThemeGTK::GetExtraSizeForWi gint scale = GetMonitorScaleFactor(aFrame); aExtra->top *= scale; aExtra->right *= scale; aExtra->bottom *= scale; aExtra->left *= scale; return true; } -bool -nsNativeThemeGTK::IsWidgetVisible(StyleAppearance aAppearance) -{ +bool nsNativeThemeGTK::IsWidgetVisible(StyleAppearance aAppearance) { switch (aAppearance) { - case StyleAppearance::MozWindowButtonBox: - return false; - default: - break; + case StyleAppearance::MozWindowButtonBox: + return false; + default: + break; } return true; } NS_IMETHODIMP nsNativeThemeGTK::DrawWidgetBackground(gfxContext* aContext, nsIFrame* aFrame, StyleAppearance aAppearance, const nsRect& aRect,
--- a/xpcom/base/CycleCollectedJSRuntime.cpp +++ b/xpcom/base/CycleCollectedJSRuntime.cpp @@ -246,17 +246,18 @@ static void ShouldWeakMappingEntryBeBlac return; } if (!JS::IsCCTraceKind(aKey.kind())) { aKey = nullptr; } if (keyMightNeedMarking && aKey.is<JSObject>()) { - JSObject* kdelegate = js::UncheckedUnwrapWithoutExpose(&aKey.as<JSObject>()); + JSObject* kdelegate = + js::UncheckedUnwrapWithoutExpose(&aKey.as<JSObject>()); if (kdelegate && !JS::ObjectIsMarkedGray(kdelegate) && (!aMap || !JS::ObjectIsMarkedGray(aMap))) { *aKeyShouldBeBlack = true; } } if (aValue && JS::GCThingIsMarkedGray(aValue) && (!aKey || !JS::GCThingIsMarkedGray(aKey)) &&
--- a/xpcom/base/MemoryTelemetry.h +++ b/xpcom/base/MemoryTelemetry.h @@ -30,17 +30,18 @@ enum class ResponseRejectReason; class MemoryTelemetry final : public nsIObserver, public nsSupportsWeakReference { public: NS_DECL_ISUPPORTS NS_DECL_NSIOBSERVER static MemoryTelemetry& Get(); - nsresult GatherReports(const std::function<void()>& aCompletionCallback = nullptr); + nsresult GatherReports( + const std::function<void()>& aCompletionCallback = nullptr); void GetUniqueSetSize(std::function<void(const int64_t&)>&& aCallback); /** * Does expensive initialization, which should happen only after startup has * completed, and the event loop is idle. */ nsresult DelayedInit();