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" | |
14 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
15 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
16 #include "net/base/io_buffer.h" | 15 #include "net/base/io_buffer.h" |
17 #include "net/base/net_errors.h" | 16 #include "net/base/net_errors.h" |
18 #include "net/disk_cache/disk_cache.h" | 17 #include "net/disk_cache/disk_cache.h" |
19 | 18 |
20 namespace net { | 19 namespace net { |
21 | 20 |
22 namespace { | 21 namespace { |
23 | 22 |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 void DiskBasedCertCache::ReadWorker::AddCallback( | 390 void DiskBasedCertCache::ReadWorker::AddCallback( |
392 const GetCallback& user_callback) { | 391 const GetCallback& user_callback) { |
393 user_callbacks_.push_back(user_callback); | 392 user_callbacks_.push_back(user_callback); |
394 } | 393 } |
395 | 394 |
396 void DiskBasedCertCache::ReadWorker::Cancel() { | 395 void DiskBasedCertCache::ReadWorker::Cancel() { |
397 canceled_ = true; | 396 canceled_ = true; |
398 } | 397 } |
399 | 398 |
400 void DiskBasedCertCache::ReadWorker::OnIOComplete(int rv) { | 399 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 | |
406 if (canceled_) { | 400 if (canceled_) { |
407 Finish(ERR_FAILED); | 401 Finish(ERR_FAILED); |
408 return; | 402 return; |
409 } | 403 } |
410 | 404 |
411 rv = DoLoop(rv); | 405 rv = DoLoop(rv); |
412 | 406 |
413 if (rv == ERR_IO_PENDING) | 407 if (rv == ERR_IO_PENDING) |
414 return; | 408 return; |
415 | 409 |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 | 589 |
596 void DiskBasedCertCache::FinishedWriteOperation( | 590 void DiskBasedCertCache::FinishedWriteOperation( |
597 const std::string& key, | 591 const std::string& key, |
598 X509Certificate::OSCertHandle cert_handle) { | 592 X509Certificate::OSCertHandle cert_handle) { |
599 write_worker_map_.erase(key); | 593 write_worker_map_.erase(key); |
600 if (!key.empty()) | 594 if (!key.empty()) |
601 mru_cert_cache_.Put(key, X509Certificate::DupOSCertHandle(cert_handle)); | 595 mru_cert_cache_.Put(key, X509Certificate::DupOSCertHandle(cert_handle)); |
602 } | 596 } |
603 | 597 |
604 } // namespace net | 598 } // namespace net |
OLD | NEW |