Chromium Code Reviews| Index: Source/core/testing/Internals.cpp |
| diff --git a/Source/core/testing/Internals.cpp b/Source/core/testing/Internals.cpp |
| index f9e810b7c49f4b004153d3ce468b08482ceb3304..45201669d84f042285e71bd3f9444fdb084ba283 100644 |
| --- a/Source/core/testing/Internals.cpp |
| +++ b/Source/core/testing/Internals.cpp |
| @@ -207,6 +207,7 @@ Internals::Internals(Document* document) |
| : ContextLifecycleObserver(document) |
| , m_runtimeFlags(InternalRuntimeFlags::create()) |
| , m_scrollingCoordinator(document->page() ? document->page()->scrollingCoordinator() : 0) |
| + , m_gcWithoutContextTimer(this, &Internals::garbageCollectV8WithoutContextTimerFired) |
| { |
| } |
| @@ -2240,4 +2241,16 @@ bool Internals::loseSharedGraphicsContext3D() |
| return true; |
| } |
| +void Internals::garbageCollectV8WithoutContext() |
|
haraken
2013/10/29 01:14:53
garbageCollectV8WithoutContext => collectGarbageWi
|
| +{ |
| + m_gcWithoutContextTimer.startOneShot(0); |
|
haraken
2013/10/29 01:14:53
Why do you need a timer?
|
| +} |
| + |
| +void Internals::garbageCollectV8WithoutContextTimerFired(Timer<Internals>*) |
| +{ |
| + const int largeEnoughValueToTriggerMajorGC = 10000; |
| + for (int i = 0; i < 100; ++i) |
| + v8::V8::IdleNotification(largeEnoughValueToTriggerMajorGC); |
|
haraken
2013/10/29 01:14:53
This is not a reliable way to trigger GC. Instead
|
| +} |
| + |
| } |