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

Side by Side Diff: headless/public/util/expedited_dispatcher.cc

Issue 2687083002: Headless: make URLRequestDispatcher aware of navigations (Closed)
Patch Set: Address nits Created 3 years, 10 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 "headless/public/util/expedited_dispatcher.h" 5 #include "headless/public/util/expedited_dispatcher.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "headless/public/util/managed_dispatch_url_request_job.h" 10 #include "headless/public/util/managed_dispatch_url_request_job.h"
11 #include "headless/public/util/navigation_request.h"
11 12
12 namespace headless { 13 namespace headless {
13 14
14 ExpeditedDispatcher::ExpeditedDispatcher( 15 ExpeditedDispatcher::ExpeditedDispatcher(
15 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner) 16 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner)
16 : io_thread_task_runner_(std::move(io_thread_task_runner)) {} 17 : io_thread_task_runner_(std::move(io_thread_task_runner)) {}
17 18
18 ExpeditedDispatcher::~ExpeditedDispatcher() {} 19 ExpeditedDispatcher::~ExpeditedDispatcher() {}
19 20
20 void ExpeditedDispatcher::JobCreated(ManagedDispatchURLRequestJob*) {} 21 void ExpeditedDispatcher::JobCreated(ManagedDispatchURLRequestJob*) {}
21 22
22 void ExpeditedDispatcher::JobKilled(ManagedDispatchURLRequestJob*) {} 23 void ExpeditedDispatcher::JobKilled(ManagedDispatchURLRequestJob*) {}
23 24
24 void ExpeditedDispatcher::JobFailed(ManagedDispatchURLRequestJob* job, 25 void ExpeditedDispatcher::JobFailed(ManagedDispatchURLRequestJob* job,
25 net::Error error) { 26 net::Error error) {
26 io_thread_task_runner_->PostTask( 27 io_thread_task_runner_->PostTask(
27 FROM_HERE, base::Bind(&ManagedDispatchURLRequestJob::OnStartError, 28 FROM_HERE, base::Bind(&ManagedDispatchURLRequestJob::OnStartError,
28 base::Unretained(job), error)); 29 base::Unretained(job), error));
29 } 30 }
30 31
31 void ExpeditedDispatcher::DataReady(ManagedDispatchURLRequestJob* job) { 32 void ExpeditedDispatcher::DataReady(ManagedDispatchURLRequestJob* job) {
32 io_thread_task_runner_->PostTask( 33 io_thread_task_runner_->PostTask(
33 FROM_HERE, base::Bind(&ManagedDispatchURLRequestJob::OnHeadersComplete, 34 FROM_HERE, base::Bind(&ManagedDispatchURLRequestJob::OnHeadersComplete,
34 base::Unretained(job))); 35 base::Unretained(job)));
35 } 36 }
36 37
37 void ExpeditedDispatcher::JobDeleted(ManagedDispatchURLRequestJob*) {} 38 void ExpeditedDispatcher::JobDeleted(ManagedDispatchURLRequestJob*) {}
38 39
40 void ExpeditedDispatcher::NavigationRequested(
41 std::unique_ptr<NavigationRequest> navigation) {
42 // For the ExpeditedDispatcher we don't care when the navigation is done,
43 // hence the empty closure.
44 io_thread_task_runner_->PostTask(
45 FROM_HERE, base::Bind(&NavigationRequest::StartProcessing,
46 std::move(navigation), base::Closure()));
47 }
48
39 } // namespace headless 49 } // namespace headless
OLDNEW
« no previous file with comments | « headless/public/util/expedited_dispatcher.h ('k') | headless/public/util/expedited_dispatcher_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698