| 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 "base/profiler/scoped_tracker.h" |
| 11 #include "net/base/net_errors.h" | 11 #include "net/base/net_errors.h" |
| 12 | 12 |
| 13 namespace net { | 13 namespace net { |
| 14 | 14 |
| 15 // -------------------------------------------------------------------------- | 15 // -------------------------------------------------------------------------- |
| 16 // Task | 16 // Task |
| 17 class DefaultChannelIDStore::Task { | 17 class DefaultChannelIDStore::Task { |
| 18 public: | 18 public: |
| 19 virtual ~Task(); | 19 virtual ~Task(); |
| 20 | 20 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 const GetChannelIDCallback& callback) | 55 const GetChannelIDCallback& callback) |
| 56 : server_identifier_(server_identifier), | 56 : server_identifier_(server_identifier), |
| 57 callback_(callback) { | 57 callback_(callback) { |
| 58 } | 58 } |
| 59 | 59 |
| 60 DefaultChannelIDStore::GetChannelIDTask::~GetChannelIDTask() { | 60 DefaultChannelIDStore::GetChannelIDTask::~GetChannelIDTask() { |
| 61 } | 61 } |
| 62 | 62 |
| 63 void DefaultChannelIDStore::GetChannelIDTask::Run( | 63 void DefaultChannelIDStore::GetChannelIDTask::Run( |
| 64 DefaultChannelIDStore* store) { | 64 DefaultChannelIDStore* store) { |
| 65 // TODO(vadimt): Remove ScopedProfile below once crbug.com/425814 is fixed. | 65 // TODO(vadimt): Remove ScopedTracker below once crbug.com/425814 is fixed. |
| 66 tracked_objects::ScopedProfile tracking_profile( | 66 tracked_objects::ScopedTracker tracking_profile( |
| 67 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 67 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 68 "425814 DefaultChannelIDStore::GetChannelIDTask::Run")); | 68 "425814 DefaultChannelIDStore::GetChannelIDTask::Run")); |
| 69 | 69 |
| 70 base::Time expiration_time; | 70 base::Time expiration_time; |
| 71 std::string private_key_result; | 71 std::string private_key_result; |
| 72 std::string cert_result; | 72 std::string cert_result; |
| 73 int err = store->GetChannelID( | 73 int err = store->GetChannelID( |
| 74 server_identifier_, &expiration_time, &private_key_result, | 74 server_identifier_, &expiration_time, &private_key_result, |
| 75 &cert_result, GetChannelIDCallback()); | 75 &cert_result, GetChannelIDCallback()); |
| 76 DCHECK(err != ERR_IO_PENDING); | 76 DCHECK(err != ERR_IO_PENDING); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 expiration_time_(expiration_time), | 111 expiration_time_(expiration_time), |
| 112 private_key_(private_key), | 112 private_key_(private_key), |
| 113 cert_(cert) { | 113 cert_(cert) { |
| 114 } | 114 } |
| 115 | 115 |
| 116 DefaultChannelIDStore::SetChannelIDTask::~SetChannelIDTask() { | 116 DefaultChannelIDStore::SetChannelIDTask::~SetChannelIDTask() { |
| 117 } | 117 } |
| 118 | 118 |
| 119 void DefaultChannelIDStore::SetChannelIDTask::Run( | 119 void DefaultChannelIDStore::SetChannelIDTask::Run( |
| 120 DefaultChannelIDStore* store) { | 120 DefaultChannelIDStore* store) { |
| 121 // TODO(vadimt): Remove ScopedProfile below once crbug.com/425814 is fixed. | 121 // TODO(vadimt): Remove ScopedTracker below once crbug.com/425814 is fixed. |
| 122 tracked_objects::ScopedProfile tracking_profile( | 122 tracked_objects::ScopedTracker tracking_profile( |
| 123 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 123 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 124 "425814 DefaultChannelIDStore::SetChannelIDTask::Run")); | 124 "425814 DefaultChannelIDStore::SetChannelIDTask::Run")); |
| 125 | 125 |
| 126 store->SyncSetChannelID(server_identifier_, creation_time_, | 126 store->SyncSetChannelID(server_identifier_, creation_time_, |
| 127 expiration_time_, private_key_, cert_); | 127 expiration_time_, private_key_, cert_); |
| 128 } | 128 } |
| 129 | 129 |
| 130 // -------------------------------------------------------------------------- | 130 // -------------------------------------------------------------------------- |
| 131 // DeleteChannelIDTask | 131 // DeleteChannelIDTask |
| 132 class DefaultChannelIDStore::DeleteChannelIDTask | 132 class DefaultChannelIDStore::DeleteChannelIDTask |
| (...skipping 16 matching lines...) Expand all Loading... |
| 149 : server_identifier_(server_identifier), | 149 : server_identifier_(server_identifier), |
| 150 callback_(callback) { | 150 callback_(callback) { |
| 151 } | 151 } |
| 152 | 152 |
| 153 DefaultChannelIDStore::DeleteChannelIDTask:: | 153 DefaultChannelIDStore::DeleteChannelIDTask:: |
| 154 ~DeleteChannelIDTask() { | 154 ~DeleteChannelIDTask() { |
| 155 } | 155 } |
| 156 | 156 |
| 157 void DefaultChannelIDStore::DeleteChannelIDTask::Run( | 157 void DefaultChannelIDStore::DeleteChannelIDTask::Run( |
| 158 DefaultChannelIDStore* store) { | 158 DefaultChannelIDStore* store) { |
| 159 // TODO(vadimt): Remove ScopedProfile below once crbug.com/425814 is fixed. | 159 // TODO(vadimt): Remove ScopedTracker below once crbug.com/425814 is fixed. |
| 160 tracked_objects::ScopedProfile tracking_profile( | 160 tracked_objects::ScopedTracker tracking_profile( |
| 161 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 161 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 162 "425814 DefaultChannelIDStore::DeleteChannelIDTask::Run")); | 162 "425814 DefaultChannelIDStore::DeleteChannelIDTask::Run")); |
| 163 | 163 |
| 164 store->SyncDeleteChannelID(server_identifier_); | 164 store->SyncDeleteChannelID(server_identifier_); |
| 165 | 165 |
| 166 InvokeCallback(callback_); | 166 InvokeCallback(callback_); |
| 167 } | 167 } |
| 168 | 168 |
| 169 // -------------------------------------------------------------------------- | 169 // -------------------------------------------------------------------------- |
| 170 // DeleteAllCreatedBetweenTask | 170 // DeleteAllCreatedBetweenTask |
| (...skipping 21 matching lines...) Expand all Loading... |
| 192 delete_end_(delete_end), | 192 delete_end_(delete_end), |
| 193 callback_(callback) { | 193 callback_(callback) { |
| 194 } | 194 } |
| 195 | 195 |
| 196 DefaultChannelIDStore::DeleteAllCreatedBetweenTask:: | 196 DefaultChannelIDStore::DeleteAllCreatedBetweenTask:: |
| 197 ~DeleteAllCreatedBetweenTask() { | 197 ~DeleteAllCreatedBetweenTask() { |
| 198 } | 198 } |
| 199 | 199 |
| 200 void DefaultChannelIDStore::DeleteAllCreatedBetweenTask::Run( | 200 void DefaultChannelIDStore::DeleteAllCreatedBetweenTask::Run( |
| 201 DefaultChannelIDStore* store) { | 201 DefaultChannelIDStore* store) { |
| 202 // TODO(vadimt): Remove ScopedProfile below once crbug.com/425814 is fixed. | 202 // TODO(vadimt): Remove ScopedTracker below once crbug.com/425814 is fixed. |
| 203 tracked_objects::ScopedProfile tracking_profile( | 203 tracked_objects::ScopedTracker tracking_profile( |
| 204 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 204 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 205 "425814 DefaultChannelIDStore::DeleteAllCreatedBetweenTask::Run")); | 205 "425814 DefaultChannelIDStore::DeleteAllCreatedBetweenTask::Run")); |
| 206 | 206 |
| 207 store->SyncDeleteAllCreatedBetween(delete_begin_, delete_end_); | 207 store->SyncDeleteAllCreatedBetween(delete_begin_, delete_end_); |
| 208 | 208 |
| 209 InvokeCallback(callback_); | 209 InvokeCallback(callback_); |
| 210 } | 210 } |
| 211 | 211 |
| 212 // -------------------------------------------------------------------------- | 212 // -------------------------------------------------------------------------- |
| 213 // GetAllChannelIDsTask | 213 // GetAllChannelIDsTask |
| (...skipping 13 matching lines...) Expand all Loading... |
| 227 GetAllChannelIDsTask(const GetChannelIDListCallback& callback) | 227 GetAllChannelIDsTask(const GetChannelIDListCallback& callback) |
| 228 : callback_(callback) { | 228 : callback_(callback) { |
| 229 } | 229 } |
| 230 | 230 |
| 231 DefaultChannelIDStore::GetAllChannelIDsTask:: | 231 DefaultChannelIDStore::GetAllChannelIDsTask:: |
| 232 ~GetAllChannelIDsTask() { | 232 ~GetAllChannelIDsTask() { |
| 233 } | 233 } |
| 234 | 234 |
| 235 void DefaultChannelIDStore::GetAllChannelIDsTask::Run( | 235 void DefaultChannelIDStore::GetAllChannelIDsTask::Run( |
| 236 DefaultChannelIDStore* store) { | 236 DefaultChannelIDStore* store) { |
| 237 // TODO(vadimt): Remove ScopedProfile below once crbug.com/425814 is fixed. | 237 // TODO(vadimt): Remove ScopedTracker below once crbug.com/425814 is fixed. |
| 238 tracked_objects::ScopedProfile tracking_profile( | 238 tracked_objects::ScopedTracker tracking_profile( |
| 239 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 239 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 240 "425814 DefaultChannelIDStore::GetAllChannelIDsTask::Run")); | 240 "425814 DefaultChannelIDStore::GetAllChannelIDsTask::Run")); |
| 241 | 241 |
| 242 ChannelIDList cert_list; | 242 ChannelIDList cert_list; |
| 243 store->SyncGetAllChannelIDs(&cert_list); | 243 store->SyncGetAllChannelIDs(&cert_list); |
| 244 | 244 |
| 245 InvokeCallback(base::Bind(callback_, cert_list)); | 245 InvokeCallback(base::Bind(callback_, cert_list)); |
| 246 } | 246 } |
| 247 | 247 |
| 248 // -------------------------------------------------------------------------- | 248 // -------------------------------------------------------------------------- |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 if (store_.get()) | 488 if (store_.get()) |
| 489 store_->AddChannelID(*channel_id); | 489 store_->AddChannelID(*channel_id); |
| 490 channel_ids_[server_identifier] = channel_id; | 490 channel_ids_[server_identifier] = channel_id; |
| 491 } | 491 } |
| 492 | 492 |
| 493 DefaultChannelIDStore::PersistentStore::PersistentStore() {} | 493 DefaultChannelIDStore::PersistentStore::PersistentStore() {} |
| 494 | 494 |
| 495 DefaultChannelIDStore::PersistentStore::~PersistentStore() {} | 495 DefaultChannelIDStore::PersistentStore::~PersistentStore() {} |
| 496 | 496 |
| 497 } // namespace net | 497 } // namespace net |
| OLD | NEW |