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

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

Issue 2386173002: reflow comments in Source/bindings/core/v8 (Closed)
Patch Set: Created 4 years, 2 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 128
129 if (classId == WrapperTypeInfo::NodeClassId) { 129 if (classId == WrapperTypeInfo::NodeClassId) {
130 ASSERT(V8Node::hasInstance(wrapper, m_isolate)); 130 ASSERT(V8Node::hasInstance(wrapper, m_isolate));
131 Node* node = V8Node::toImpl(wrapper); 131 Node* node = V8Node::toImpl(wrapper);
132 if (node->hasEventListeners()) { 132 if (node->hasEventListeners()) {
133 v8::Persistent<v8::Object>::Cast(*value).MarkActive(); 133 v8::Persistent<v8::Object>::Cast(*value).MarkActive();
134 return; 134 return;
135 } 135 }
136 // FIXME: Remove the special handling for SVG elements. 136 // FIXME: Remove the special handling for SVG elements.
137 // We currently can't collect SVG Elements from minor gc, as we have 137 // We currently can't collect SVG Elements from minor gc, as we have
138 // strong references from SVG property tear-offs keeping context SVG eleme nt alive. 138 // strong references from SVG property tear-offs keeping context SVG
139 // element alive.
139 if (node->isSVGElement()) { 140 if (node->isSVGElement()) {
140 v8::Persistent<v8::Object>::Cast(*value).MarkActive(); 141 v8::Persistent<v8::Object>::Cast(*value).MarkActive();
141 return; 142 return;
142 } 143 }
143 } 144 }
144 } 145 }
145 146
146 private: 147 private:
147 v8::Isolate* m_isolate; 148 v8::Isolate* m_isolate;
148 }; 149 };
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 blameContext->Leave(); 392 blameContext->Leave();
392 393
393 ThreadState* currentThreadState = ThreadState::current(); 394 ThreadState* currentThreadState = ThreadState::current();
394 if (currentThreadState && !currentThreadState->isGCForbidden()) { 395 if (currentThreadState && !currentThreadState->isGCForbidden()) {
395 // v8::kGCCallbackFlagForced forces a Blink heap garbage collection 396 // v8::kGCCallbackFlagForced forces a Blink heap garbage collection
396 // when a garbage collection was forced from V8. This is either used 397 // when a garbage collection was forced from V8. This is either used
397 // for tests that force GCs from JavaScript to verify that objects die 398 // for tests that force GCs from JavaScript to verify that objects die
398 // when expected. 399 // when expected.
399 if (flags & v8::kGCCallbackFlagForced) { 400 if (flags & v8::kGCCallbackFlagForced) {
400 // This single GC is not enough for two reasons: 401 // This single GC is not enough for two reasons:
401 // (1) The GC is not precise because the GC scans on-stack pointers cons ervatively. 402 // (1) The GC is not precise because the GC scans on-stack pointers
402 // (2) One GC is not enough to break a chain of persistent handles. It's possible that 403 // conservatively.
403 // some heap allocated objects own objects that contain persistent h andles 404 // (2) One GC is not enough to break a chain of persistent handles. It's
404 // pointing to other heap allocated objects. To break the chain, we need multiple GCs. 405 // possible that some heap allocated objects own objects that
406 // contain persistent handles pointing to other heap allocated
407 // objects. To break the chain, we need multiple GCs.
405 // 408 //
406 // Regarding (1), we force a precise GC at the end of the current event lo op. So if you want 409 // Regarding (1), we force a precise GC at the end of the current event
407 // to collect all garbage, you need to wait until the next event loop. 410 // loop. So if you want to collect all garbage, you need to wait until the
408 // Regarding (2), it would be OK in practice to trigger only one GC per gc Epilogue, because 411 // next event loop. Regarding (2), it would be OK in practice to trigger
409 // GCController.collectAll() forces multiple V8's GC. 412 // only one GC per gcEpilogue, because GCController.collectAll() forces
413 // multiple V8's GC.
410 currentThreadState->collectGarbage(BlinkGC::HeapPointersOnStack, 414 currentThreadState->collectGarbage(BlinkGC::HeapPointersOnStack,
411 BlinkGC::GCWithSweep, 415 BlinkGC::GCWithSweep,
412 BlinkGC::ForcedGC); 416 BlinkGC::ForcedGC);
413 417
414 // Forces a precise GC at the end of the current event loop. 418 // Forces a precise GC at the end of the current event loop.
415 RELEASE_ASSERT(!currentThreadState->isInGC()); 419 RELEASE_ASSERT(!currentThreadState->isInGC());
416 currentThreadState->setGCState(ThreadState::FullGCScheduled); 420 currentThreadState->setGCState(ThreadState::FullGCScheduled);
417 } 421 }
418 422
419 // v8::kGCCallbackFlagCollectAllAvailableGarbage is used when V8 handles 423 // v8::kGCCallbackFlagCollectAllAvailableGarbage is used when V8 handles
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 double startTime = WTF::currentTimeMS(); 537 double startTime = WTF::currentTimeMS();
534 v8::HandleScope scope(isolate); 538 v8::HandleScope scope(isolate);
535 PendingActivityVisitor visitor(isolate, executionContext); 539 PendingActivityVisitor visitor(isolate, executionContext);
536 toIsolate(executionContext)->VisitHandlesWithClassIds(&visitor); 540 toIsolate(executionContext)->VisitHandlesWithClassIds(&visitor);
537 scanPendingActivityHistogram.count( 541 scanPendingActivityHistogram.count(
538 static_cast<int>(WTF::currentTimeMS() - startTime)); 542 static_cast<int>(WTF::currentTimeMS() - startTime));
539 return visitor.pendingActivityFound(); 543 return visitor.pendingActivityFound();
540 } 544 }
541 545
542 } // namespace blink 546 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698