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

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

Issue 2589363003: Use timer task runner for V8PerIsolate tasks (Closed)
Patch Set: One more fix Created 3 years, 12 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 "public/platform/WebScheduler.h"
8 #include "wtf/PtrUtil.h" 9 #include "wtf/PtrUtil.h"
9 #include <memory> 10 #include <memory>
10 11
11 namespace blink { 12 namespace blink {
12 13
13 using Result = WebDataConsumerHandle::Result; 14 using Result = WebDataConsumerHandle::Result;
14 15
15 namespace { 16 namespace {
16 17
17 class WaitingHandle final : public WebDataConsumerHandle { 18 class WaitingHandle final : public WebDataConsumerHandle {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 52
52 DataConsumerHandleTestUtil::Thread::~Thread() { 53 DataConsumerHandleTestUtil::Thread::~Thread() {
53 m_thread->postTask( 54 m_thread->postTask(
54 BLINK_FROM_HERE, 55 BLINK_FROM_HERE,
55 crossThreadBind(&Thread::shutdown, crossThreadUnretained(this))); 56 crossThreadBind(&Thread::shutdown, crossThreadUnretained(this)));
56 m_waitableEvent->wait(); 57 m_waitableEvent->wait();
57 } 58 }
58 59
59 void DataConsumerHandleTestUtil::Thread::initialize() { 60 void DataConsumerHandleTestUtil::Thread::initialize() {
60 if (m_initializationPolicy >= ScriptExecution) { 61 if (m_initializationPolicy >= ScriptExecution) {
61 m_isolateHolder = WTF::makeUnique<gin::IsolateHolder>(); 62 m_isolateHolder =
63 WTF::makeUnique<gin::IsolateHolder>(Platform::current()
64 ->currentThread()
65 ->scheduler()
66 ->loadingTaskRunner()
67 ->toSingleThreadTaskRunner());
62 isolate()->Enter(); 68 isolate()->Enter();
63 } 69 }
64 m_thread->initialize(); 70 m_thread->initialize();
65 if (m_initializationPolicy >= ScriptExecution) { 71 if (m_initializationPolicy >= ScriptExecution) {
66 v8::HandleScope handleScope(isolate()); 72 v8::HandleScope handleScope(isolate());
67 m_scriptState = ScriptState::create(v8::Context::New(isolate()), 73 m_scriptState = ScriptState::create(v8::Context::New(isolate()),
68 DOMWrapperWorld::create(isolate())); 74 DOMWrapperWorld::create(isolate()));
69 } 75 }
70 if (m_initializationPolicy >= WithExecutionContext) { 76 if (m_initializationPolicy >= WithExecutionContext) {
71 m_executionContext = new NullExecutionContext(); 77 m_executionContext = new NullExecutionContext();
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 std::move(m_onFinishedReading)); 335 std::move(m_onFinishedReading));
330 (*onFinishedReading)(std::move(result)); 336 (*onFinishedReading)(std::move(result));
331 } 337 }
332 338
333 std::unique_ptr<WebDataConsumerHandle> 339 std::unique_ptr<WebDataConsumerHandle>
334 DataConsumerHandleTestUtil::createWaitingDataConsumerHandle() { 340 DataConsumerHandleTestUtil::createWaitingDataConsumerHandle() {
335 return WTF::wrapUnique(new WaitingHandle); 341 return WTF::wrapUnique(new WaitingHandle);
336 } 342 }
337 343
338 } // namespace blink 344 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698