Bug 1509226 - Avoid allocations to serialize clips. r=jrmuizel
authorMatt Woodrow <mwoodrow@mozilla.com>
Mon, 26 Nov 2018 02:32:15 +0000
changeset 447960 d6509279d52e5c1a9b2951b88f23a989470ff195
parent 447959 f5c8fe43b6ee1be0f100ff3777c8d99c4ce8af40
child 447961 c65a0f1862dd7cbd485b9ea44618155b85156486
push id73646
push usermwoodrow@mozilla.com
push dateMon, 26 Nov 2018 02:56:40 +0000
treeherderautoland@d6509279d52e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1509226
milestone65.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
Bug 1509226 - Avoid allocations to serialize clips. r=jrmuizel MozReview-Commit-ID: CetmS5cZCMP Differential Revision: https://phabricator.services.mozilla.com/D12721
gfx/layers/wr/ClipManager.cpp
gfx/webrender_bindings/WebRenderAPI.cpp
--- a/gfx/layers/wr/ClipManager.cpp
+++ b/gfx/layers/wr/ClipManager.cpp
@@ -330,17 +330,17 @@ ClipManager::DefineScrollLayers(const Ac
   return scrollId;
 }
 
 Maybe<wr::WrClipChainId>
 ClipManager::DefineClipChain(const DisplayItemClipChain* aChain,
                              int32_t aAppUnitsPerDevPixel,
                              const StackingContextHelper& aSc)
 {
-  nsTArray<wr::WrClipId> clipIds;
+  AutoTArray<wr::WrClipId, 6> clipIds;
   // Iterate through the clips in the current item's clip chain, define them
   // in WR, and put their IDs into |clipIds|.
   for (const DisplayItemClipChain* chain = aChain; chain; chain = chain->mParent) {
     ClipIdMap& cache = mCacheStack.top();
     auto it = cache.find(chain);
     if (it != cache.end()) {
       // Found it in the currently-active cache, so just use the id we have for
       // it.
--- a/gfx/webrender_bindings/WebRenderAPI.cpp
+++ b/gfx/webrender_bindings/WebRenderAPI.cpp
@@ -913,17 +913,17 @@ DisplayListBuilder::DefineClipChain(cons
                                     const nsTArray<wr::WrClipId>& aClips)
 {
   uint64_t clipchainId = wr_dp_define_clipchain(mWrState,
       aParent ? &(aParent->id) : nullptr,
       aClips.Elements(), aClips.Length());
   WRDL_LOG("DefineClipChain id=%" PRIu64 " p=%s clips=%zu\n", mWrState,
       clipchainId,
       aParent ? Stringify(aParent->id).c_str() : "(nil)",
-      clipIds.Length());
+      aClips.Length());
   return wr::WrClipChainId{ clipchainId };
 }
 
 wr::WrClipId
 DisplayListBuilder::DefineClip(const Maybe<wr::WrClipId>& aParentId,
                                const wr::LayoutRect& aClipRect,
                                const nsTArray<wr::ComplexClipRegion>* aComplex,
                                const wr::WrImageMask* aMask)