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

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

Issue 2617733004: binding: Changes the association among global-proxy/global/window-instance. (Closed)
Patch Set: Fixed Document.defaultView Created 3 years, 10 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 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 } 451 }
452 452
453 void V8GCController::collectAllGarbageForTesting(v8::Isolate* isolate) { 453 void V8GCController::collectAllGarbageForTesting(v8::Isolate* isolate) {
454 for (unsigned i = 0; i < 5; i++) 454 for (unsigned i = 0; i < 5; i++)
455 isolate->RequestGarbageCollectionForTesting( 455 isolate->RequestGarbageCollectionForTesting(
456 v8::Isolate::kFullGarbageCollection); 456 v8::Isolate::kFullGarbageCollection);
457 } 457 }
458 458
459 class DOMWrapperTracer : public v8::PersistentHandleVisitor { 459 class DOMWrapperTracer : public v8::PersistentHandleVisitor {
460 public: 460 public:
461 explicit DOMWrapperTracer(Visitor* visitor) : m_visitor(visitor) {} 461 explicit DOMWrapperTracer(Visitor* visitor) : m_visitor(visitor) {
462 DCHECK(m_visitor);
463 }
462 464
463 void VisitPersistentHandle(v8::Persistent<v8::Value>* value, 465 void VisitPersistentHandle(v8::Persistent<v8::Value>* value,
464 uint16_t classId) override { 466 uint16_t classId) override {
465 if (classId != WrapperTypeInfo::NodeClassId && 467 if (classId != WrapperTypeInfo::NodeClassId &&
466 classId != WrapperTypeInfo::ObjectClassId) 468 classId != WrapperTypeInfo::ObjectClassId)
467 return; 469 return;
468 470
469 const v8::Persistent<v8::Object>& wrapper = 471 const v8::Persistent<v8::Object>& wrapper =
470 v8::Persistent<v8::Object>::Cast(*value); 472 v8::Persistent<v8::Object>::Cast(*value);
471 473
472 if (m_visitor) 474 // |scriptWrappable| can be null if |wrapper| is a global proxy object,
473 toWrapperTypeInfo(wrapper)->trace(m_visitor, toScriptWrappable(wrapper)); 475 // which points to nothing while a navigation.
haraken 2017/02/09 12:46:40 Move this comment to toScriptWrappable.
Yuki 2017/02/10 07:47:21 Done.
476 if (ScriptWrappable* scriptWrappable = toScriptWrappable(wrapper))
477 toWrapperTypeInfo(wrapper)->trace(m_visitor, scriptWrappable);
474 } 478 }
475 479
476 private: 480 private:
477 Visitor* m_visitor; 481 Visitor* m_visitor;
478 }; 482 };
479 483
480 void V8GCController::traceDOMWrappers(v8::Isolate* isolate, Visitor* visitor) { 484 void V8GCController::traceDOMWrappers(v8::Isolate* isolate, Visitor* visitor) {
481 DOMWrapperTracer tracer(visitor); 485 DOMWrapperTracer tracer(visitor);
482 isolate->VisitHandlesWithClassIds(&tracer); 486 isolate->VisitHandlesWithClassIds(&tracer);
483 } 487 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 double startTime = WTF::currentTimeMS(); 541 double startTime = WTF::currentTimeMS();
538 v8::HandleScope scope(isolate); 542 v8::HandleScope scope(isolate);
539 PendingActivityVisitor visitor(isolate, executionContext); 543 PendingActivityVisitor visitor(isolate, executionContext);
540 toIsolate(executionContext)->VisitHandlesWithClassIds(&visitor); 544 toIsolate(executionContext)->VisitHandlesWithClassIds(&visitor);
541 scanPendingActivityHistogram.count( 545 scanPendingActivityHistogram.count(
542 static_cast<int>(WTF::currentTimeMS() - startTime)); 546 static_cast<int>(WTF::currentTimeMS() - startTime));
543 return visitor.pendingActivityFound(); 547 return visitor.pendingActivityFound();
544 } 548 }
545 549
546 } // namespace blink 550 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698