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_DISPATCHER_H_ | 5 #ifndef HEADLESS_PUBLIC_UTIL_DETERMINISTIC_DISPATCHER_H_ |
6 #define HEADLESS_PUBLIC_UTIL_DETERMINISTIC_DISPATCHER_H_ | 6 #define HEADLESS_PUBLIC_UTIL_DETERMINISTIC_DISPATCHER_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/weak_ptr.h" |
13 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
14 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
15 #include "headless/public/util/url_request_dispatcher.h" | 16 #include "headless/public/util/url_request_dispatcher.h" |
16 #include "net/base/net_errors.h" | 17 #include "net/base/net_errors.h" |
17 | 18 |
18 namespace headless { | 19 namespace headless { |
19 | 20 |
20 class ManagedDispatchURLRequestJob; | 21 class ManagedDispatchURLRequestJob; |
21 | 22 |
22 // The purpose of this class is to queue up calls to OnHeadersComplete and | 23 // The purpose of this class is to queue up calls to OnHeadersComplete and |
(...skipping 24 matching lines...) Expand all Loading... |
47 | 48 |
48 std::deque<ManagedDispatchURLRequestJob*> pending_requests_; | 49 std::deque<ManagedDispatchURLRequestJob*> pending_requests_; |
49 | 50 |
50 using StatusMap = std::map<ManagedDispatchURLRequestJob*, net::Error>; | 51 using StatusMap = std::map<ManagedDispatchURLRequestJob*, net::Error>; |
51 StatusMap ready_status_map_; | 52 StatusMap ready_status_map_; |
52 | 53 |
53 // Whether or not a MaybeDispatchJobOnIoThreadTask has been posted on the | 54 // Whether or not a MaybeDispatchJobOnIoThreadTask has been posted on the |
54 // |io_thread_task_runner_| | 55 // |io_thread_task_runner_| |
55 bool dispatch_pending_; | 56 bool dispatch_pending_; |
56 | 57 |
| 58 base::WeakPtrFactory<DeterministicDispatcher> weak_ptr_factory_; |
| 59 |
57 DISALLOW_COPY_AND_ASSIGN(DeterministicDispatcher); | 60 DISALLOW_COPY_AND_ASSIGN(DeterministicDispatcher); |
58 }; | 61 }; |
59 | 62 |
60 } // namespace headless | 63 } // namespace headless |
61 | 64 |
62 #endif // HEADLESS_PUBLIC_UTIL_DETERMINISTIC_DISPATCHER_H_ | 65 #endif // HEADLESS_PUBLIC_UTIL_DETERMINISTIC_DISPATCHER_H_ |
OLD | NEW |