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 "bindings/core/v8/ScriptWrappableVisitor.h" | 5 #include "bindings/core/v8/ScriptWrappableVisitor.h" |
6 | 6 |
7 #include "bindings/core/v8/ActiveScriptWrappable.h" | 7 #include "bindings/core/v8/ActiveScriptWrappable.h" |
8 #include "bindings/core/v8/DOMWrapperWorld.h" | 8 #include "bindings/core/v8/DOMWrapperWorld.h" |
9 #include "bindings/core/v8/ScopedPersistent.h" | 9 #include "bindings/core/v8/ScopedPersistent.h" |
10 #include "bindings/core/v8/ScriptWrappableVisitorVerifier.h" | 10 #include "bindings/core/v8/ScriptWrappableVisitorVerifier.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 97 |
98 void ScriptWrappableVisitor::scheduleIdleLazyCleanup() { | 98 void ScriptWrappableVisitor::scheduleIdleLazyCleanup() { |
99 // Some threads (e.g. PPAPI thread) don't have a scheduler. | 99 // Some threads (e.g. PPAPI thread) don't have a scheduler. |
100 if (!Platform::current()->currentThread()->scheduler()) | 100 if (!Platform::current()->currentThread()->scheduler()) |
101 return; | 101 return; |
102 | 102 |
103 if (m_idleCleanupTaskScheduled) | 103 if (m_idleCleanupTaskScheduled) |
104 return; | 104 return; |
105 | 105 |
106 Platform::current()->currentThread()->scheduler()->postIdleTask( | 106 Platform::current()->currentThread()->scheduler()->postIdleTask( |
107 BLINK_FROM_HERE, WTF::bind(&ScriptWrappableVisitor::performLazyCleanup, | 107 BLINK_FROM_HERE, |
108 WTF::unretained(this))); | 108 WTF::bind(&ScriptWrappableVisitor::performLazyCleanup, |
| 109 WTF::unretained(this))); |
109 m_idleCleanupTaskScheduled = true; | 110 m_idleCleanupTaskScheduled = true; |
110 } | 111 } |
111 | 112 |
112 void ScriptWrappableVisitor::performLazyCleanup(double deadlineSeconds) { | 113 void ScriptWrappableVisitor::performLazyCleanup(double deadlineSeconds) { |
113 m_idleCleanupTaskScheduled = false; | 114 m_idleCleanupTaskScheduled = false; |
114 | 115 |
115 if (!m_shouldCleanup) | 116 if (!m_shouldCleanup) |
116 return; | 117 return; |
117 | 118 |
118 TRACE_EVENT1("blink_gc,devtools.timeline", | 119 TRACE_EVENT1("blink_gc,devtools.timeline", |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 V8PerIsolateData::from(isolate)->scriptWrappableVisitor(); | 303 V8PerIsolateData::from(isolate)->scriptWrappableVisitor(); |
303 if (scriptWrappableVisitor) | 304 if (scriptWrappableVisitor) |
304 scriptWrappableVisitor->performCleanup(); | 305 scriptWrappableVisitor->performCleanup(); |
305 } | 306 } |
306 | 307 |
307 WrapperVisitor* ScriptWrappableVisitor::currentVisitor(v8::Isolate* isolate) { | 308 WrapperVisitor* ScriptWrappableVisitor::currentVisitor(v8::Isolate* isolate) { |
308 return V8PerIsolateData::from(isolate)->scriptWrappableVisitor(); | 309 return V8PerIsolateData::from(isolate)->scriptWrappableVisitor(); |
309 } | 310 } |
310 | 311 |
311 } // namespace blink | 312 } // namespace blink |
OLD | NEW |