OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef HEADLESS_PUBLIC_UTIL_URL_REQUEST_DISPATCHER_H_ |
| 6 #define HEADLESS_PUBLIC_UTIL_URL_REQUEST_DISPATCHER_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "net/base/net_errors.h" |
| 10 |
| 11 namespace headless { |
| 12 class ManagedDispatchURLRequestJob; |
| 13 |
| 14 // Interface to abstract and potentially reorder (for determinism) calls to |
| 15 // ManagedDispatchUrlRequestJob::OnHeadersComplete and |
| 16 // ManagedDispatchUrlRequestJob::NotifyStartError. |
| 17 class URLRequestDispatcher { |
| 18 public: |
| 19 URLRequestDispatcher() {} |
| 20 virtual ~URLRequestDispatcher() {} |
| 21 |
| 22 // Tells us a URLRequestJob was created. Can be called from any thread. |
| 23 virtual void JobCreated(ManagedDispatchURLRequestJob* job) = 0; |
| 24 |
| 25 // Tells us a URLRequestJob got killed. Can be called from any thread. |
| 26 virtual void JobKilled(ManagedDispatchURLRequestJob* job) = 0; |
| 27 |
| 28 // Tells us a URLRequestJob failed. Can be called from any thread. |
| 29 virtual void JobFailed(ManagedDispatchURLRequestJob* job, |
| 30 net::Error error) = 0; |
| 31 |
| 32 // Tells us a URLRequestJob has fetched the data and is ready for the net |
| 33 // stack to consume it. Can be called from any thread. |
| 34 virtual void DataReady(ManagedDispatchURLRequestJob* job) = 0; |
| 35 |
| 36 // Tells us the job has finished. Can be called from any thread. |
| 37 virtual void JobDeleted(ManagedDispatchURLRequestJob* job) = 0; |
| 38 |
| 39 private: |
| 40 DISALLOW_COPY_AND_ASSIGN(URLRequestDispatcher); |
| 41 }; |
| 42 |
| 43 } // namespace headless |
| 44 |
| 45 #endif // HEADLESS_PUBLIC_UTIL_URL_REQUEST_DISPATCHER_H_ |
OLD | NEW |