Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Side by Side Diff: net/http/mock_http_cache.cc

Issue 10808047: Add HttpCache histograms focussed on blocking and transaction type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remediate to review Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/mock_http_cache.h" 5 #include "net/http/mock_http_cache.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "net/base/completion_callback.h" 9 #include "net/base/completion_callback.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 332
333 MockDiskCache::MockDiskCache() 333 MockDiskCache::MockDiskCache()
334 : open_count_(0), create_count_(0), fail_requests_(false), 334 : open_count_(0), create_count_(0), fail_requests_(false),
335 soft_failures_(false), double_create_check_(true) { 335 soft_failures_(false), double_create_check_(true) {
336 } 336 }
337 337
338 MockDiskCache::~MockDiskCache() { 338 MockDiskCache::~MockDiskCache() {
339 ReleaseAll(); 339 ReleaseAll();
340 } 340 }
341 341
342 net::CacheType MockDiskCache::GetCacheType() const {
343 return net::DISK_CACHE;
344 }
345
342 int32 MockDiskCache::GetEntryCount() const { 346 int32 MockDiskCache::GetEntryCount() const {
343 return static_cast<int32>(entries_.size()); 347 return static_cast<int32>(entries_.size());
344 } 348 }
345 349
346 int MockDiskCache::OpenEntry(const std::string& key, disk_cache::Entry** entry, 350 int MockDiskCache::OpenEntry(const std::string& key, disk_cache::Entry** entry,
347 const net::CompletionCallback& callback) { 351 const net::CompletionCallback& callback) {
348 DCHECK(!callback.is_null()); 352 DCHECK(!callback.is_null());
349 if (fail_requests_) 353 if (fail_requests_)
350 return net::ERR_CACHE_OPEN_FAILURE; 354 return net::ERR_CACHE_OPEN_FAILURE;
351 355
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 void MockBlockingBackendFactory::FinishCreation() { 609 void MockBlockingBackendFactory::FinishCreation() {
606 block_ = false; 610 block_ = false;
607 if (!callback_.is_null()) { 611 if (!callback_.is_null()) {
608 if (!fail_) 612 if (!fail_)
609 *backend_ = new MockDiskCache(); 613 *backend_ = new MockDiskCache();
610 net::CompletionCallback cb = callback_; 614 net::CompletionCallback cb = callback_;
611 callback_.Reset(); 615 callback_.Reset();
612 cb.Run(Result()); // This object can be deleted here. 616 cb.Run(Result()); // This object can be deleted here.
613 } 617 }
614 } 618 }
OLDNEW
« net/http/http_cache_transaction.cc ('K') | « net/http/mock_http_cache.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698