| 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 #ifndef HEADLESS_PUBLIC_UTIL_EXPEDITED_DISPATCHER_H_ | 5 #ifndef HEADLESS_PUBLIC_UTIL_EXPEDITED_DISPATCHER_H_ |
| 6 #define HEADLESS_PUBLIC_UTIL_EXPEDITED_DISPATCHER_H_ | 6 #define HEADLESS_PUBLIC_UTIL_EXPEDITED_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| 11 #include "headless/public/headless_export.h" |
| 11 #include "headless/public/util/url_request_dispatcher.h" | 12 #include "headless/public/util/url_request_dispatcher.h" |
| 12 #include "net/base/net_errors.h" | 13 #include "net/base/net_errors.h" |
| 13 | 14 |
| 14 namespace headless { | 15 namespace headless { |
| 15 | 16 |
| 16 class ManagedDispatchURLRequestJob; | 17 class ManagedDispatchURLRequestJob; |
| 17 | 18 |
| 18 // This class dispatches calls to OnHeadersComplete and OnStartError | 19 // This class dispatches calls to OnHeadersComplete and OnStartError |
| 19 // immediately sacrificing determinism for performance. | 20 // immediately sacrificing determinism for performance. |
| 20 class ExpeditedDispatcher : public URLRequestDispatcher { | 21 class HEADLESS_EXPORT ExpeditedDispatcher : public URLRequestDispatcher { |
| 21 public: | 22 public: |
| 22 explicit ExpeditedDispatcher( | 23 explicit ExpeditedDispatcher( |
| 23 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner); | 24 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner); |
| 24 ~ExpeditedDispatcher() override; | 25 ~ExpeditedDispatcher() override; |
| 25 | 26 |
| 26 // UrlRequestDispatcher implementation: | 27 // UrlRequestDispatcher implementation: |
| 27 void JobCreated(ManagedDispatchURLRequestJob* job) override; | 28 void JobCreated(ManagedDispatchURLRequestJob* job) override; |
| 28 void JobKilled(ManagedDispatchURLRequestJob* job) override; | 29 void JobKilled(ManagedDispatchURLRequestJob* job) override; |
| 29 void JobFailed(ManagedDispatchURLRequestJob* job, net::Error error) override; | 30 void JobFailed(ManagedDispatchURLRequestJob* job, net::Error error) override; |
| 30 void DataReady(ManagedDispatchURLRequestJob* job) override; | 31 void DataReady(ManagedDispatchURLRequestJob* job) override; |
| 31 void JobDeleted(ManagedDispatchURLRequestJob* job) override; | 32 void JobDeleted(ManagedDispatchURLRequestJob* job) override; |
| 32 void NavigationRequested( | 33 void NavigationRequested( |
| 33 std::unique_ptr<NavigationRequest> navigation_request) override; | 34 std::unique_ptr<NavigationRequest> navigation_request) override; |
| 34 | 35 |
| 35 private: | 36 private: |
| 36 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner_; | 37 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner_; |
| 37 | 38 |
| 38 DISALLOW_COPY_AND_ASSIGN(ExpeditedDispatcher); | 39 DISALLOW_COPY_AND_ASSIGN(ExpeditedDispatcher); |
| 39 }; | 40 }; |
| 40 | 41 |
| 41 } // namespace headless | 42 } // namespace headless |
| 42 | 43 |
| 43 #endif // HEADLESS_PUBLIC_UTIL_EXPEDITED_DISPATCHER_H_ | 44 #endif // HEADLESS_PUBLIC_UTIL_EXPEDITED_DISPATCHER_H_ |
| OLD | NEW |