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

Side by Side Diff: Source/core/workers/WorkerThreadTest.cpp

Issue 1158443008: compositor-worker: Share a thread and an isolate for compositor workers. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: . Created 5 years, 6 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 "core/workers/WorkerThread.h" 6 #include "core/workers/WorkerThread.h"
7 7
8 #include "core/inspector/ConsoleMessage.h" 8 #include "core/inspector/ConsoleMessage.h"
9 #include "core/workers/WorkerReportingProxy.h" 9 #include "core/workers/WorkerReportingProxy.h"
10 #include "core/workers/WorkerThreadStartupData.h" 10 #include "core/workers/WorkerThreadStartupData.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 } 90 }
91 91
92 ~WorkerThreadForTest() override { } 92 ~WorkerThreadForTest() override { }
93 93
94 // WorkerThread implementation: 94 // WorkerThread implementation:
95 WebThreadSupportingGC& backingThread() override 95 WebThreadSupportingGC& backingThread() override
96 { 96 {
97 return *m_thread; 97 return *m_thread;
98 } 98 }
99 99
100 OwnPtr<WorkerV8Isolate>& workerIsolate() override
101 {
102 if (!m_isolate) {
103 ASSERT(isCurrentThread());
104 m_isolate = WorkerV8Isolate::createDefault();
105 }
106 return m_isolate;
107 }
108
100 MOCK_METHOD1(doIdleGc, bool(double deadlineSeconds)); 109 MOCK_METHOD1(doIdleGc, bool(double deadlineSeconds));
101 110
102 PassRefPtrWillBeRawPtr<WorkerGlobalScope> createWorkerGlobalScope(PassOwnPtr <WorkerThreadStartupData> startupData) override 111 PassRefPtrWillBeRawPtr<WorkerGlobalScope> createWorkerGlobalScope(PassOwnPtr <WorkerThreadStartupData> startupData) override
103 { 112 {
104 return adoptRefWillBeNoop(new FakeWorkerGlobalScope(startupData->m_scrip tURL, startupData->m_userAgent, this, startupData->m_starterOrigin, startupData- >m_workerClients.release())); 113 return adoptRefWillBeNoop(new FakeWorkerGlobalScope(startupData->m_scrip tURL, startupData->m_userAgent, this, startupData->m_starterOrigin, startupData- >m_workerClients.release()));
105 } 114 }
106 115
107 private: 116 private:
108 OwnPtr<WebThreadSupportingGC> m_thread; 117 OwnPtr<WebThreadSupportingGC> m_thread;
118 OwnPtr<WorkerV8Isolate> m_isolate;
109 }; 119 };
110 120
111 class WakeupTask : public WebThread::Task { 121 class WakeupTask : public WebThread::Task {
112 public: 122 public:
113 WakeupTask() { } 123 WakeupTask() { }
114 124
115 ~WakeupTask() override { } 125 ~WakeupTask() override { }
116 126
117 void run() override { } 127 void run() override { }
118 }; 128 };
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 297
288 completion->wait(); 298 completion->wait();
289 299
290 // Make sure doIdleGc has not been called by this stage. 300 // Make sure doIdleGc has not been called by this stage.
291 Mock::VerifyAndClearExpectations(m_workerThread.get()); 301 Mock::VerifyAndClearExpectations(m_workerThread.get());
292 302
293 m_workerThread->terminateAndWait(); 303 m_workerThread->terminateAndWait();
294 } 304 }
295 305
296 } // namespace blink 306 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698