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_DETERMINISTIC_HTTP_PROTOCOL_HANDLER_H_ | 5 #ifndef HEADLESS_PUBLIC_UTIL_DETERMINISTIC_HTTP_PROTOCOL_HANDLER_H_ |
6 #define HEADLESS_PUBLIC_UTIL_DETERMINISTIC_HTTP_PROTOCOL_HANDLER_H_ | 6 #define HEADLESS_PUBLIC_UTIL_DETERMINISTIC_HTTP_PROTOCOL_HANDLER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
11 #include "net/url_request/url_request_job_factory.h" | 11 #include "net/url_request/url_request_job_factory.h" |
12 | 12 |
13 namespace net { | 13 namespace net { |
14 class URLRequestContext; | 14 class URLRequestContext; |
15 class URLRequestJobFactory; | 15 class URLRequestJobFactory; |
16 } // namespace | 16 } // namespace |
17 | 17 |
18 namespace headless { | 18 namespace headless { |
19 class DeterministicDispatcher; | 19 class DeterministicDispatcher; |
20 class HeadlessBrowserContext; | |
21 | 20 |
22 // A deterministic protocol handler. Requests made to this protocol handler | 21 // A deterministic protocol handler. Requests made to this protocol handler |
23 // will return in order of creation, regardless of what order the network | 22 // will return in order of creation, regardless of what order the network |
24 // returns them in. This helps remove one large source of network related | 23 // returns them in. This helps remove one large source of network related |
25 // non determinism at the cost of slower page loads. | 24 // non determinism at the cost of slower page loads. |
26 class DeterministicHttpProtocolHandler | 25 class DeterministicHttpProtocolHandler |
27 : public net::URLRequestJobFactory::ProtocolHandler { | 26 : public net::URLRequestJobFactory::ProtocolHandler { |
28 public: | 27 public: |
29 // Note |deterministic_dispatcher| is expected to be shared across a number of | 28 // Note |deterministic_dispatcher| is expected to be shared across a number of |
30 // protocol handlers, e.g. for http & https protocols. | 29 // protocol handlers, e.g. for http & https protocols. |
(...skipping 19 matching lines...) Expand all Loading... |
50 // http resources. | 49 // http resources. |
51 mutable std::unique_ptr<net::URLRequestContext> url_request_context_; | 50 mutable std::unique_ptr<net::URLRequestContext> url_request_context_; |
52 mutable std::unique_ptr<net::URLRequestJobFactory> url_request_job_factory_; | 51 mutable std::unique_ptr<net::URLRequestJobFactory> url_request_job_factory_; |
53 | 52 |
54 DISALLOW_COPY_AND_ASSIGN(DeterministicHttpProtocolHandler); | 53 DISALLOW_COPY_AND_ASSIGN(DeterministicHttpProtocolHandler); |
55 }; | 54 }; |
56 | 55 |
57 } // namespace headless | 56 } // namespace headless |
58 | 57 |
59 #endif // HEADLESS_PUBLIC_UTIL_DETERMINISTIC_HTTP_PROTOCOL_HANDLER_H_ | 58 #endif // HEADLESS_PUBLIC_UTIL_DETERMINISTIC_HTTP_PROTOCOL_HANDLER_H_ |
OLD | NEW |