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> |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 // | 122 // |
123 // |*out_req| will be initialized with a handle to the async request. | 123 // |*out_req| will be initialized with a handle to the async request. |
124 int GetChannelID(const std::string& host, | 124 int GetChannelID(const std::string& host, |
125 scoped_ptr<crypto::ECPrivateKey>* key, | 125 scoped_ptr<crypto::ECPrivateKey>* key, |
126 const CompletionCallback& callback, | 126 const CompletionCallback& callback, |
127 Request* out_req); | 127 Request* out_req); |
128 | 128 |
129 // Returns the backing ChannelIDStore. | 129 // Returns the backing ChannelIDStore. |
130 ChannelIDStore* GetChannelIDStore(); | 130 ChannelIDStore* GetChannelIDStore(); |
131 | 131 |
| 132 // Returns an ID that is unique across all instances of ChannelIDService in |
| 133 // this process. TODO(nharper): remove this once crbug.com/548423 is resolved. |
| 134 int GetUniqueID() const { return id_; } |
| 135 |
132 // Public only for unit testing. | 136 // Public only for unit testing. |
133 int channel_id_count(); | 137 int channel_id_count(); |
134 uint64_t requests() const { return requests_; } | 138 uint64_t requests() const { return requests_; } |
135 uint64_t key_store_hits() const { return key_store_hits_; } | 139 uint64_t key_store_hits() const { return key_store_hits_; } |
136 uint64_t inflight_joins() const { return inflight_joins_; } | 140 uint64_t inflight_joins() const { return inflight_joins_; } |
137 uint64_t workers_created() const { return workers_created_; } | 141 uint64_t workers_created() const { return workers_created_; } |
138 | 142 |
139 private: | 143 private: |
140 void GotChannelID(int err, | 144 void GotChannelID(int err, |
141 const std::string& server_identifier, | 145 const std::string& server_identifier, |
(...skipping 22 matching lines...) Expand all Loading... |
164 // failure (including failure to find a channel ID of |domain|). | 168 // failure (including failure to find a channel ID of |domain|). |
165 int LookupChannelID(const base::TimeTicks& request_start, | 169 int LookupChannelID(const base::TimeTicks& request_start, |
166 const std::string& domain, | 170 const std::string& domain, |
167 scoped_ptr<crypto::ECPrivateKey>* key, | 171 scoped_ptr<crypto::ECPrivateKey>* key, |
168 bool create_if_missing, | 172 bool create_if_missing, |
169 const CompletionCallback& callback, | 173 const CompletionCallback& callback, |
170 Request* out_req); | 174 Request* out_req); |
171 | 175 |
172 scoped_ptr<ChannelIDStore> channel_id_store_; | 176 scoped_ptr<ChannelIDStore> channel_id_store_; |
173 scoped_refptr<base::TaskRunner> task_runner_; | 177 scoped_refptr<base::TaskRunner> task_runner_; |
| 178 const int id_; |
174 | 179 |
175 // inflight_ maps from a server to an active generation which is taking | 180 // inflight_ maps from a server to an active generation which is taking |
176 // place. | 181 // place. |
177 std::map<std::string, ChannelIDServiceJob*> inflight_; | 182 std::map<std::string, ChannelIDServiceJob*> inflight_; |
178 | 183 |
179 uint64_t requests_; | 184 uint64_t requests_; |
180 uint64_t key_store_hits_; | 185 uint64_t key_store_hits_; |
181 uint64_t inflight_joins_; | 186 uint64_t inflight_joins_; |
182 uint64_t workers_created_; | 187 uint64_t workers_created_; |
183 | 188 |
184 base::WeakPtrFactory<ChannelIDService> weak_ptr_factory_; | 189 base::WeakPtrFactory<ChannelIDService> weak_ptr_factory_; |
185 | 190 |
186 DISALLOW_COPY_AND_ASSIGN(ChannelIDService); | 191 DISALLOW_COPY_AND_ASSIGN(ChannelIDService); |
187 }; | 192 }; |
188 | 193 |
189 } // namespace net | 194 } // namespace net |
190 | 195 |
191 #endif // NET_SSL_CHANNEL_ID_SERVICE_H_ | 196 #endif // NET_SSL_CHANNEL_ID_SERVICE_H_ |
OLD | NEW |