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..9e4ff8bd5666c13e7ee29d5d72e64132b6243ad1 100644 |
| --- a/third_party/WebKit/Source/platform/heap/ThreadState.h |
| +++ b/third_party/WebKit/Source/platform/heap/ThreadState.h |
| @@ -158,6 +158,22 @@ class PLATFORM_EXPORT ThreadState { |
| ThreadState* state_; |
| }; |
| + class ObjectRessurectionForbiddenScope final { |
|
haraken
2017/04/12 11:03:37
Add a class-level comment.
keishi
2017/04/13 05:22:43
Done.
|
| + STACK_ALLOCATED(); |
| + |
| + public: |
| + explicit ObjectRessurectionForbiddenScope(ThreadState* state) |
| + : state_(state) { |
| + state_->EnterObjectRessurectionForbiddenScope(); |
| + } |
| + ~ObjectRessurectionForbiddenScope() { |
| + state_->LeaveObjectRessurectionForbiddenScope(); |
| + } |
| + |
| + private: |
| + ThreadState* state_; |
| + }; |
| + |
| static void AttachMainThread(); |
| // Associate ThreadState object with the current thread. After this |
| @@ -261,6 +277,17 @@ class PLATFORM_EXPORT ThreadState { |
| mixins_being_constructed_count_--; |
| } |
| bool SweepForbidden() const { return sweep_forbidden_; } |
| + bool IsObjectRessurectionForbidden() const { |
| + return object_ressurection_forbidden_; |
| + } |
| + void EnterObjectRessurectionForbiddenScope() { |
| + DCHECK(!object_ressurection_forbidden_); |
| + object_ressurection_forbidden_ = true; |
| + } |
| + void LeaveObjectRessurectionForbiddenScope() { |
| + DCHECK(object_ressurection_forbidden_); |
| + object_ressurection_forbidden_ = false; |
| + } |
| class MainThreadGCForbiddenScope final { |
| STACK_ALLOCATED(); |
| @@ -625,6 +652,7 @@ class PLATFORM_EXPORT ThreadState { |
| size_t gc_forbidden_count_; |
| size_t mixins_being_constructed_count_; |
| double accumulated_sweeping_time_; |
| + bool object_ressurection_forbidden_; |
| BaseArena* arenas_[BlinkGC::kNumberOfArenas]; |
| int vector_backing_arena_index_; |