OLD | NEW |
---|---|
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 Loading... | |
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(); |
Yuki
2017/06/23 15:20:45
Once CurrentThread() is implemented, we should rev
peria
2017/06/27 09:52:37
Done.
| |
98 if (!current_thread || !current_thread->Scheduler()) | |
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 Loading... | |
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 |
OLD | NEW |