Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Unified Diff: third_party/WebKit/Source/platform/wtf/Vector.h

Issue 2815663002: Disable collection backing reallocation during pre finalizer (Closed)
Patch Set: fix Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/wtf/Vector.h
diff --git a/third_party/WebKit/Source/platform/wtf/Vector.h b/third_party/WebKit/Source/platform/wtf/Vector.h
index ad56d5760335b86d2e66feb8d61db9f4118de9d4..7b83ba45c07763ad66acaec9c486bc4d914f60f3 100644
--- a/third_party/WebKit/Source/platform/wtf/Vector.h
+++ b/third_party/WebKit/Source/platform/wtf/Vector.h
@@ -1594,6 +1594,9 @@ void Vector<T, inlineCapacity, Allocator>::ReserveCapacity(
ANNOTATE_CHANGE_CAPACITY(begin(), old_capacity, size_, Capacity());
return;
}
+ if (!Allocator::IsAllocationAllowed())
+ return;
+
T* old_end = end();
Base::AllocateExpandedBuffer(new_capacity);
ANNOTATE_NEW_BUFFER(begin(), Capacity(), size_);
@@ -1623,6 +1626,9 @@ void Vector<T, inlineCapacity, Allocator>::ShrinkCapacity(size_t new_capacity) {
if (new_capacity < size())
Shrink(new_capacity);
+ if (!Allocator::IsAllocationAllowed())
+ return;
+
T* old_buffer = begin();
#ifdef ANNOTATE_CONTIGUOUS_CONTAINER
size_t old_capacity = Capacity();

Powered by Google App Engine
This is Rietveld 408576698