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

Side by Side Diff: net/disk_cache/blockfile/in_flight_backend_io.cc

Issue 1304363013: Add a size estimation mechanism to StoragePartitionHttpCacheDataRemover. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: static_cast Created 5 years, 2 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
« no previous file with comments | « net/disk_cache/blockfile/in_flight_backend_io.h ('k') | net/disk_cache/disk_cache.h » ('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/disk_cache/blockfile/in_flight_backend_io.h" 5 #include "net/disk_cache/blockfile/in_flight_backend_io.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 operation_ = OP_DOOM_BETWEEN; 108 operation_ = OP_DOOM_BETWEEN;
109 initial_time_ = initial_time; 109 initial_time_ = initial_time;
110 end_time_ = end_time; 110 end_time_ = end_time;
111 } 111 }
112 112
113 void BackendIO::DoomEntriesSince(const base::Time initial_time) { 113 void BackendIO::DoomEntriesSince(const base::Time initial_time) {
114 operation_ = OP_DOOM_SINCE; 114 operation_ = OP_DOOM_SINCE;
115 initial_time_ = initial_time; 115 initial_time_ = initial_time;
116 } 116 }
117 117
118 void BackendIO::CalculateSizeOfAllEntries() {
119 operation_ = OP_SIZE_ALL;
120 }
121
118 void BackendIO::OpenNextEntry(Rankings::Iterator* iterator, 122 void BackendIO::OpenNextEntry(Rankings::Iterator* iterator,
119 Entry** next_entry) { 123 Entry** next_entry) {
120 operation_ = OP_OPEN_NEXT; 124 operation_ = OP_OPEN_NEXT;
121 iterator_ = iterator; 125 iterator_ = iterator;
122 entry_ptr_ = next_entry; 126 entry_ptr_ = next_entry;
123 } 127 }
124 128
125 void BackendIO::EndEnumeration(scoped_ptr<Rankings::Iterator> iterator) { 129 void BackendIO::EndEnumeration(scoped_ptr<Rankings::Iterator> iterator) {
126 operation_ = OP_END_ENUMERATION; 130 operation_ = OP_END_ENUMERATION;
127 scoped_iterator_ = iterator.Pass(); 131 scoped_iterator_ = iterator.Pass();
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 break; 241 break;
238 case OP_DOOM_ALL: 242 case OP_DOOM_ALL:
239 result_ = backend_->SyncDoomAllEntries(); 243 result_ = backend_->SyncDoomAllEntries();
240 break; 244 break;
241 case OP_DOOM_BETWEEN: 245 case OP_DOOM_BETWEEN:
242 result_ = backend_->SyncDoomEntriesBetween(initial_time_, end_time_); 246 result_ = backend_->SyncDoomEntriesBetween(initial_time_, end_time_);
243 break; 247 break;
244 case OP_DOOM_SINCE: 248 case OP_DOOM_SINCE:
245 result_ = backend_->SyncDoomEntriesSince(initial_time_); 249 result_ = backend_->SyncDoomEntriesSince(initial_time_);
246 break; 250 break;
251 case OP_SIZE_ALL:
252 result_ = backend_->SyncCalculateSizeOfAllEntries();
253 break;
247 case OP_OPEN_NEXT: 254 case OP_OPEN_NEXT:
248 result_ = backend_->SyncOpenNextEntry(iterator_, entry_ptr_); 255 result_ = backend_->SyncOpenNextEntry(iterator_, entry_ptr_);
249 break; 256 break;
250 case OP_END_ENUMERATION: 257 case OP_END_ENUMERATION:
251 backend_->SyncEndEnumeration(scoped_iterator_.Pass()); 258 backend_->SyncEndEnumeration(scoped_iterator_.Pass());
252 result_ = net::OK; 259 result_ = net::OK;
253 break; 260 break;
254 case OP_ON_EXTERNAL_CACHE_HIT: 261 case OP_ON_EXTERNAL_CACHE_HIT:
255 backend_->SyncOnExternalCacheHit(key_); 262 backend_->SyncOnExternalCacheHit(key_);
256 result_ = net::OK; 263 result_ = net::OK;
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 } 375 }
369 376
370 void InFlightBackendIO::DoomEntriesBetween(const base::Time initial_time, 377 void InFlightBackendIO::DoomEntriesBetween(const base::Time initial_time,
371 const base::Time end_time, 378 const base::Time end_time,
372 const net::CompletionCallback& callback) { 379 const net::CompletionCallback& callback) {
373 scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); 380 scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback));
374 operation->DoomEntriesBetween(initial_time, end_time); 381 operation->DoomEntriesBetween(initial_time, end_time);
375 PostOperation(operation.get()); 382 PostOperation(operation.get());
376 } 383 }
377 384
385 void InFlightBackendIO::CalculateSizeOfAllEntries(
386 const net::CompletionCallback& callback) {
387 scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback));
388 operation->CalculateSizeOfAllEntries();
389 PostOperation(operation.get());
390 }
391
378 void InFlightBackendIO::DoomEntriesSince( 392 void InFlightBackendIO::DoomEntriesSince(
379 const base::Time initial_time, const net::CompletionCallback& callback) { 393 const base::Time initial_time, const net::CompletionCallback& callback) {
380 scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); 394 scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback));
381 operation->DoomEntriesSince(initial_time); 395 operation->DoomEntriesSince(initial_time);
382 PostOperation(operation.get()); 396 PostOperation(operation.get());
383 } 397 }
384 398
385 void InFlightBackendIO::OpenNextEntry(Rankings::Iterator* iterator, 399 void InFlightBackendIO::OpenNextEntry(Rankings::Iterator* iterator,
386 Entry** next_entry, 400 Entry** next_entry,
387 const net::CompletionCallback& callback) { 401 const net::CompletionCallback& callback) {
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 background_thread_->PostTask( 518 background_thread_->PostTask(
505 FROM_HERE, base::Bind(&BackendIO::ExecuteOperation, operation)); 519 FROM_HERE, base::Bind(&BackendIO::ExecuteOperation, operation));
506 OnOperationPosted(operation); 520 OnOperationPosted(operation);
507 } 521 }
508 522
509 base::WeakPtr<InFlightBackendIO> InFlightBackendIO::GetWeakPtr() { 523 base::WeakPtr<InFlightBackendIO> InFlightBackendIO::GetWeakPtr() {
510 return ptr_factory_.GetWeakPtr(); 524 return ptr_factory_.GetWeakPtr();
511 } 525 }
512 526
513 } // namespace 527 } // namespace
OLDNEW
« no previous file with comments | « net/disk_cache/blockfile/in_flight_backend_io.h ('k') | net/disk_cache/disk_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698