Chromium Code Reviews| 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_; |