| 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/ScriptWrappable.h" | 10 #include "bindings/core/v8/ScriptWrappable.h" |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 | 251 |
| 252 void ScriptWrappableVisitor::TraceWrappers( | 252 void ScriptWrappableVisitor::TraceWrappers( |
| 253 const TraceWrapperV8Reference<v8::Value>& traced_wrapper) const { | 253 const TraceWrapperV8Reference<v8::Value>& traced_wrapper) const { |
| 254 MarkWrapper( | 254 MarkWrapper( |
| 255 &(const_cast<TraceWrapperV8Reference<v8::Value>&>(traced_wrapper).Get())); | 255 &(const_cast<TraceWrapperV8Reference<v8::Value>&>(traced_wrapper).Get())); |
| 256 } | 256 } |
| 257 | 257 |
| 258 void ScriptWrappableVisitor::MarkWrapper( | 258 void ScriptWrappableVisitor::MarkWrapper( |
| 259 const v8::PersistentBase<v8::Value>* handle) const { | 259 const v8::PersistentBase<v8::Value>* handle) const { |
| 260 // The write barrier may try to mark a wrapper because cleanup is still | 260 // The write barrier may try to mark a wrapper because cleanup is still |
| 261 // delayed. Bail out in this case. | 261 // delayed. Bail out in this case. We also allow unconditional marking which |
| 262 if (!m_tracingInProgress) | 262 // requires us to bail out here when tracing is not in progress. |
| 263 if (!tracing_in_progress_ || handle->IsEmpty()) |
| 263 return; | 264 return; |
| 264 handle->RegisterExternalReference(isolate_); | 265 handle->RegisterExternalReference(isolate_); |
| 265 } | 266 } |
| 266 | 267 |
| 267 void ScriptWrappableVisitor::DispatchTraceWrappers( | 268 void ScriptWrappableVisitor::DispatchTraceWrappers( |
| 268 const TraceWrapperBase* wrapper_base) const { | 269 const TraceWrapperBase* wrapper_base) const { |
| 269 wrapper_base->TraceWrappers(this); | 270 wrapper_base->TraceWrappers(this); |
| 270 } | 271 } |
| 271 | 272 |
| 272 void ScriptWrappableVisitor::InvalidateDeadObjectsInMarkingDeque() { | 273 void ScriptWrappableVisitor::InvalidateDeadObjectsInMarkingDeque() { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 V8PerIsolateData::From(isolate)->GetScriptWrappableVisitor(); | 305 V8PerIsolateData::From(isolate)->GetScriptWrappableVisitor(); |
| 305 if (script_wrappable_visitor) | 306 if (script_wrappable_visitor) |
| 306 script_wrappable_visitor->PerformCleanup(); | 307 script_wrappable_visitor->PerformCleanup(); |
| 307 } | 308 } |
| 308 | 309 |
| 309 WrapperVisitor* ScriptWrappableVisitor::CurrentVisitor(v8::Isolate* isolate) { | 310 WrapperVisitor* ScriptWrappableVisitor::CurrentVisitor(v8::Isolate* isolate) { |
| 310 return V8PerIsolateData::From(isolate)->GetScriptWrappableVisitor(); | 311 return V8PerIsolateData::From(isolate)->GetScriptWrappableVisitor(); |
| 311 } | 312 } |
| 312 | 313 |
| 313 } // namespace blink | 314 } // namespace blink |
| OLD | NEW |