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

Unified Diff: third_party/WebKit/Source/platform/heap/ThreadState.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/heap/ThreadState.h
diff --git a/third_party/WebKit/Source/platform/heap/ThreadState.h b/third_party/WebKit/Source/platform/heap/ThreadState.h
index 34b1ad25ece4b84fe5197863e3415a89616ff738..3c7e80197d09b5c923236f9b6b8eab5454a17210 100644
--- a/third_party/WebKit/Source/platform/heap/ThreadState.h
+++ b/third_party/WebKit/Source/platform/heap/ThreadState.h
@@ -158,6 +158,19 @@ class PLATFORM_EXPORT ThreadState {
ThreadState* state_;
};
+ class NoBackingReallocationScope final {
+ STACK_ALLOCATED();
+
+ public:
+ explicit NoBackingReallocationScope(ThreadState* state) : state_(state) {
+ state_->EnterNoBackingReallocationScope();
+ }
+ ~NoBackingReallocationScope() { state_->LeaveNoBackingReallocationScope(); }
+
+ private:
+ ThreadState* state_;
+ };
+
static void AttachMainThread();
// Associate ThreadState object with the current thread. After this
@@ -261,6 +274,11 @@ class PLATFORM_EXPORT ThreadState {
mixins_being_constructed_count_--;
}
bool SweepForbidden() const { return sweep_forbidden_; }
+ bool IsBackingReallocationAllowed() const {
+ return !no_backing_reallocation_;
+ }
+ void EnterNoBackingReallocationScope() { no_backing_reallocation_ = true; }
haraken 2017/04/12 06:44:34 Add DCHECK(!no_backing_reallocation_).
keishi 2017/04/12 09:43:53 Done.
+ void LeaveNoBackingReallocationScope() { no_backing_reallocation_ = false; }
haraken 2017/04/12 06:44:34 Add DCHECK(no_backing_reallocation_).
keishi 2017/04/12 09:43:53 Done.
class MainThreadGCForbiddenScope final {
STACK_ALLOCATED();
@@ -625,6 +643,7 @@ class PLATFORM_EXPORT ThreadState {
size_t gc_forbidden_count_;
size_t mixins_being_constructed_count_;
double accumulated_sweeping_time_;
+ bool no_backing_reallocation_;
BaseArena* arenas_[BlinkGC::kNumberOfArenas];
int vector_backing_arena_index_;

Powered by Google App Engine
This is Rietveld 408576698