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

Side by Side Diff: Source/modules/compositorworker/CompositorWorkerManagerTest.cpp

Issue 1328653002: Introduce V8GCController::collectAllGarbage (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "modules/compositorworker/CompositorWorkerManager.h" 6 #include "modules/compositorworker/CompositorWorkerManager.h"
7 7
8 #include "bindings/core/v8/ScriptSourceCode.h" 8 #include "bindings/core/v8/ScriptSourceCode.h"
9 #include "bindings/core/v8/V8GCController.h"
9 #include "core/inspector/ConsoleMessage.h" 10 #include "core/inspector/ConsoleMessage.h"
10 #include "core/testing/DummyPageHolder.h" 11 #include "core/testing/DummyPageHolder.h"
11 #include "core/workers/WorkerLoaderProxy.h" 12 #include "core/workers/WorkerLoaderProxy.h"
12 #include "core/workers/WorkerObjectProxy.h" 13 #include "core/workers/WorkerObjectProxy.h"
13 #include "core/workers/WorkerThreadStartupData.h" 14 #include "core/workers/WorkerThreadStartupData.h"
14 #include "modules/compositorworker/CompositorWorkerThread.h" 15 #include "modules/compositorworker/CompositorWorkerThread.h"
15 #include "platform/NotImplemented.h" 16 #include "platform/NotImplemented.h"
16 #include "platform/ThreadSafeFunctional.h" 17 #include "platform/ThreadSafeFunctional.h"
17 #include "platform/heap/Heap.h" 18 #include "platform/heap/Handle.h"
18 #include "platform/testing/UnitTestHelpers.h" 19 #include "platform/testing/UnitTestHelpers.h"
19 #include "public/platform/Platform.h" 20 #include "public/platform/Platform.h"
20 #include "public/platform/WebWaitableEvent.h" 21 #include "public/platform/WebWaitableEvent.h"
21 #include <gtest/gtest.h> 22 #include <gtest/gtest.h>
22 #include <v8.h>
23 23
24 namespace blink { 24 namespace blink {
25 namespace { 25 namespace {
26 26
27 class TestCompositorWorkerThread : public CompositorWorkerThread { 27 class TestCompositorWorkerThread : public CompositorWorkerThread {
28 public: 28 public:
29 TestCompositorWorkerThread(WorkerLoaderProxyProvider* loaderProxyProvider, W orkerObjectProxy& objectProxy, double timeOrigin, WebWaitableEvent* startEvent) 29 TestCompositorWorkerThread(WorkerLoaderProxyProvider* loaderProxyProvider, W orkerObjectProxy& objectProxy, double timeOrigin, WebWaitableEvent* startEvent)
30 : CompositorWorkerThread(WorkerLoaderProxy::create(loaderProxyProvider), objectProxy, timeOrigin) 30 : CompositorWorkerThread(WorkerLoaderProxy::create(loaderProxyProvider), objectProxy, timeOrigin)
31 , m_startEvent(startEvent) 31 , m_startEvent(startEvent)
32 { 32 {
(...skipping 13 matching lines...) Expand all
46 m_startEvent->signal(); 46 m_startEvent->signal();
47 } 47 }
48 void terminateV8Execution() override 48 void terminateV8Execution() override
49 { 49 {
50 CompositorWorkerThread::terminateV8Execution(); 50 CompositorWorkerThread::terminateV8Execution();
51 if (m_v8TerminationCallback) 51 if (m_v8TerminationCallback)
52 (*m_v8TerminationCallback)(); 52 (*m_v8TerminationCallback)();
53 } 53 }
54 void willDestroyIsolate() override 54 void willDestroyIsolate() override
55 { 55 {
56 v8::Isolate::GetCurrent()->RequestGarbageCollectionForTesting(v8::Isolat e::kFullGarbageCollection); 56 V8GCController::collectAllGarbage(v8::Isolate::GetCurrent());
57 Heap::collectAllGarbage();
58 CompositorWorkerThread::willDestroyIsolate(); 57 CompositorWorkerThread::willDestroyIsolate();
59 } 58 }
60 59
61 WebWaitableEvent* m_startEvent; 60 WebWaitableEvent* m_startEvent;
62 OwnPtr<Function<void()>> m_v8TerminationCallback; 61 OwnPtr<Function<void()>> m_v8TerminationCallback;
63 }; 62 };
64 63
65 // A null WorkerObjectProxy, supplied when creating CompositorWorkerThreads. 64 // A null WorkerObjectProxy, supplied when creating CompositorWorkerThreads.
66 class TestCompositorWorkerObjectProxy : public WorkerObjectProxy { 65 class TestCompositorWorkerObjectProxy : public WorkerObjectProxy {
67 public: 66 public:
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 v8::Isolate* secondIsolate = secondWorker->isolate(); 264 v8::Isolate* secondIsolate = secondWorker->isolate();
266 ASSERT(secondIsolate); 265 ASSERT(secondIsolate);
267 EXPECT_EQ(firstIsolate, secondIsolate); 266 EXPECT_EQ(firstIsolate, secondIsolate);
268 267
269 // Verify that the isolate can run some scripts correctly in the second work er. 268 // Verify that the isolate can run some scripts correctly in the second work er.
270 checkWorkerCanExecuteScript(secondWorker.get()); 269 checkWorkerCanExecuteScript(secondWorker.get());
271 secondWorker->terminateAndWait(); 270 secondWorker->terminateAndWait();
272 } 271 }
273 272
274 } // namespace blink 273 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698