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

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

Issue 15829004: Update net/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: license twerk Created 7 years, 6 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
« no previous file with comments | « net/http/http_basic_stream.cc ('k') | net/http/http_cache_transaction.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/http_cache.h" 5 #include "net/http/http_cache.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 10
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 // static 69 // static
70 HttpCache::BackendFactory* HttpCache::DefaultBackend::InMemory(int max_bytes) { 70 HttpCache::BackendFactory* HttpCache::DefaultBackend::InMemory(int max_bytes) {
71 return new DefaultBackend(MEMORY_CACHE, net::CACHE_BACKEND_DEFAULT, 71 return new DefaultBackend(MEMORY_CACHE, net::CACHE_BACKEND_DEFAULT,
72 base::FilePath(), max_bytes, NULL); 72 base::FilePath(), max_bytes, NULL);
73 } 73 }
74 74
75 int HttpCache::DefaultBackend::CreateBackend( 75 int HttpCache::DefaultBackend::CreateBackend(
76 NetLog* net_log, disk_cache::Backend** backend, 76 NetLog* net_log, disk_cache::Backend** backend,
77 const CompletionCallback& callback) { 77 const CompletionCallback& callback) {
78 DCHECK_GE(max_bytes_, 0); 78 DCHECK_GE(max_bytes_, 0);
79 return disk_cache::CreateCacheBackend(type_, backend_type_, path_, max_bytes_, 79 return disk_cache::CreateCacheBackend(type_,
80 true, thread_, net_log, backend, 80 backend_type_,
81 path_,
82 max_bytes_,
83 true,
84 thread_.get(),
85 net_log,
86 backend,
81 callback); 87 callback);
82 } 88 }
83 89
84 //----------------------------------------------------------------------------- 90 //-----------------------------------------------------------------------------
85 91
86 HttpCache::ActiveEntry::ActiveEntry(disk_cache::Entry* entry) 92 HttpCache::ActiveEntry::ActiveEntry(disk_cache::Entry* entry)
87 : disk_entry(entry), 93 : disk_entry(entry),
88 writer(NULL), 94 writer(NULL),
89 will_process_pending_queue(false), 95 will_process_pending_queue(false),
90 doomed(false) { 96 doomed(false) {
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 verified_ = true; 241 verified_ = true;
236 if (result != OK) 242 if (result != OK)
237 return SelfDestroy(); 243 return SelfDestroy();
238 244
239 const HttpResponseInfo* response_info = transaction_->GetResponseInfo(); 245 const HttpResponseInfo* response_info = transaction_->GetResponseInfo();
240 DCHECK(response_info->was_cached); 246 DCHECK(response_info->was_cached);
241 if (response_info->response_time != expected_response_time_) 247 if (response_info->response_time != expected_response_time_)
242 return SelfDestroy(); 248 return SelfDestroy();
243 249
244 result = transaction_->WriteMetadata( 250 result = transaction_->WriteMetadata(
245 buf_, buf_len_, 251 buf_.get(),
252 buf_len_,
246 base::Bind(&MetadataWriter::OnIOComplete, base::Unretained(this))); 253 base::Bind(&MetadataWriter::OnIOComplete, base::Unretained(this)));
247 if (result != ERR_IO_PENDING) 254 if (result != ERR_IO_PENDING)
248 SelfDestroy(); 255 SelfDestroy();
249 } 256 }
250 257
251 void HttpCache::MetadataWriter::SelfDestroy() { 258 void HttpCache::MetadataWriter::SelfDestroy() {
252 delete this; 259 delete this;
253 } 260 }
254 261
255 void HttpCache::MetadataWriter::OnIOComplete(int result) { 262 void HttpCache::MetadataWriter::OnIOComplete(int result) {
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after
1132 building_backend_ = false; 1139 building_backend_ = false;
1133 DeletePendingOp(pending_op); 1140 DeletePendingOp(pending_op);
1134 } 1141 }
1135 1142
1136 // The cache may be gone when we return from the callback. 1143 // The cache may be gone when we return from the callback.
1137 if (!item->DoCallback(result, backend)) 1144 if (!item->DoCallback(result, backend))
1138 item->NotifyTransaction(result, NULL); 1145 item->NotifyTransaction(result, NULL);
1139 } 1146 }
1140 1147
1141 } // namespace net 1148 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_basic_stream.cc ('k') | net/http/http_cache_transaction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698