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

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..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_;

Powered by Google App Engine
This is Rietveld 408576698