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_SSL_CHANNEL_ID_SERVICE_H_ | 5 #ifndef NET_SSL_CHANNEL_ID_SERVICE_H_ |
6 #define NET_SSL_CHANNEL_ID_SERVICE_H_ | 6 #define NET_SSL_CHANNEL_ID_SERVICE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <memory> | 11 #include <memory> |
12 #include <string> | 12 #include <string> |
13 #include <utility> | 13 #include <utility> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
19 #include "base/task_runner.h" | 19 #include "base/task_runner.h" |
20 #include "base/threading/non_thread_safe.h" | 20 #include "base/threading/thread_checker.h" |
21 #include "net/base/completion_callback.h" | 21 #include "net/base/completion_callback.h" |
22 #include "net/base/net_export.h" | 22 #include "net/base/net_export.h" |
23 #include "net/ssl/channel_id_store.h" | 23 #include "net/ssl/channel_id_store.h" |
24 | 24 |
25 namespace crypto { | 25 namespace crypto { |
26 class ECPrivateKey; | 26 class ECPrivateKey; |
27 } // namespace crypto | 27 } // namespace crypto |
28 | 28 |
29 namespace net { | 29 namespace net { |
30 | 30 |
31 class ChannelIDServiceJob; | 31 class ChannelIDServiceJob; |
32 | 32 |
33 // A class for creating and fetching Channel IDs. | 33 // A class for creating and fetching Channel IDs. |
34 | 34 class NET_EXPORT ChannelIDService { |
35 // Inherits from NonThreadSafe in order to use the function | |
36 // |CalledOnValidThread|. | |
37 class NET_EXPORT ChannelIDService | |
38 : NON_EXPORTED_BASE(public base::NonThreadSafe) { | |
39 public: | 35 public: |
40 class NET_EXPORT Request { | 36 class NET_EXPORT Request { |
41 public: | 37 public: |
42 Request(); | 38 Request(); |
43 ~Request(); | 39 ~Request(); |
44 | 40 |
45 // Cancel the request. Does nothing if the request finished or was already | 41 // Cancel the request. Does nothing if the request finished or was already |
46 // cancelled. | 42 // cancelled. |
47 void Cancel(); | 43 void Cancel(); |
48 | 44 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 165 |
170 // inflight_ maps from a server to an active generation which is taking | 166 // inflight_ maps from a server to an active generation which is taking |
171 // place. | 167 // place. |
172 std::map<std::string, std::unique_ptr<ChannelIDServiceJob>> inflight_; | 168 std::map<std::string, std::unique_ptr<ChannelIDServiceJob>> inflight_; |
173 | 169 |
174 uint64_t requests_; | 170 uint64_t requests_; |
175 uint64_t key_store_hits_; | 171 uint64_t key_store_hits_; |
176 uint64_t inflight_joins_; | 172 uint64_t inflight_joins_; |
177 uint64_t workers_created_; | 173 uint64_t workers_created_; |
178 | 174 |
| 175 THREAD_CHECKER(thread_checker_); |
| 176 |
179 base::WeakPtrFactory<ChannelIDService> weak_ptr_factory_; | 177 base::WeakPtrFactory<ChannelIDService> weak_ptr_factory_; |
180 | 178 |
181 DISALLOW_COPY_AND_ASSIGN(ChannelIDService); | 179 DISALLOW_COPY_AND_ASSIGN(ChannelIDService); |
182 }; | 180 }; |
183 | 181 |
184 } // namespace net | 182 } // namespace net |
185 | 183 |
186 #endif // NET_SSL_CHANNEL_ID_SERVICE_H_ | 184 #endif // NET_SSL_CHANNEL_ID_SERVICE_H_ |
OLD | NEW |