author | Andreea Pavel <apavel@mozilla.com> |
Thu, 28 Feb 2019 06:08:46 +0200 | |
changeset 461687 | 9311a433ea1beecdb14b2a25ba98d60fb83a4d8c |
parent 461686 | da0f977287bdc5fc72623f644953d9da00fbd38c |
child 461688 | c1e05d18c18e26802bfe4818a506d24d054a7c3c |
push id | 35626 |
push user | csabou@mozilla.com |
push date | Thu, 28 Feb 2019 11:31:08 +0000 |
treeherder | mozilla-central@2ea0c1db7e60 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
bugs | 1509466 |
milestone | 67.0a1 |
backs out | da0f977287bdc5fc72623f644953d9da00fbd38c de1481b9b6faab60a32f630fa50ec2a16db11773 |
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/dom/base/Document.cpp +++ b/dom/base/Document.cpp @@ -1163,19 +1163,32 @@ void Document::SelectorCache::NotifyExpi // the stage 2 of mozalloc_handle_oom(). // Once these objects are removed asynchronously, we should update the warning // added in mozalloc_handle_oom() as well. RemoveObject(aSelector); mTable.Remove(aSelector->mKey); delete aSelector; } -Document::FrameRequest::FrameRequest(FrameRequestCallback& aCallback, - int32_t aHandle) - : mCallback(&aCallback), mHandle(aHandle) {} +struct Document::FrameRequest { + FrameRequest(FrameRequestCallback& aCallback, int32_t aHandle) + : mCallback(&aCallback), mHandle(aHandle) {} + + // Conversion operator so that we can append these to a + // FrameRequestCallbackList + operator const RefPtr<FrameRequestCallback>&() const { return mCallback; } + + // Comparator operators to allow RemoveElementSorted with an + // integer argument on arrays of FrameRequest + bool operator==(int32_t aHandle) const { return mHandle == aHandle; } + bool operator<(int32_t aHandle) const { return mHandle < aHandle; } + + RefPtr<FrameRequestCallback> mCallback; + int32_t mHandle; +}; // ================================================================== // = // ================================================================== Document::Document(const char* aContentType) : nsINode(nullptr), DocumentOrShadowRoot(*this), mReferrerPolicySet(false), @@ -3655,20 +3668,19 @@ void Document::UpdateFrameRequestCallbac rd->ScheduleFrameRequestCallbacks(this); } else { rd->RevokeFrameRequestCallbacks(this); } mFrameRequestCallbacksScheduled = shouldBeScheduled; } -void Document::TakeFrameRequestCallbacks(nsTArray<FrameRequest>& aCallbacks) { - MOZ_ASSERT(aCallbacks.IsEmpty()); - aCallbacks.SwapElements(mFrameRequestCallbacks); - mCanceledFrameRequestCallbacks.clear(); +void Document::TakeFrameRequestCallbacks(FrameRequestCallbackList& aCallbacks) { + aCallbacks.AppendElements(mFrameRequestCallbacks); + mFrameRequestCallbacks.Clear(); // No need to manually remove ourselves from the refresh driver; it will // handle that part. But we do have to update our state. mFrameRequestCallbacksScheduled = false; } bool Document::ShouldThrottleFrameRequests() { if (mStaticCloneCount > 0) { // Even if we're not visible, a static clone may be, so run at full speed. @@ -8970,24 +8982,17 @@ nsresult Document::ScheduleFrameRequestC *aHandle = newHandle; return NS_OK; } void Document::CancelFrameRequestCallback(int32_t aHandle) { // mFrameRequestCallbacks is stored sorted by handle if (mFrameRequestCallbacks.RemoveElementSorted(aHandle)) { UpdateFrameRequestCallbackSchedulingState(); - } else { - Unused << mCanceledFrameRequestCallbacks.put(aHandle); - } -} - -bool Document::IsCanceledFrameRequestCallback(int32_t aHandle) const { - return !mCanceledFrameRequestCallbacks.empty() && - mCanceledFrameRequestCallbacks.has(aHandle); + } } nsresult Document::GetStateObject(nsIVariant** aState) { // Get the document's current state object. This is the object backing both // history.state and popStateEvent.state. // // mStateObjectContainer may be null; this just means that there's no // current state object.
--- a/dom/base/Document.h +++ b/dom/base/Document.h @@ -47,17 +47,16 @@ #include "nsContentListDeclarations.h" #include "nsExpirationTracker.h" #include "nsClassHashtable.h" #include "mozilla/CORSMode.h" #include "mozilla/dom/BrowsingContext.h" #include "mozilla/dom/ContentBlockingLog.h" #include "mozilla/dom/DispatcherTrait.h" #include "mozilla/dom/DocumentOrShadowRoot.h" -#include "mozilla/HashTable.h" #include "mozilla/LinkedList.h" #include "mozilla/NotNull.h" #include "mozilla/SegmentedVector.h" #include "mozilla/ServoBindingTypes.h" #include "mozilla/StyleSheet.h" #include "mozilla/TimeStamp.h" #include "mozilla/UniquePtr.h" #include <bitset> // for member @@ -2918,44 +2917,26 @@ class Document : public nsINode, DocumentTimeline* Timeline(); mozilla::LinkedList<DocumentTimeline>& Timelines() { return mTimelines; } void GetAnimations(nsTArray<RefPtr<Animation>>& aAnimations); SVGSVGElement* GetSVGRootElement() const; - struct FrameRequest { - FrameRequest(FrameRequestCallback& aCallback, int32_t aHandle); - - // Comparator operators to allow RemoveElementSorted with an - // integer argument on arrays of FrameRequest - bool operator==(int32_t aHandle) const { return mHandle == aHandle; } - bool operator<(int32_t aHandle) const { return mHandle < aHandle; } - - RefPtr<FrameRequestCallback> mCallback; - int32_t mHandle; - }; - nsresult ScheduleFrameRequestCallback(FrameRequestCallback& aCallback, int32_t* aHandle); void CancelFrameRequestCallback(int32_t aHandle); - /** - * Returns true if the handle refers to a callback that was canceled that - * we did not find in our list of callbacks (e.g. because it is one of those - * in the set of callbacks currently queued to be run). - */ - bool IsCanceledFrameRequestCallback(int32_t aHandle) const; - + typedef nsTArray<RefPtr<FrameRequestCallback>> FrameRequestCallbackList; /** * Put this document's frame request callbacks into the provided * list, and forget about them. */ - void TakeFrameRequestCallbacks(nsTArray<FrameRequest>& aCallbacks); + void TakeFrameRequestCallbacks(FrameRequestCallbackList& aCallbacks); /** * @return true if this document's frame request callbacks should be * throttled. We throttle requestAnimationFrame for documents which aren't * visible (e.g. scrolled out of the viewport). */ bool ShouldThrottleFrameRequests(); @@ -4394,22 +4375,20 @@ class Document : public nsINode, nsTArray<nsWeakPtr> mBlockedNodesByClassifier; // Weak reference to mScriptGlobalObject QI:d to nsPIDOMWindow, // updated on every set of mScriptGlobalObject. nsPIDOMWindowInner* mWindow; nsCOMPtr<nsIDocumentEncoder> mCachedEncoder; + struct FrameRequest; + nsTArray<FrameRequest> mFrameRequestCallbacks; - // The set of frame request callbacks that were canceled but which we failed - // to find in mFrameRequestCallbacks. - HashSet<int32_t> mCanceledFrameRequestCallbacks; - // This object allows us to evict ourself from the back/forward cache. The // pointer is non-null iff we're currently in the bfcache. nsIBFCacheEntry* mBFCacheEntry; // Our base target. nsString mBaseTarget; nsCOMPtr<nsIStructuredCloneContainer> mStateObjectContainer;
--- a/layout/base/nsRefreshDriver.cpp +++ b/layout/base/nsRefreshDriver.cpp @@ -1477,17 +1477,17 @@ void nsRefreshDriver::DoTick() { Tick(VsyncId(), TimeStamp::Now()); } } struct DocumentFrameCallbacks { explicit DocumentFrameCallbacks(Document* aDocument) : mDocument(aDocument) {} RefPtr<Document> mDocument; - nsTArray<Document::FrameRequest> mCallbacks; + Document::FrameRequestCallbackList mCallbacks; }; static nsDocShell* GetDocShell(nsPresContext* aPresContext) { return static_cast<nsDocShell*>(aPresContext->GetDocShell()); } static bool HasPendingAnimations(nsIPresShell* aShell) { Document* doc = aShell->GetDocument(); @@ -1669,21 +1669,17 @@ void nsRefreshDriver::RunFrameRequestCal if (innerWindow) { mozilla::dom::Performance* perf = innerWindow->GetPerformance(); if (perf) { timeStamp = perf->GetDOMTiming()->TimeStampToDOMHighRes(aNowTime); } // else window is partially torn down already } for (auto& callback : docCallbacks.mCallbacks) { - if (docCallbacks.mDocument->IsCanceledFrameRequestCallback( - callback.mHandle)) { - continue; - } - callback.mCallback->Call(timeStamp); + callback->Call(timeStamp); } } } } struct RunnableWithDelay { nsCOMPtr<nsIRunnable> mRunnable; uint32_t mDelay;
--- a/layout/style/ServoBindings.toml +++ b/layout/style/ServoBindings.toml @@ -344,22 +344,17 @@ opaque-types = [ "mozilla::dom::Optional", "mozilla::dom::OwningNodeOrString_Value", "mozilla::dom::Nullable", "mozilla::external::AtomicRefCounted", "RefPtr_Proxy", "RefPtr_Proxy_member_function", "nsAutoPtr_Proxy", "nsAutoPtr_Proxy_member_function", - "mozilla::detail::HashTable", # <- We should be able to remove this and - # HashSet below once - # https://github.com/rust-lang/rust-bindgen/pull/1515 - # is available "mozilla::detail::PointerType", - "mozilla::HashSet", "mozilla::Pair", "mozilla::Pair_Base", "mozilla::SeenPtrs", "mozilla::SupportsWeakPtr", "mozilla::Tuple", "SupportsWeakPtr", "mozilla::detail::WeakReference", "mozilla::WeakPtr",