| 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 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 } | 461 } |
| 462 | 462 |
| 463 void V8GCController::collectAllGarbageForTesting(v8::Isolate* isolate) { | 463 void V8GCController::collectAllGarbageForTesting(v8::Isolate* isolate) { |
| 464 for (unsigned i = 0; i < 5; i++) | 464 for (unsigned i = 0; i < 5; i++) |
| 465 isolate->RequestGarbageCollectionForTesting( | 465 isolate->RequestGarbageCollectionForTesting( |
| 466 v8::Isolate::kFullGarbageCollection); | 466 v8::Isolate::kFullGarbageCollection); |
| 467 } | 467 } |
| 468 | 468 |
| 469 class DOMWrapperTracer : public v8::PersistentHandleVisitor { | 469 class DOMWrapperTracer : public v8::PersistentHandleVisitor { |
| 470 public: | 470 public: |
| 471 explicit DOMWrapperTracer(Visitor* visitor) : m_visitor(visitor) { | 471 explicit DOMWrapperTracer(Visitor* visitor) : m_visitor(visitor) {} |
| 472 DCHECK(m_visitor); | |
| 473 } | |
| 474 | 472 |
| 475 void VisitPersistentHandle(v8::Persistent<v8::Value>* value, | 473 void VisitPersistentHandle(v8::Persistent<v8::Value>* value, |
| 476 uint16_t classId) override { | 474 uint16_t classId) override { |
| 477 if (classId != WrapperTypeInfo::NodeClassId && | 475 if (classId != WrapperTypeInfo::NodeClassId && |
| 478 classId != WrapperTypeInfo::ObjectClassId) | 476 classId != WrapperTypeInfo::ObjectClassId) |
| 479 return; | 477 return; |
| 480 | 478 |
| 481 const v8::Persistent<v8::Object>& wrapper = | 479 const v8::Persistent<v8::Object>& wrapper = |
| 482 v8::Persistent<v8::Object>::Cast(*value); | 480 v8::Persistent<v8::Object>::Cast(*value); |
| 483 | 481 |
| 484 if (ScriptWrappable* scriptWrappable = toScriptWrappable(wrapper)) | 482 if (m_visitor) |
| 485 toWrapperTypeInfo(wrapper)->trace(m_visitor, scriptWrappable); | 483 toWrapperTypeInfo(wrapper)->trace(m_visitor, toScriptWrappable(wrapper)); |
| 486 } | 484 } |
| 487 | 485 |
| 488 private: | 486 private: |
| 489 Visitor* m_visitor; | 487 Visitor* m_visitor; |
| 490 }; | 488 }; |
| 491 | 489 |
| 492 void V8GCController::traceDOMWrappers(v8::Isolate* isolate, Visitor* visitor) { | 490 void V8GCController::traceDOMWrappers(v8::Isolate* isolate, Visitor* visitor) { |
| 493 DOMWrapperTracer tracer(visitor); | 491 DOMWrapperTracer tracer(visitor); |
| 494 isolate->VisitHandlesWithClassIds(&tracer); | 492 isolate->VisitHandlesWithClassIds(&tracer); |
| 495 } | 493 } |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 double startTime = WTF::currentTimeMS(); | 547 double startTime = WTF::currentTimeMS(); |
| 550 v8::HandleScope scope(isolate); | 548 v8::HandleScope scope(isolate); |
| 551 PendingActivityVisitor visitor(isolate, executionContext); | 549 PendingActivityVisitor visitor(isolate, executionContext); |
| 552 toIsolate(executionContext)->VisitHandlesWithClassIds(&visitor); | 550 toIsolate(executionContext)->VisitHandlesWithClassIds(&visitor); |
| 553 scanPendingActivityHistogram.count( | 551 scanPendingActivityHistogram.count( |
| 554 static_cast<int>(WTF::currentTimeMS() - startTime)); | 552 static_cast<int>(WTF::currentTimeMS() - startTime)); |
| 555 return visitor.pendingActivityFound(); | 553 return visitor.pendingActivityFound(); |
| 556 } | 554 } |
| 557 | 555 |
| 558 } // namespace blink | 556 } // namespace blink |
| OLD | NEW |