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

Side by Side Diff: third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.cpp

Issue 2104913002: Rename threadSafeBind() to crossThreadBind() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@TRV_CTCPointer
Patch Set: Rebase Created 4 years, 5 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
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 "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, cros sThreadUnretained(this))); 18 m_thread->postTask(BLINK_FROM_HERE, crossThreadBind(&Thread::initialize, cro ssThreadUnretained(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, crossT hreadUnretained(this))); 24 m_thread->postTask(BLINK_FROM_HERE, crossThreadBind(&Thread::shutdown, cross ThreadUnretained(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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 } else { 188 } else {
189 m_offset += size; 189 m_offset += size;
190 } 190 }
191 } 191 }
192 192
193 void DataConsumerHandleTestUtil::ReplayingHandle::Context::notify() 193 void DataConsumerHandleTestUtil::ReplayingHandle::Context::notify()
194 { 194 {
195 if (!m_client) 195 if (!m_client)
196 return; 196 return;
197 ASSERT(m_readerThread); 197 ASSERT(m_readerThread);
198 m_readerThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind (&Context::notifyInternal, wrapPassRefPtr(this))); 198 m_readerThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, crossThreadBin d(&Context::notifyInternal, wrapPassRefPtr(this)));
199 } 199 }
200 200
201 void DataConsumerHandleTestUtil::ReplayingHandle::Context::notifyInternal() 201 void DataConsumerHandleTestUtil::ReplayingHandle::Context::notifyInternal()
202 { 202 {
203 { 203 {
204 MutexLocker locker(m_mutex); 204 MutexLocker locker(m_mutex);
205 if (!m_client || !m_readerThread->isCurrentThread()) { 205 if (!m_client || !m_readerThread->isCurrentThread()) {
206 // There is no client, or a new reader is attached. 206 // There is no client, or a new reader is attached.
207 return; 207 return;
208 } 208 }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698