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

Side by Side Diff: third_party/WebKit/Source/core/loader/ThreadableLoaderTest.cpp

Issue 2806623004: Worker: Introduce per-global-scope task scheduler (Closed)
Patch Set: rebase Created 3 years, 8 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "core/loader/ThreadableLoader.h" 5 #include "core/loader/ThreadableLoader.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include "core/loader/DocumentThreadableLoader.h" 8 #include "core/loader/DocumentThreadableLoader.h"
9 #include "core/loader/ThreadableLoaderClient.h" 9 #include "core/loader/ThreadableLoaderClient.h"
10 #include "core/loader/ThreadableLoadingContext.h" 10 #include "core/loader/ThreadableLoadingContext.h"
11 #include "core/loader/WorkerThreadableLoader.h" 11 #include "core/loader/WorkerThreadableLoader.h"
12 #include "core/testing/DummyPageHolder.h" 12 #include "core/testing/DummyPageHolder.h"
13 #include "core/workers/WorkerLoaderProxy.h" 13 #include "core/workers/WorkerLoaderProxy.h"
14 #include "core/workers/WorkerReportingProxy.h" 14 #include "core/workers/WorkerReportingProxy.h"
15 #include "core/workers/WorkerTaskRunners.h"
15 #include "core/workers/WorkerThreadTestHelper.h" 16 #include "core/workers/WorkerThreadTestHelper.h"
16 #include "platform/WaitableEvent.h" 17 #include "platform/WaitableEvent.h"
17 #include "platform/geometry/IntSize.h" 18 #include "platform/geometry/IntSize.h"
18 #include "platform/loader/fetch/MemoryCache.h" 19 #include "platform/loader/fetch/MemoryCache.h"
19 #include "platform/loader/fetch/ResourceError.h" 20 #include "platform/loader/fetch/ResourceError.h"
20 #include "platform/loader/fetch/ResourceLoaderOptions.h" 21 #include "platform/loader/fetch/ResourceLoaderOptions.h"
21 #include "platform/loader/fetch/ResourceRequest.h" 22 #include "platform/loader/fetch/ResourceRequest.h"
22 #include "platform/loader/fetch/ResourceResponse.h" 23 #include "platform/loader/fetch/ResourceResponse.h"
23 #include "platform/loader/fetch/ResourceTimingInfo.h" 24 #include "platform/loader/fetch/ResourceTimingInfo.h"
24 #include "platform/testing/URLTestHelpers.h" 25 #include "platform/testing/URLTestHelpers.h"
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 DCHECK(worker_thread_); 326 DCHECK(worker_thread_);
326 DCHECK(worker_thread_->IsCurrentThread()); 327 DCHECK(worker_thread_->IsCurrentThread());
327 parent_frame_task_runners_->Get(TaskType::kNetworking) 328 parent_frame_task_runners_->Get(TaskType::kNetworking)
328 ->PostTask(BLINK_FROM_HERE, std::move(task)); 329 ->PostTask(BLINK_FROM_HERE, std::move(task));
329 } 330 }
330 331
331 void PostTaskToWorkerGlobalScope( 332 void PostTaskToWorkerGlobalScope(
332 const WebTraceLocation& location, 333 const WebTraceLocation& location,
333 std::unique_ptr<WTF::CrossThreadClosure> task) override { 334 std::unique_ptr<WTF::CrossThreadClosure> task) override {
334 DCHECK(worker_thread_); 335 DCHECK(worker_thread_);
335 worker_thread_->PostTask(location, std::move(task)); 336 worker_thread_->GetWorkerTaskRunners()
337 ->Get(TaskType::kNetworking)
338 ->PostTask(location, std::move(task));
336 } 339 }
337 340
338 ThreadableLoadingContext* GetThreadableLoadingContext() override { 341 ThreadableLoadingContext* GetThreadableLoadingContext() override {
339 return loading_context_.Get(); 342 return loading_context_.Get();
340 } 343 }
341 344
342 RefPtr<SecurityOrigin> security_origin_; 345 RefPtr<SecurityOrigin> security_origin_;
343 std::unique_ptr<WorkerReportingProxy> reporting_proxy_; 346 std::unique_ptr<WorkerReportingProxy> reporting_proxy_;
344 std::unique_ptr<WorkerThreadForTest> worker_thread_; 347 std::unique_ptr<WorkerThreadForTest> worker_thread_;
345 348
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 // test is not saying that didFailAccessControlCheck should be dispatched 884 // test is not saying that didFailAccessControlCheck should be dispatched
882 // synchronously, but is saying that even when a response is served 885 // synchronously, but is saying that even when a response is served
883 // synchronously it should not lead to a crash. 886 // synchronously it should not lead to a crash.
884 StartLoader(KURL(KURL(), "about:blank")); 887 StartLoader(KURL(KURL(), "about:blank"));
885 CallCheckpoint(2); 888 CallCheckpoint(2);
886 } 889 }
887 890
888 } // namespace 891 } // namespace
889 892
890 } // namespace blink 893 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698