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