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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp

Issue 1876383003: Introduce infrastructure for tracing ScriptWrappables. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix var used only in assert Created 4 years, 8 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 /* 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
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/ScriptWrappableVisitor.h"
35 #include "bindings/core/v8/V8AbstractEventListener.h" 36 #include "bindings/core/v8/V8AbstractEventListener.h"
36 #include "bindings/core/v8/V8Binding.h" 37 #include "bindings/core/v8/V8Binding.h"
37 #include "bindings/core/v8/V8MutationObserver.h" 38 #include "bindings/core/v8/V8MutationObserver.h"
38 #include "bindings/core/v8/V8Node.h" 39 #include "bindings/core/v8/V8Node.h"
39 #include "bindings/core/v8/V8ScriptRunner.h" 40 #include "bindings/core/v8/V8ScriptRunner.h"
40 #include "bindings/core/v8/WrapperTypeInfo.h" 41 #include "bindings/core/v8/WrapperTypeInfo.h"
41 #include "core/dom/Attr.h" 42 #include "core/dom/Attr.h"
42 #include "core/dom/Document.h" 43 #include "core/dom/Document.h"
43 #include "core/dom/NodeTraversal.h" 44 #include "core/dom/NodeTraversal.h"
44 #include "core/dom/TemplateContentDocumentFragment.h" 45 #include "core/dom/TemplateContentDocumentFragment.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 if (classId != WrapperTypeInfo::NodeClassId && classId != WrapperTypeInf o::ObjectClassId) 162 if (classId != WrapperTypeInfo::NodeClassId && classId != WrapperTypeInf o::ObjectClassId)
162 return; 163 return;
163 164
164 v8::Local<v8::Object> wrapper = v8::Local<v8::Object>::New(m_isolate, v8 ::Persistent<v8::Object>::Cast(*value)); 165 v8::Local<v8::Object> wrapper = v8::Local<v8::Object>::New(m_isolate, v8 ::Persistent<v8::Object>::Cast(*value));
165 ASSERT(V8DOMWrapper::hasInternalFieldsSet(wrapper)); 166 ASSERT(V8DOMWrapper::hasInternalFieldsSet(wrapper));
166 167
167 const WrapperTypeInfo* type = toWrapperTypeInfo(wrapper); 168 const WrapperTypeInfo* type = toWrapperTypeInfo(wrapper);
168 if (type->hasPendingActivity(wrapper)) { 169 if (type->hasPendingActivity(wrapper)) {
169 // If you hit this assert, you'll need to add a [DependentiLifetime] 170 // If you hit this assert, you'll need to add a [DependentiLifetime]
170 // extended attribute to the DOM interface. A DOM interface that 171 // extended attribute to the DOM interface. A DOM interface that
171 // overrides hasPendingActivity must be marked as [DependentiLifetim e]. 172 // overrides hasPendingActivity must be marked as [DependentLifetime ].
172 RELEASE_ASSERT(!value->IsIndependent()); 173 RELEASE_ASSERT(!value->IsIndependent());
173 m_isolate->SetObjectGroupId(*value, liveRootId()); 174 m_isolate->SetObjectGroupId(*value, liveRootId());
174 ++m_domObjectsWithPendingActivity; 175 ++m_domObjectsWithPendingActivity;
175 } 176 }
176 177
177 if (value->IsIndependent()) 178 if (value->IsIndependent())
178 return; 179 return;
179 180
180 if (classId == WrapperTypeInfo::NodeClassId) { 181 if (classId == WrapperTypeInfo::NodeClassId) {
181 ASSERT(V8Node::hasInstance(wrapper, m_isolate)); 182 ASSERT(V8Node::hasInstance(wrapper, m_isolate));
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 253
253 void objectGroupingForMajorGC(v8::Isolate* isolate, bool constructRetainedObject Infos) 254 void objectGroupingForMajorGC(v8::Isolate* isolate, bool constructRetainedObject Infos)
254 { 255 {
255 MajorGCWrapperVisitor visitor(isolate, constructRetainedObjectInfos); 256 MajorGCWrapperVisitor visitor(isolate, constructRetainedObjectInfos);
256 isolate->VisitHandlesWithClassIds(&visitor); 257 isolate->VisitHandlesWithClassIds(&visitor);
257 visitor.notifyFinished(); 258 visitor.notifyFinished();
258 } 259 }
259 260
260 void gcPrologueForMajorGC(v8::Isolate* isolate, bool constructRetainedObjectInfo s) 261 void gcPrologueForMajorGC(v8::Isolate* isolate, bool constructRetainedObjectInfo s)
261 { 262 {
263 if (RuntimeEnabledFeatures::traceWrappablesEnabled())
264 return;
265
262 objectGroupingForMajorGC(isolate, constructRetainedObjectInfos); 266 objectGroupingForMajorGC(isolate, constructRetainedObjectInfos);
263 } 267 }
264 268
265 } // namespace 269 } // namespace
266 270
267 void V8GCController::gcPrologue(v8::Isolate* isolate, v8::GCType type, v8::GCCal lbackFlags flags) 271 void V8GCController::gcPrologue(v8::Isolate* isolate, v8::GCType type, v8::GCCal lbackFlags flags)
268 { 272 {
269 if (isMainThread()) 273 if (isMainThread())
270 ScriptForbiddenScope::enter(); 274 ScriptForbiddenScope::enter();
271 275
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, scanPendingActivityHis togram, new CustomCountHistogram("Blink.ScanPendingActivityDuration", 1, 1000, 5 0)); 484 DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, scanPendingActivityHis togram, new CustomCountHistogram("Blink.ScanPendingActivityDuration", 1, 1000, 5 0));
481 double startTime = WTF::currentTimeMS(); 485 double startTime = WTF::currentTimeMS();
482 v8::HandleScope scope(isolate); 486 v8::HandleScope scope(isolate);
483 PendingActivityVisitor visitor(isolate, executionContext); 487 PendingActivityVisitor visitor(isolate, executionContext);
484 toIsolate(executionContext)->VisitHandlesWithClassIds(&visitor); 488 toIsolate(executionContext)->VisitHandlesWithClassIds(&visitor);
485 scanPendingActivityHistogram.count(static_cast<int>(WTF::currentTimeMS() - s tartTime)); 489 scanPendingActivityHistogram.count(static_cast<int>(WTF::currentTimeMS() - s tartTime));
486 return visitor.pendingActivityFound(); 490 return visitor.pendingActivityFound();
487 } 491 }
488 492
489 } // namespace blink 493 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698