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

Side by Side Diff: third_party/WebKit/Source/platform/bindings/ScriptWrappableVisitor.cpp

Issue 2841443005: [Bindings] Create and use V8 context snapshots (Closed)
Patch Set: Work for all comments Created 3 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "platform/bindings/ScriptWrappableVisitor.h" 5 #include "platform/bindings/ScriptWrappableVisitor.h"
6 6
7 #include "platform/bindings/ActiveScriptWrappable.h" 7 #include "platform/bindings/ActiveScriptWrappable.h"
8 #include "platform/bindings/DOMWrapperWorld.h" 8 #include "platform/bindings/DOMWrapperWorld.h"
9 #include "platform/bindings/ScopedPersistent.h" 9 #include "platform/bindings/ScopedPersistent.h"
10 #include "platform/bindings/ScriptWrappable.h" 10 #include "platform/bindings/ScriptWrappable.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 } 87 }
88 88
89 headers_to_unmark_.clear(); 89 headers_to_unmark_.clear();
90 marking_deque_.clear(); 90 marking_deque_.clear();
91 verifier_deque_.clear(); 91 verifier_deque_.clear();
92 should_cleanup_ = false; 92 should_cleanup_ = false;
93 } 93 }
94 94
95 void ScriptWrappableVisitor::ScheduleIdleLazyCleanup() { 95 void ScriptWrappableVisitor::ScheduleIdleLazyCleanup() {
96 // Some threads (e.g. PPAPI thread) don't have a scheduler. 96 // Some threads (e.g. PPAPI thread) don't have a scheduler.
97 if (!Platform::Current()->CurrentThread()->Scheduler()) 97 WebThread* current_thread = Platform::Current()->CurrentThread();
98 if (!current_thread || !current_thread->Scheduler())
Yuki 2017/06/20 14:20:11 Why current_thread can be null?
peria 2017/06/21 07:19:16 ditto to V8Initializer.cpp
98 return; 99 return;
99 100
100 if (idle_cleanup_task_scheduled_) 101 if (idle_cleanup_task_scheduled_)
101 return; 102 return;
102 103
103 Platform::Current()->CurrentThread()->Scheduler()->PostIdleTask( 104 current_thread->Scheduler()->PostIdleTask(
104 BLINK_FROM_HERE, WTF::Bind(&ScriptWrappableVisitor::PerformLazyCleanup, 105 BLINK_FROM_HERE, WTF::Bind(&ScriptWrappableVisitor::PerformLazyCleanup,
105 WTF::Unretained(this))); 106 WTF::Unretained(this)));
106 idle_cleanup_task_scheduled_ = true; 107 idle_cleanup_task_scheduled_ = true;
107 } 108 }
108 109
109 void ScriptWrappableVisitor::PerformLazyCleanup(double deadline_seconds) { 110 void ScriptWrappableVisitor::PerformLazyCleanup(double deadline_seconds) {
110 idle_cleanup_task_scheduled_ = false; 111 idle_cleanup_task_scheduled_ = false;
111 112
112 if (!should_cleanup_) 113 if (!should_cleanup_)
113 return; 114 return;
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 V8PerIsolateData::From(isolate)->GetScriptWrappableVisitor(); 302 V8PerIsolateData::From(isolate)->GetScriptWrappableVisitor();
302 if (script_wrappable_visitor) 303 if (script_wrappable_visitor)
303 script_wrappable_visitor->PerformCleanup(); 304 script_wrappable_visitor->PerformCleanup();
304 } 305 }
305 306
306 WrapperVisitor* ScriptWrappableVisitor::CurrentVisitor(v8::Isolate* isolate) { 307 WrapperVisitor* ScriptWrappableVisitor::CurrentVisitor(v8::Isolate* isolate) {
307 return V8PerIsolateData::From(isolate)->GetScriptWrappableVisitor(); 308 return V8PerIsolateData::From(isolate)->GetScriptWrappableVisitor();
308 } 309 }
309 310
310 } // namespace blink 311 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698