OLD | NEW |
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/deterministic_dispatcher.h" | 5 #include "headless/public/util/deterministic_dispatcher.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 82 |
83 dispatch_pending_ = true; | 83 dispatch_pending_ = true; |
84 io_thread_task_runner_->PostTask( | 84 io_thread_task_runner_->PostTask( |
85 FROM_HERE, | 85 FROM_HERE, |
86 base::Bind(&DeterministicDispatcher::MaybeDispatchJobOnIOThreadTask, | 86 base::Bind(&DeterministicDispatcher::MaybeDispatchJobOnIOThreadTask, |
87 weak_ptr_factory_.GetWeakPtr())); | 87 weak_ptr_factory_.GetWeakPtr())); |
88 } | 88 } |
89 | 89 |
90 void DeterministicDispatcher::MaybeDispatchJobOnIOThreadTask() { | 90 void DeterministicDispatcher::MaybeDispatchJobOnIOThreadTask() { |
91 Request request; | 91 Request request; |
92 net::Error job_status; | 92 net::Error job_status = net::ERR_FAILED; |
93 | 93 |
94 { | 94 { |
95 base::AutoLock lock(lock_); | 95 base::AutoLock lock(lock_); |
96 dispatch_pending_ = false; | 96 dispatch_pending_ = false; |
97 // If the job got deleted, |pending_requests_| may be empty. | 97 // If the job got deleted, |pending_requests_| may be empty. |
98 if (pending_requests_.empty()) | 98 if (pending_requests_.empty()) |
99 return; | 99 return; |
100 | 100 |
101 // Bail out if we're waiting for a navigation to complete. | 101 // Bail out if we're waiting for a navigation to complete. |
102 if (navigation_in_progress_) | 102 if (navigation_in_progress_) |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 : url_request(nullptr), navigation_request(std::move(navigation_request)) {} | 154 : url_request(nullptr), navigation_request(std::move(navigation_request)) {} |
155 | 155 |
156 DeterministicDispatcher::Request& DeterministicDispatcher::Request::operator=( | 156 DeterministicDispatcher::Request& DeterministicDispatcher::Request::operator=( |
157 DeterministicDispatcher::Request&& other) { | 157 DeterministicDispatcher::Request&& other) { |
158 url_request = other.url_request; | 158 url_request = other.url_request; |
159 navigation_request = std::move(other.navigation_request); | 159 navigation_request = std::move(other.navigation_request); |
160 return *this; | 160 return *this; |
161 } | 161 } |
162 | 162 |
163 } // namespace headless | 163 } // namespace headless |
OLD | NEW |