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

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

Issue 1230113012: [net] Better StopCaching() handling for HttpCache::Transaction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
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/location.h" 8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 scoped_ptr<disk_cache::Backend::Iterator> MockDiskCache::CreateIterator() { 488 scoped_ptr<disk_cache::Backend::Iterator> MockDiskCache::CreateIterator() {
489 return scoped_ptr<Iterator>(new NotImplementedIterator()); 489 return scoped_ptr<Iterator>(new NotImplementedIterator());
490 } 490 }
491 491
492 void MockDiskCache::GetStats(base::StringPairs* stats) { 492 void MockDiskCache::GetStats(base::StringPairs* stats) {
493 } 493 }
494 494
495 void MockDiskCache::OnExternalCacheHit(const std::string& key) { 495 void MockDiskCache::OnExternalCacheHit(const std::string& key) {
496 } 496 }
497 497
498 void MockDiskCache::ResetCounts() {
499 open_count_ = 0;
500 create_count_ = 0;
501 }
502
498 void MockDiskCache::ReleaseAll() { 503 void MockDiskCache::ReleaseAll() {
499 EntryMap::iterator it = entries_.begin(); 504 EntryMap::iterator it = entries_.begin();
500 for (; it != entries_.end(); ++it) 505 for (; it != entries_.end(); ++it)
501 it->second->Release(); 506 it->second->Release();
502 entries_.clear(); 507 entries_.clear();
503 } 508 }
504 509
505 void MockDiskCache::CallbackLater(const CompletionCallback& callback, 510 void MockDiskCache::CallbackLater(const CompletionCallback& callback,
506 int result) { 511 int result) {
507 base::ThreadTaskRunnerHandle::Get()->PostTask( 512 base::ThreadTaskRunnerHandle::Get()->PostTask(
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 if (!callback_.is_null()) { 666 if (!callback_.is_null()) {
662 if (!fail_) 667 if (!fail_)
663 backend_->reset(new MockDiskCache()); 668 backend_->reset(new MockDiskCache());
664 CompletionCallback cb = callback_; 669 CompletionCallback cb = callback_;
665 callback_.Reset(); 670 callback_.Reset();
666 cb.Run(Result()); // This object can be deleted here. 671 cb.Run(Result()); // This object can be deleted here.
667 } 672 }
668 } 673 }
669 674
670 } // namespace net 675 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698