| 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/extras/sqlite/sqlite_channel_id_store.h" | 5 #include "net/extras/sqlite/sqlite_channel_id_store.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <utility> |
| 8 #include <vector> | 9 #include <vector> |
| 9 | 10 |
| 10 #include "base/bind.h" | 11 #include "base/bind.h" |
| 11 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 12 #include "base/files/file_util.h" | 13 #include "base/files/file_util.h" |
| 13 #include "base/location.h" | 14 #include "base/location.h" |
| 14 #include "base/logging.h" | 15 #include "base/logging.h" |
| 15 #include "base/macros.h" | 16 #include "base/macros.h" |
| 16 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/metrics/histogram_macros.h" | 18 #include "base/metrics/histogram_macros.h" |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 smt.ColumnBlobAsVector(2, &public_key_from_db); | 224 smt.ColumnBlobAsVector(2, &public_key_from_db); |
| 224 scoped_ptr<crypto::ECPrivateKey> key( | 225 scoped_ptr<crypto::ECPrivateKey> key( |
| 225 crypto::ECPrivateKey::CreateFromEncryptedPrivateKeyInfo( | 226 crypto::ECPrivateKey::CreateFromEncryptedPrivateKeyInfo( |
| 226 ChannelIDService::kEPKIPassword, private_key_from_db, | 227 ChannelIDService::kEPKIPassword, private_key_from_db, |
| 227 public_key_from_db)); | 228 public_key_from_db)); |
| 228 if (!key) | 229 if (!key) |
| 229 continue; | 230 continue; |
| 230 scoped_ptr<DefaultChannelIDStore::ChannelID> channel_id( | 231 scoped_ptr<DefaultChannelIDStore::ChannelID> channel_id( |
| 231 new DefaultChannelIDStore::ChannelID( | 232 new DefaultChannelIDStore::ChannelID( |
| 232 smt.ColumnString(0), // host | 233 smt.ColumnString(0), // host |
| 233 base::Time::FromInternalValue(smt.ColumnInt64(3)), key.Pass())); | 234 base::Time::FromInternalValue(smt.ColumnInt64(3)), std::move(key))); |
| 234 channel_ids->push_back(std::move(channel_id)); | 235 channel_ids->push_back(std::move(channel_id)); |
| 235 } | 236 } |
| 236 | 237 |
| 237 UMA_HISTOGRAM_COUNTS_10000( | 238 UMA_HISTOGRAM_COUNTS_10000( |
| 238 "DomainBoundCerts.DBLoadedCount", | 239 "DomainBoundCerts.DBLoadedCount", |
| 239 static_cast<base::HistogramBase::Sample>(channel_ids->size())); | 240 static_cast<base::HistogramBase::Sample>(channel_ids->size())); |
| 240 base::TimeDelta load_time = base::TimeTicks::Now() - start; | 241 base::TimeDelta load_time = base::TimeTicks::Now() - start; |
| 241 UMA_HISTOGRAM_CUSTOM_TIMES("DomainBoundCerts.DBLoadTime", | 242 UMA_HISTOGRAM_CUSTOM_TIMES("DomainBoundCerts.DBLoadTime", |
| 242 load_time, | 243 load_time, |
| 243 base::TimeDelta::FromMilliseconds(1), | 244 base::TimeDelta::FromMilliseconds(1), |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 backend_->SetForceKeepSessionState(); | 610 backend_->SetForceKeepSessionState(); |
| 610 } | 611 } |
| 611 | 612 |
| 612 SQLiteChannelIDStore::~SQLiteChannelIDStore() { | 613 SQLiteChannelIDStore::~SQLiteChannelIDStore() { |
| 613 backend_->Close(); | 614 backend_->Close(); |
| 614 // We release our reference to the Backend, though it will probably still have | 615 // We release our reference to the Backend, though it will probably still have |
| 615 // a reference if the background task runner has not run Close() yet. | 616 // a reference if the background task runner has not run Close() yet. |
| 616 } | 617 } |
| 617 | 618 |
| 618 } // namespace net | 619 } // namespace net |
| OLD | NEW |