Bug 1639563 - make WROTSAlloc::Grow check capacity instead of length. r=jrmuizel
authorLee Salzman <lsalzman@mozilla.com>
Sat, 23 May 2020 17:47:32 +0000
changeset 531803 ddf302b8b8a92d2e4da9c8889621c04860c146b0
parent 531802 59cfc02045fd5adde7f37ddd1872722ca324cd21
child 531804 fc9af2e86dbd94431d70152af2e4552127c1bb3a
push id116883
push userlsalzman@mozilla.com
push dateSat, 23 May 2020 17:48:13 +0000
treeherderautoland@fc9af2e86dbd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1639563
milestone78.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 1639563 - make WROTSAlloc::Grow check capacity instead of length. r=jrmuizel Differential Revision: https://phabricator.services.mozilla.com/D76582
gfx/layers/wr/WebRenderBridgeParent.cpp
gfx/webrender_bindings/WebRenderTypes.h
--- a/gfx/layers/wr/WebRenderBridgeParent.cpp
+++ b/gfx/layers/wr/WebRenderBridgeParent.cpp
@@ -429,18 +429,18 @@ void WebRenderBridgeParent::Destroy() {
   mDestroyed = true;
   ClearResources();
 }
 
 struct WROTSAlloc {
   wr::Vec<uint8_t> mVec;
 
   void* Grow(void* aPtr, size_t aLength) {
-    if (aLength > mVec.Length()) {
-      mVec.Reserve(aLength - mVec.Length());
+    if (aLength > mVec.Capacity()) {
+      mVec.Reserve(aLength - mVec.Capacity());
     }
     return mVec.inner.data;
   }
   wr::Vec<uint8_t> ShrinkToFit(void* aPtr, size_t aLength) {
     wr::Vec<uint8_t> result(std::move(mVec));
     result.inner.length = aLength;
     return result;
   }
--- a/gfx/webrender_bindings/WebRenderTypes.h
+++ b/gfx/webrender_bindings/WebRenderTypes.h
@@ -651,16 +651,18 @@ struct Vec<uint8_t> final {
     inner.capacity = 0;
     inner.length = 0;
   }
 
   uint8_t* Data() { return inner.data; }
 
   size_t Length() { return inner.length; }
 
+  size_t Capacity() { return inner.capacity; }
+
   Range<uint8_t> GetRange() { return Range<uint8_t>(Data(), Length()); }
 
   void PushBytes(Range<uint8_t> aBytes) {
     wr_vec_u8_push_bytes(&inner, RangeToByteSlice(aBytes));
   }
 
   void Reserve(size_t aLength) { wr_vec_u8_reserve(&inner, aLength); }