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 #include "net/ssl/default_channel_id_store.h" | 5 #include "net/ssl/default_channel_id_store.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/profiler/scoped_tracker.h" | |
11 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
12 | 11 |
13 namespace net { | 12 namespace net { |
14 | 13 |
15 // -------------------------------------------------------------------------- | 14 // -------------------------------------------------------------------------- |
16 // Task | 15 // Task |
17 class DefaultChannelIDStore::Task { | 16 class DefaultChannelIDStore::Task { |
18 public: | 17 public: |
19 virtual ~Task(); | 18 virtual ~Task(); |
20 | 19 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 const GetChannelIDCallback& callback) | 54 const GetChannelIDCallback& callback) |
56 : server_identifier_(server_identifier), | 55 : server_identifier_(server_identifier), |
57 callback_(callback) { | 56 callback_(callback) { |
58 } | 57 } |
59 | 58 |
60 DefaultChannelIDStore::GetChannelIDTask::~GetChannelIDTask() { | 59 DefaultChannelIDStore::GetChannelIDTask::~GetChannelIDTask() { |
61 } | 60 } |
62 | 61 |
63 void DefaultChannelIDStore::GetChannelIDTask::Run( | 62 void DefaultChannelIDStore::GetChannelIDTask::Run( |
64 DefaultChannelIDStore* store) { | 63 DefaultChannelIDStore* store) { |
65 // TODO(vadimt): Remove ScopedTracker below once crbug.com/425814 is fixed. | |
66 tracked_objects::ScopedTracker tracking_profile( | |
67 FROM_HERE_WITH_EXPLICIT_FUNCTION( | |
68 "425814 DefaultChannelIDStore::GetChannelIDTask::Run")); | |
69 | |
70 base::Time expiration_time; | 64 base::Time expiration_time; |
71 std::string private_key_result; | 65 std::string private_key_result; |
72 std::string cert_result; | 66 std::string cert_result; |
73 int err = store->GetChannelID( | 67 int err = store->GetChannelID( |
74 server_identifier_, &expiration_time, &private_key_result, | 68 server_identifier_, &expiration_time, &private_key_result, |
75 &cert_result, GetChannelIDCallback()); | 69 &cert_result, GetChannelIDCallback()); |
76 DCHECK(err != ERR_IO_PENDING); | 70 DCHECK(err != ERR_IO_PENDING); |
77 | 71 |
78 InvokeCallback(base::Bind(callback_, err, server_identifier_, | 72 InvokeCallback(base::Bind(callback_, err, server_identifier_, |
79 expiration_time, private_key_result, cert_result)); | 73 expiration_time, private_key_result, cert_result)); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 expiration_time_(expiration_time), | 105 expiration_time_(expiration_time), |
112 private_key_(private_key), | 106 private_key_(private_key), |
113 cert_(cert) { | 107 cert_(cert) { |
114 } | 108 } |
115 | 109 |
116 DefaultChannelIDStore::SetChannelIDTask::~SetChannelIDTask() { | 110 DefaultChannelIDStore::SetChannelIDTask::~SetChannelIDTask() { |
117 } | 111 } |
118 | 112 |
119 void DefaultChannelIDStore::SetChannelIDTask::Run( | 113 void DefaultChannelIDStore::SetChannelIDTask::Run( |
120 DefaultChannelIDStore* store) { | 114 DefaultChannelIDStore* store) { |
121 // TODO(vadimt): Remove ScopedTracker below once crbug.com/425814 is fixed. | |
122 tracked_objects::ScopedTracker tracking_profile( | |
123 FROM_HERE_WITH_EXPLICIT_FUNCTION( | |
124 "425814 DefaultChannelIDStore::SetChannelIDTask::Run")); | |
125 | |
126 store->SyncSetChannelID(server_identifier_, creation_time_, | 115 store->SyncSetChannelID(server_identifier_, creation_time_, |
127 expiration_time_, private_key_, cert_); | 116 expiration_time_, private_key_, cert_); |
128 } | 117 } |
129 | 118 |
130 // -------------------------------------------------------------------------- | 119 // -------------------------------------------------------------------------- |
131 // DeleteChannelIDTask | 120 // DeleteChannelIDTask |
132 class DefaultChannelIDStore::DeleteChannelIDTask | 121 class DefaultChannelIDStore::DeleteChannelIDTask |
133 : public DefaultChannelIDStore::Task { | 122 : public DefaultChannelIDStore::Task { |
134 public: | 123 public: |
135 DeleteChannelIDTask(const std::string& server_identifier, | 124 DeleteChannelIDTask(const std::string& server_identifier, |
(...skipping 13 matching lines...) Expand all Loading... |
149 : server_identifier_(server_identifier), | 138 : server_identifier_(server_identifier), |
150 callback_(callback) { | 139 callback_(callback) { |
151 } | 140 } |
152 | 141 |
153 DefaultChannelIDStore::DeleteChannelIDTask:: | 142 DefaultChannelIDStore::DeleteChannelIDTask:: |
154 ~DeleteChannelIDTask() { | 143 ~DeleteChannelIDTask() { |
155 } | 144 } |
156 | 145 |
157 void DefaultChannelIDStore::DeleteChannelIDTask::Run( | 146 void DefaultChannelIDStore::DeleteChannelIDTask::Run( |
158 DefaultChannelIDStore* store) { | 147 DefaultChannelIDStore* store) { |
159 // TODO(vadimt): Remove ScopedTracker below once crbug.com/425814 is fixed. | |
160 tracked_objects::ScopedTracker tracking_profile( | |
161 FROM_HERE_WITH_EXPLICIT_FUNCTION( | |
162 "425814 DefaultChannelIDStore::DeleteChannelIDTask::Run")); | |
163 | |
164 store->SyncDeleteChannelID(server_identifier_); | 148 store->SyncDeleteChannelID(server_identifier_); |
165 | 149 |
166 InvokeCallback(callback_); | 150 InvokeCallback(callback_); |
167 } | 151 } |
168 | 152 |
169 // -------------------------------------------------------------------------- | 153 // -------------------------------------------------------------------------- |
170 // DeleteAllCreatedBetweenTask | 154 // DeleteAllCreatedBetweenTask |
171 class DefaultChannelIDStore::DeleteAllCreatedBetweenTask | 155 class DefaultChannelIDStore::DeleteAllCreatedBetweenTask |
172 : public DefaultChannelIDStore::Task { | 156 : public DefaultChannelIDStore::Task { |
173 public: | 157 public: |
(...skipping 18 matching lines...) Expand all Loading... |
192 delete_end_(delete_end), | 176 delete_end_(delete_end), |
193 callback_(callback) { | 177 callback_(callback) { |
194 } | 178 } |
195 | 179 |
196 DefaultChannelIDStore::DeleteAllCreatedBetweenTask:: | 180 DefaultChannelIDStore::DeleteAllCreatedBetweenTask:: |
197 ~DeleteAllCreatedBetweenTask() { | 181 ~DeleteAllCreatedBetweenTask() { |
198 } | 182 } |
199 | 183 |
200 void DefaultChannelIDStore::DeleteAllCreatedBetweenTask::Run( | 184 void DefaultChannelIDStore::DeleteAllCreatedBetweenTask::Run( |
201 DefaultChannelIDStore* store) { | 185 DefaultChannelIDStore* store) { |
202 // TODO(vadimt): Remove ScopedTracker below once crbug.com/425814 is fixed. | |
203 tracked_objects::ScopedTracker tracking_profile( | |
204 FROM_HERE_WITH_EXPLICIT_FUNCTION( | |
205 "425814 DefaultChannelIDStore::DeleteAllCreatedBetweenTask::Run")); | |
206 | |
207 store->SyncDeleteAllCreatedBetween(delete_begin_, delete_end_); | 186 store->SyncDeleteAllCreatedBetween(delete_begin_, delete_end_); |
208 | 187 |
209 InvokeCallback(callback_); | 188 InvokeCallback(callback_); |
210 } | 189 } |
211 | 190 |
212 // -------------------------------------------------------------------------- | 191 // -------------------------------------------------------------------------- |
213 // GetAllChannelIDsTask | 192 // GetAllChannelIDsTask |
214 class DefaultChannelIDStore::GetAllChannelIDsTask | 193 class DefaultChannelIDStore::GetAllChannelIDsTask |
215 : public DefaultChannelIDStore::Task { | 194 : public DefaultChannelIDStore::Task { |
216 public: | 195 public: |
(...skipping 10 matching lines...) Expand all Loading... |
227 GetAllChannelIDsTask(const GetChannelIDListCallback& callback) | 206 GetAllChannelIDsTask(const GetChannelIDListCallback& callback) |
228 : callback_(callback) { | 207 : callback_(callback) { |
229 } | 208 } |
230 | 209 |
231 DefaultChannelIDStore::GetAllChannelIDsTask:: | 210 DefaultChannelIDStore::GetAllChannelIDsTask:: |
232 ~GetAllChannelIDsTask() { | 211 ~GetAllChannelIDsTask() { |
233 } | 212 } |
234 | 213 |
235 void DefaultChannelIDStore::GetAllChannelIDsTask::Run( | 214 void DefaultChannelIDStore::GetAllChannelIDsTask::Run( |
236 DefaultChannelIDStore* store) { | 215 DefaultChannelIDStore* store) { |
237 // TODO(vadimt): Remove ScopedTracker below once crbug.com/425814 is fixed. | |
238 tracked_objects::ScopedTracker tracking_profile( | |
239 FROM_HERE_WITH_EXPLICIT_FUNCTION( | |
240 "425814 DefaultChannelIDStore::GetAllChannelIDsTask::Run")); | |
241 | |
242 ChannelIDList cert_list; | 216 ChannelIDList cert_list; |
243 store->SyncGetAllChannelIDs(&cert_list); | 217 store->SyncGetAllChannelIDs(&cert_list); |
244 | 218 |
245 InvokeCallback(base::Bind(callback_, cert_list)); | 219 InvokeCallback(base::Bind(callback_, cert_list)); |
246 } | 220 } |
247 | 221 |
248 // -------------------------------------------------------------------------- | 222 // -------------------------------------------------------------------------- |
249 // DefaultChannelIDStore | 223 // DefaultChannelIDStore |
250 | 224 |
251 DefaultChannelIDStore::DefaultChannelIDStore( | 225 DefaultChannelIDStore::DefaultChannelIDStore( |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 if (store_.get()) | 462 if (store_.get()) |
489 store_->AddChannelID(*channel_id); | 463 store_->AddChannelID(*channel_id); |
490 channel_ids_[server_identifier] = channel_id; | 464 channel_ids_[server_identifier] = channel_id; |
491 } | 465 } |
492 | 466 |
493 DefaultChannelIDStore::PersistentStore::PersistentStore() {} | 467 DefaultChannelIDStore::PersistentStore::PersistentStore() {} |
494 | 468 |
495 DefaultChannelIDStore::PersistentStore::~PersistentStore() {} | 469 DefaultChannelIDStore::PersistentStore::~PersistentStore() {} |
496 | 470 |
497 } // namespace net | 471 } // namespace net |
OLD | NEW |