| 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 "modules/fetch/DataConsumerHandleTestUtil.h" | 5 #include "modules/fetch/DataConsumerHandleTestUtil.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/DOMWrapperWorld.h" | 7 #include "bindings/core/v8/DOMWrapperWorld.h" |
| 8 #include "wtf/PtrUtil.h" | 8 #include "wtf/PtrUtil.h" |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 DataConsumerHandleTestUtil::Thread::Thread(const char* name, InitializationPolic
y initializationPolicy) | 13 DataConsumerHandleTestUtil::Thread::Thread(const char* name, InitializationPolic
y initializationPolicy) |
| 14 : m_thread(WebThreadSupportingGC::create(name)) | 14 : m_thread(WebThreadSupportingGC::create(name)) |
| 15 , m_initializationPolicy(initializationPolicy) | 15 , m_initializationPolicy(initializationPolicy) |
| 16 , m_waitableEvent(wrapUnique(new WaitableEvent())) | 16 , m_waitableEvent(wrapUnique(new WaitableEvent())) |
| 17 { | 17 { |
| 18 m_thread->postTask(BLINK_FROM_HERE, threadSafeBind(&Thread::initialize, Allo
wCrossThreadAccess(this))); | 18 m_thread->postTask(BLINK_FROM_HERE, threadSafeBind(&Thread::initialize, cros
sThreadUnretained(this))); |
| 19 m_waitableEvent->wait(); | 19 m_waitableEvent->wait(); |
| 20 } | 20 } |
| 21 | 21 |
| 22 DataConsumerHandleTestUtil::Thread::~Thread() | 22 DataConsumerHandleTestUtil::Thread::~Thread() |
| 23 { | 23 { |
| 24 m_thread->postTask(BLINK_FROM_HERE, threadSafeBind(&Thread::shutdown, AllowC
rossThreadAccess(this))); | 24 m_thread->postTask(BLINK_FROM_HERE, threadSafeBind(&Thread::shutdown, crossT
hreadUnretained(this))); |
| 25 m_waitableEvent->wait(); | 25 m_waitableEvent->wait(); |
| 26 } | 26 } |
| 27 | 27 |
| 28 void DataConsumerHandleTestUtil::Thread::initialize() | 28 void DataConsumerHandleTestUtil::Thread::initialize() |
| 29 { | 29 { |
| 30 if (m_initializationPolicy >= ScriptExecution) { | 30 if (m_initializationPolicy >= ScriptExecution) { |
| 31 m_isolateHolder = wrapUnique(new gin::IsolateHolder()); | 31 m_isolateHolder = wrapUnique(new gin::IsolateHolder()); |
| 32 isolate()->Enter(); | 32 isolate()->Enter(); |
| 33 } | 33 } |
| 34 m_thread->initialize(); | 34 m_thread->initialize(); |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 } | 292 } |
| 293 | 293 |
| 294 void DataConsumerHandleTestUtil::HandleTwoPhaseReader::runOnFinishedReading(std:
:unique_ptr<HandleReadResult> result) | 294 void DataConsumerHandleTestUtil::HandleTwoPhaseReader::runOnFinishedReading(std:
:unique_ptr<HandleReadResult> result) |
| 295 { | 295 { |
| 296 ASSERT(m_onFinishedReading); | 296 ASSERT(m_onFinishedReading); |
| 297 std::unique_ptr<OnFinishedReading> onFinishedReading(std::move(m_onFinishedR
eading)); | 297 std::unique_ptr<OnFinishedReading> onFinishedReading(std::move(m_onFinishedR
eading)); |
| 298 (*onFinishedReading)(std::move(result)); | 298 (*onFinishedReading)(std::move(result)); |
| 299 } | 299 } |
| 300 | 300 |
| 301 } // namespace blink | 301 } // namespace blink |
| OLD | NEW |