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> |
| 9 |
8 #include <map> | 10 #include <map> |
9 #include <string> | 11 #include <string> |
10 #include <vector> | 12 #include <vector> |
11 | 13 |
12 #include "base/basictypes.h" | 14 #include "base/macros.h" |
13 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
15 #include "base/threading/non_thread_safe.h" | 17 #include "base/threading/non_thread_safe.h" |
16 #include "base/time/time.h" | 18 #include "base/time/time.h" |
17 #include "net/base/completion_callback.h" | 19 #include "net/base/completion_callback.h" |
18 #include "net/base/net_export.h" | 20 #include "net/base/net_export.h" |
19 #include "net/ssl/channel_id_store.h" | 21 #include "net/ssl/channel_id_store.h" |
20 | 22 |
21 namespace base { | 23 namespace base { |
22 class TaskRunner; | 24 class TaskRunner; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 int GetChannelID(const std::string& host, | 124 int GetChannelID(const std::string& host, |
123 scoped_ptr<crypto::ECPrivateKey>* key, | 125 scoped_ptr<crypto::ECPrivateKey>* key, |
124 const CompletionCallback& callback, | 126 const CompletionCallback& callback, |
125 Request* out_req); | 127 Request* out_req); |
126 | 128 |
127 // Returns the backing ChannelIDStore. | 129 // Returns the backing ChannelIDStore. |
128 ChannelIDStore* GetChannelIDStore(); | 130 ChannelIDStore* GetChannelIDStore(); |
129 | 131 |
130 // Public only for unit testing. | 132 // Public only for unit testing. |
131 int channel_id_count(); | 133 int channel_id_count(); |
132 uint64 requests() const { return requests_; } | 134 uint64_t requests() const { return requests_; } |
133 uint64 key_store_hits() const { return key_store_hits_; } | 135 uint64_t key_store_hits() const { return key_store_hits_; } |
134 uint64 inflight_joins() const { return inflight_joins_; } | 136 uint64_t inflight_joins() const { return inflight_joins_; } |
135 uint64 workers_created() const { return workers_created_; } | 137 uint64_t workers_created() const { return workers_created_; } |
136 | 138 |
137 private: | 139 private: |
138 void GotChannelID(int err, | 140 void GotChannelID(int err, |
139 const std::string& server_identifier, | 141 const std::string& server_identifier, |
140 scoped_ptr<crypto::ECPrivateKey> key); | 142 scoped_ptr<crypto::ECPrivateKey> key); |
141 void GeneratedChannelID( | 143 void GeneratedChannelID( |
142 const std::string& server_identifier, | 144 const std::string& server_identifier, |
143 int error, | 145 int error, |
144 scoped_ptr<ChannelIDStore::ChannelID> channel_id); | 146 scoped_ptr<ChannelIDStore::ChannelID> channel_id); |
145 void HandleResult(int error, | 147 void HandleResult(int error, |
(...skipping 21 matching lines...) Expand all Loading... |
167 const CompletionCallback& callback, | 169 const CompletionCallback& callback, |
168 Request* out_req); | 170 Request* out_req); |
169 | 171 |
170 scoped_ptr<ChannelIDStore> channel_id_store_; | 172 scoped_ptr<ChannelIDStore> channel_id_store_; |
171 scoped_refptr<base::TaskRunner> task_runner_; | 173 scoped_refptr<base::TaskRunner> task_runner_; |
172 | 174 |
173 // inflight_ maps from a server to an active generation which is taking | 175 // inflight_ maps from a server to an active generation which is taking |
174 // place. | 176 // place. |
175 std::map<std::string, ChannelIDServiceJob*> inflight_; | 177 std::map<std::string, ChannelIDServiceJob*> inflight_; |
176 | 178 |
177 uint64 requests_; | 179 uint64_t requests_; |
178 uint64 key_store_hits_; | 180 uint64_t key_store_hits_; |
179 uint64 inflight_joins_; | 181 uint64_t inflight_joins_; |
180 uint64 workers_created_; | 182 uint64_t workers_created_; |
181 | 183 |
182 base::WeakPtrFactory<ChannelIDService> weak_ptr_factory_; | 184 base::WeakPtrFactory<ChannelIDService> weak_ptr_factory_; |
183 | 185 |
184 DISALLOW_COPY_AND_ASSIGN(ChannelIDService); | 186 DISALLOW_COPY_AND_ASSIGN(ChannelIDService); |
185 }; | 187 }; |
186 | 188 |
187 } // namespace net | 189 } // namespace net |
188 | 190 |
189 #endif // NET_SSL_CHANNEL_ID_SERVICE_H_ | 191 #endif // NET_SSL_CHANNEL_ID_SERVICE_H_ |
OLD | NEW |