| OLD | NEW |
| 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 "bindings/core/v8/V8GCController.h" |
| 8 #include "core/inspector/ConsoleMessage.h" | 9 #include "core/inspector/ConsoleMessage.h" |
| 9 #include "core/workers/WorkerReportingProxy.h" | 10 #include "core/workers/WorkerReportingProxy.h" |
| 10 #include "core/workers/WorkerThreadStartupData.h" | 11 #include "core/workers/WorkerThreadStartupData.h" |
| 11 #include "platform/NotImplemented.h" | 12 #include "platform/NotImplemented.h" |
| 12 #include "platform/heap/Heap.h" | |
| 13 #include "public/platform/WebScheduler.h" | 13 #include "public/platform/WebScheduler.h" |
| 14 #include "public/platform/WebWaitableEvent.h" | 14 #include "public/platform/WebWaitableEvent.h" |
| 15 #include <gmock/gmock.h> | 15 #include <gmock/gmock.h> |
| 16 #include <gtest/gtest.h> | 16 #include <gtest/gtest.h> |
| 17 #include <v8.h> | |
| 18 | 17 |
| 19 using testing::_; | 18 using testing::_; |
| 20 using testing::AtMost; | 19 using testing::AtMost; |
| 21 using testing::Invoke; | 20 using testing::Invoke; |
| 22 using testing::Return; | 21 using testing::Return; |
| 23 using testing::Mock; | 22 using testing::Mock; |
| 24 | 23 |
| 25 namespace blink { | 24 namespace blink { |
| 26 | 25 |
| 27 namespace { | 26 namespace { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 105 |
| 107 ~WorkerThreadForTest() override { } | 106 ~WorkerThreadForTest() override { } |
| 108 | 107 |
| 109 // WorkerThread implementation: | 108 // WorkerThread implementation: |
| 110 WebThreadSupportingGC& backingThread() override | 109 WebThreadSupportingGC& backingThread() override |
| 111 { | 110 { |
| 112 return *m_thread; | 111 return *m_thread; |
| 113 } | 112 } |
| 114 void willDestroyIsolate() override | 113 void willDestroyIsolate() override |
| 115 { | 114 { |
| 116 v8::Isolate::GetCurrent()->RequestGarbageCollectionForTesting(v8::Isolat
e::kFullGarbageCollection); | 115 V8GCController::collectAllGarbageForTesting(v8::Isolate::GetCurrent()); |
| 117 Heap::collectAllGarbage(); | |
| 118 WorkerThread::willDestroyIsolate(); | 116 WorkerThread::willDestroyIsolate(); |
| 119 } | 117 } |
| 120 | 118 |
| 121 MOCK_METHOD1(doIdleGc, bool(double deadlineSeconds)); | 119 MOCK_METHOD1(doIdleGc, bool(double deadlineSeconds)); |
| 122 | 120 |
| 123 PassRefPtrWillBeRawPtr<WorkerGlobalScope> createWorkerGlobalScope(PassOwnPtr
<WorkerThreadStartupData> startupData) override | 121 PassRefPtrWillBeRawPtr<WorkerGlobalScope> createWorkerGlobalScope(PassOwnPtr
<WorkerThreadStartupData> startupData) override |
| 124 { | 122 { |
| 125 return adoptRefWillBeNoop(new FakeWorkerGlobalScope(startupData->m_scrip
tURL, startupData->m_userAgent, this, startupData->m_starterOrigin, startupData-
>m_workerClients.release())); | 123 return adoptRefWillBeNoop(new FakeWorkerGlobalScope(startupData->m_scrip
tURL, startupData->m_userAgent, this, startupData->m_starterOrigin, startupData-
>m_workerClients.release())); |
| 126 } | 124 } |
| 127 | 125 |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 | 336 |
| 339 completion->wait(); | 337 completion->wait(); |
| 340 | 338 |
| 341 // Make sure doIdleGc has not been called by this stage. | 339 // Make sure doIdleGc has not been called by this stage. |
| 342 Mock::VerifyAndClearExpectations(m_workerThread.get()); | 340 Mock::VerifyAndClearExpectations(m_workerThread.get()); |
| 343 | 341 |
| 344 m_workerThread->terminateAndWait(); | 342 m_workerThread->terminateAndWait(); |
| 345 } | 343 } |
| 346 | 344 |
| 347 } // namespace blink | 345 } // namespace blink |
| OLD | NEW |