| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "bindings/core/v8/V8GCController.h" | 31 #include "bindings/core/v8/V8GCController.h" |
| 32 | 32 |
| 33 #include "bindings/core/v8/ActiveScriptWrappable.h" | 33 #include "bindings/core/v8/ActiveScriptWrappable.h" |
| 34 #include "bindings/core/v8/RetainedDOMInfo.h" | 34 #include "bindings/core/v8/RetainedDOMInfo.h" |
| 35 #include "bindings/core/v8/ScriptWrappableHeapTracer.h" |
| 36 #include "bindings/core/v8/ScriptWrappableVisitor.h" |
| 35 #include "bindings/core/v8/V8AbstractEventListener.h" | 37 #include "bindings/core/v8/V8AbstractEventListener.h" |
| 36 #include "bindings/core/v8/V8Binding.h" | 38 #include "bindings/core/v8/V8Binding.h" |
| 37 #include "bindings/core/v8/V8MutationObserver.h" | 39 #include "bindings/core/v8/V8MutationObserver.h" |
| 38 #include "bindings/core/v8/V8Node.h" | 40 #include "bindings/core/v8/V8Node.h" |
| 39 #include "bindings/core/v8/V8ScriptRunner.h" | 41 #include "bindings/core/v8/V8ScriptRunner.h" |
| 40 #include "bindings/core/v8/WrapperTypeInfo.h" | 42 #include "bindings/core/v8/WrapperTypeInfo.h" |
| 41 #include "core/dom/Attr.h" | 43 #include "core/dom/Attr.h" |
| 42 #include "core/dom/Document.h" | 44 #include "core/dom/Document.h" |
| 43 #include "core/dom/NodeTraversal.h" | 45 #include "core/dom/NodeTraversal.h" |
| 44 #include "core/dom/TemplateContentDocumentFragment.h" | 46 #include "core/dom/TemplateContentDocumentFragment.h" |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 if (classId != WrapperTypeInfo::NodeClassId && classId != WrapperTypeInf
o::ObjectClassId) | 163 if (classId != WrapperTypeInfo::NodeClassId && classId != WrapperTypeInf
o::ObjectClassId) |
| 162 return; | 164 return; |
| 163 | 165 |
| 164 v8::Local<v8::Object> wrapper = v8::Local<v8::Object>::New(m_isolate, v8
::Persistent<v8::Object>::Cast(*value)); | 166 v8::Local<v8::Object> wrapper = v8::Local<v8::Object>::New(m_isolate, v8
::Persistent<v8::Object>::Cast(*value)); |
| 165 ASSERT(V8DOMWrapper::hasInternalFieldsSet(wrapper)); | 167 ASSERT(V8DOMWrapper::hasInternalFieldsSet(wrapper)); |
| 166 | 168 |
| 167 const WrapperTypeInfo* type = toWrapperTypeInfo(wrapper); | 169 const WrapperTypeInfo* type = toWrapperTypeInfo(wrapper); |
| 168 if (type->hasPendingActivity(wrapper)) { | 170 if (type->hasPendingActivity(wrapper)) { |
| 169 // If you hit this assert, you'll need to add a [DependentiLifetime] | 171 // If you hit this assert, you'll need to add a [DependentiLifetime] |
| 170 // extended attribute to the DOM interface. A DOM interface that | 172 // extended attribute to the DOM interface. A DOM interface that |
| 171 // overrides hasPendingActivity must be marked as [DependentiLifetim
e]. | 173 // overrides hasPendingActivity must be marked as [DependentLifetime
]. |
| 172 RELEASE_ASSERT(!value->IsIndependent()); | 174 RELEASE_ASSERT(!value->IsIndependent()); |
| 173 m_isolate->SetObjectGroupId(*value, liveRootId()); | 175 m_isolate->SetObjectGroupId(*value, liveRootId()); |
| 174 ++m_domObjectsWithPendingActivity; | 176 ++m_domObjectsWithPendingActivity; |
| 175 } | 177 } |
| 176 | 178 |
| 177 if (value->IsIndependent()) | 179 if (value->IsIndependent()) |
| 178 return; | 180 return; |
| 179 | 181 |
| 180 if (classId == WrapperTypeInfo::NodeClassId) { | 182 if (classId == WrapperTypeInfo::NodeClassId) { |
| 181 ASSERT(V8Node::hasInstance(wrapper, m_isolate)); | 183 ASSERT(V8Node::hasInstance(wrapper, m_isolate)); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 | 254 |
| 253 void objectGroupingForMajorGC(v8::Isolate* isolate, bool constructRetainedObject
Infos) | 255 void objectGroupingForMajorGC(v8::Isolate* isolate, bool constructRetainedObject
Infos) |
| 254 { | 256 { |
| 255 MajorGCWrapperVisitor visitor(isolate, constructRetainedObjectInfos); | 257 MajorGCWrapperVisitor visitor(isolate, constructRetainedObjectInfos); |
| 256 isolate->VisitHandlesWithClassIds(&visitor); | 258 isolate->VisitHandlesWithClassIds(&visitor); |
| 257 visitor.notifyFinished(); | 259 visitor.notifyFinished(); |
| 258 } | 260 } |
| 259 | 261 |
| 260 void gcPrologueForMajorGC(v8::Isolate* isolate, bool constructRetainedObjectInfo
s) | 262 void gcPrologueForMajorGC(v8::Isolate* isolate, bool constructRetainedObjectInfo
s) |
| 261 { | 263 { |
| 264 if (RuntimeEnabledFeatures::traceWrappablesEnabled()) |
| 265 return; |
| 266 |
| 262 objectGroupingForMajorGC(isolate, constructRetainedObjectInfos); | 267 objectGroupingForMajorGC(isolate, constructRetainedObjectInfos); |
| 263 } | 268 } |
| 264 | 269 |
| 265 } // namespace | 270 } // namespace |
| 266 | 271 |
| 267 void V8GCController::gcPrologue(v8::Isolate* isolate, v8::GCType type, v8::GCCal
lbackFlags flags) | 272 void V8GCController::gcPrologue(v8::Isolate* isolate, v8::GCType type, v8::GCCal
lbackFlags flags) |
| 268 { | 273 { |
| 269 if (isMainThread()) | 274 if (isMainThread()) |
| 270 ScriptForbiddenScope::enter(); | 275 ScriptForbiddenScope::enter(); |
| 271 | 276 |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, scanPendingActivityHis
togram, new CustomCountHistogram("Blink.ScanPendingActivityDuration", 1, 1000, 5
0)); | 485 DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, scanPendingActivityHis
togram, new CustomCountHistogram("Blink.ScanPendingActivityDuration", 1, 1000, 5
0)); |
| 481 double startTime = WTF::currentTimeMS(); | 486 double startTime = WTF::currentTimeMS(); |
| 482 v8::HandleScope scope(isolate); | 487 v8::HandleScope scope(isolate); |
| 483 PendingActivityVisitor visitor(isolate, executionContext); | 488 PendingActivityVisitor visitor(isolate, executionContext); |
| 484 toIsolate(executionContext)->VisitHandlesWithClassIds(&visitor); | 489 toIsolate(executionContext)->VisitHandlesWithClassIds(&visitor); |
| 485 scanPendingActivityHistogram.count(static_cast<int>(WTF::currentTimeMS() - s
tartTime)); | 490 scanPendingActivityHistogram.count(static_cast<int>(WTF::currentTimeMS() - s
tartTime)); |
| 486 return visitor.pendingActivityFound(); | 491 return visitor.pendingActivityFound(); |
| 487 } | 492 } |
| 488 | 493 |
| 489 } // namespace blink | 494 } // namespace blink |
| OLD | NEW |