| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/http/disk_based_cert_cache.h" | 5 #include "net/http/disk_based_cert_cache.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
| 13 #include "base/profiler/scoped_tracker.h" |
| 13 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
| 14 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
| 15 #include "net/base/io_buffer.h" | 16 #include "net/base/io_buffer.h" |
| 16 #include "net/base/net_errors.h" | 17 #include "net/base/net_errors.h" |
| 17 #include "net/disk_cache/disk_cache.h" | 18 #include "net/disk_cache/disk_cache.h" |
| 18 | 19 |
| 19 namespace net { | 20 namespace net { |
| 20 | 21 |
| 21 namespace { | 22 namespace { |
| 22 | 23 |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 void DiskBasedCertCache::ReadWorker::AddCallback( | 391 void DiskBasedCertCache::ReadWorker::AddCallback( |
| 391 const GetCallback& user_callback) { | 392 const GetCallback& user_callback) { |
| 392 user_callbacks_.push_back(user_callback); | 393 user_callbacks_.push_back(user_callback); |
| 393 } | 394 } |
| 394 | 395 |
| 395 void DiskBasedCertCache::ReadWorker::Cancel() { | 396 void DiskBasedCertCache::ReadWorker::Cancel() { |
| 396 canceled_ = true; | 397 canceled_ = true; |
| 397 } | 398 } |
| 398 | 399 |
| 399 void DiskBasedCertCache::ReadWorker::OnIOComplete(int rv) { | 400 void DiskBasedCertCache::ReadWorker::OnIOComplete(int rv) { |
| 401 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422516 is fixed. |
| 402 tracked_objects::ScopedTracker tracking_profile( |
| 403 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 404 "422516 DiskBasedCertCache::ReadWorker::OnIOComplete")); |
| 405 |
| 400 if (canceled_) { | 406 if (canceled_) { |
| 401 Finish(ERR_FAILED); | 407 Finish(ERR_FAILED); |
| 402 return; | 408 return; |
| 403 } | 409 } |
| 404 | 410 |
| 405 rv = DoLoop(rv); | 411 rv = DoLoop(rv); |
| 406 | 412 |
| 407 if (rv == ERR_IO_PENDING) | 413 if (rv == ERR_IO_PENDING) |
| 408 return; | 414 return; |
| 409 | 415 |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 | 595 |
| 590 void DiskBasedCertCache::FinishedWriteOperation( | 596 void DiskBasedCertCache::FinishedWriteOperation( |
| 591 const std::string& key, | 597 const std::string& key, |
| 592 X509Certificate::OSCertHandle cert_handle) { | 598 X509Certificate::OSCertHandle cert_handle) { |
| 593 write_worker_map_.erase(key); | 599 write_worker_map_.erase(key); |
| 594 if (!key.empty()) | 600 if (!key.empty()) |
| 595 mru_cert_cache_.Put(key, X509Certificate::DupOSCertHandle(cert_handle)); | 601 mru_cert_cache_.Put(key, X509Certificate::DupOSCertHandle(cert_handle)); |
| 596 } | 602 } |
| 597 | 603 |
| 598 } // namespace net | 604 } // namespace net |
| OLD | NEW |