OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 NET_HTTP_HTTP_SERVER_PROPERTIES_MANAGER_H_ | 5 #ifndef NET_HTTP_HTTP_SERVER_PROPERTIES_MANAGER_H_ |
6 #define NET_HTTP_HTTP_SERVER_PROPERTIES_MANAGER_H_ | 6 #define NET_HTTP_HTTP_SERVER_PROPERTIES_MANAGER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
15 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
18 #include "base/timer/timer.h" | 18 #include "base/timer/timer.h" |
19 #include "base/values.h" | 19 #include "base/values.h" |
20 #include "net/base/host_port_pair.h" | 20 #include "net/base/host_port_pair.h" |
21 #include "net/base/net_export.h" | 21 #include "net/base/net_export.h" |
22 #include "net/http/http_server_properties.h" | 22 #include "net/http/http_server_properties.h" |
23 #include "net/http/http_server_properties_impl.h" | 23 #include "net/http/http_server_properties_impl.h" |
| 24 #include "net/log/net_log_with_source.h" |
24 | 25 |
25 namespace base { | 26 namespace base { |
26 class SingleThreadTaskRunner; | 27 class SingleThreadTaskRunner; |
27 } | 28 } |
28 | 29 |
29 namespace net { | 30 namespace net { |
30 | 31 |
31 class IPAddress; | 32 class IPAddress; |
32 | 33 |
33 //////////////////////////////////////////////////////////////////////////////// | 34 //////////////////////////////////////////////////////////////////////////////// |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 // the test uses gmock and it doesn't forward move semantics properly. | 89 // the test uses gmock and it doesn't forward move semantics properly. |
89 // | 90 // |
90 // There are two SingleThreadTaskRunners: | 91 // There are two SingleThreadTaskRunners: |
91 // |pref_task_runner| should be bound with the pref thread and is used to post | 92 // |pref_task_runner| should be bound with the pref thread and is used to post |
92 // cache update to the pref thread; | 93 // cache update to the pref thread; |
93 // |network_task_runner| should be bound with the network thread and is used | 94 // |network_task_runner| should be bound with the network thread and is used |
94 // to post pref update to the cache thread. | 95 // to post pref update to the cache thread. |
95 HttpServerPropertiesManager( | 96 HttpServerPropertiesManager( |
96 PrefDelegate* pref_delegate, | 97 PrefDelegate* pref_delegate, |
97 scoped_refptr<base::SingleThreadTaskRunner> pref_task_runner, | 98 scoped_refptr<base::SingleThreadTaskRunner> pref_task_runner, |
98 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner); | 99 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner, |
| 100 NetLog* net_log); |
99 ~HttpServerPropertiesManager() override; | 101 ~HttpServerPropertiesManager() override; |
100 | 102 |
101 // Initialize on Network thread. | 103 // Initialize on Network thread. |
102 void InitializeOnNetworkSequence(); | 104 void InitializeOnNetworkSequence(); |
103 | 105 |
104 // Prepare for shutdown. Must be called on the Pref thread before destruction. | 106 // Prepare for shutdown. Must be called on the Pref thread before destruction. |
105 void ShutdownOnPrefSequence(); | 107 void ShutdownOnPrefSequence(); |
106 | 108 |
107 // Helper function for unit tests to set the version in the dictionary. | 109 // Helper function for unit tests to set the version in the dictionary. |
108 static void SetVersion(base::DictionaryValue* http_server_properties_dict, | 110 static void SetVersion(base::DictionaryValue* http_server_properties_dict, |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 std::unique_ptr<HttpServerPropertiesImpl> http_server_properties_impl_; | 316 std::unique_ptr<HttpServerPropertiesImpl> http_server_properties_impl_; |
315 | 317 |
316 // Used to get |weak_ptr_| to self on the pref thread. | 318 // Used to get |weak_ptr_| to self on the pref thread. |
317 std::unique_ptr<base::WeakPtrFactory<HttpServerPropertiesManager>> | 319 std::unique_ptr<base::WeakPtrFactory<HttpServerPropertiesManager>> |
318 pref_weak_ptr_factory_; | 320 pref_weak_ptr_factory_; |
319 | 321 |
320 // Used to get |weak_ptr_| to self on the network thread. | 322 // Used to get |weak_ptr_| to self on the network thread. |
321 std::unique_ptr<base::WeakPtrFactory<HttpServerPropertiesManager>> | 323 std::unique_ptr<base::WeakPtrFactory<HttpServerPropertiesManager>> |
322 network_weak_ptr_factory_; | 324 network_weak_ptr_factory_; |
323 | 325 |
| 326 const NetLogWithSource net_log_; |
| 327 |
324 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesManager); | 328 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesManager); |
325 }; | 329 }; |
326 | 330 |
327 } // namespace net | 331 } // namespace net |
328 | 332 |
329 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_MANAGER_H_ | 333 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_MANAGER_H_ |
OLD | NEW |