| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/in_flight_backend_io.h" | 5 #include "net/disk_cache/in_flight_backend_io.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 PostOperation(operation); | 334 PostOperation(operation); |
| 335 } | 335 } |
| 336 | 336 |
| 337 void InFlightBackendIO::DoomEntry(const std::string& key, | 337 void InFlightBackendIO::DoomEntry(const std::string& key, |
| 338 OldCompletionCallback* callback) { | 338 OldCompletionCallback* callback) { |
| 339 scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); | 339 scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); |
| 340 operation->DoomEntry(key); | 340 operation->DoomEntry(key); |
| 341 PostOperation(operation); | 341 PostOperation(operation); |
| 342 } | 342 } |
| 343 | 343 |
| 344 void InFlightBackendIO::DoomAllEntries(OldCompletionCallback* callback) { | |
| 345 scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); | |
| 346 operation->DoomAllEntries(); | |
| 347 PostOperation(operation); | |
| 348 } | |
| 349 | |
| 350 void InFlightBackendIO::DoomAllEntries( | 344 void InFlightBackendIO::DoomAllEntries( |
| 351 const net::CompletionCallback& callback) { | 345 const net::CompletionCallback& callback) { |
| 352 scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); | 346 scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); |
| 353 operation->DoomAllEntries(); | 347 operation->DoomAllEntries(); |
| 354 PostOperation(operation); | 348 PostOperation(operation); |
| 355 } | 349 } |
| 356 | 350 |
| 357 void InFlightBackendIO::DoomEntriesBetween(const base::Time initial_time, | 351 void InFlightBackendIO::DoomEntriesBetween(const base::Time initial_time, |
| 358 const base::Time end_time, | 352 const base::Time end_time, |
| 359 OldCompletionCallback* callback) { | |
| 360 scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); | |
| 361 operation->DoomEntriesBetween(initial_time, end_time); | |
| 362 PostOperation(operation); | |
| 363 } | |
| 364 | |
| 365 void InFlightBackendIO::DoomEntriesBetween(const base::Time initial_time, | |
| 366 const base::Time end_time, | |
| 367 const net::CompletionCallback& callback) { | 353 const net::CompletionCallback& callback) { |
| 368 scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); | 354 scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); |
| 369 operation->DoomEntriesBetween(initial_time, end_time); | 355 operation->DoomEntriesBetween(initial_time, end_time); |
| 370 PostOperation(operation); | 356 PostOperation(operation); |
| 371 } | 357 } |
| 372 | 358 |
| 373 void InFlightBackendIO::DoomEntriesSince(const base::Time initial_time, | 359 void InFlightBackendIO::DoomEntriesSince(const base::Time initial_time, |
| 374 OldCompletionCallback* callback) { | 360 OldCompletionCallback* callback) { |
| 375 scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); | 361 scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); |
| 376 operation->DoomEntriesSince(initial_time); | 362 operation->DoomEntriesSince(initial_time); |
| 377 PostOperation(operation); | 363 PostOperation(operation); |
| 378 } | 364 } |
| 379 | 365 |
| 380 void InFlightBackendIO::OpenNextEntry(void** iter, Entry** next_entry, | 366 void InFlightBackendIO::OpenNextEntry(void** iter, Entry** next_entry, |
| 381 OldCompletionCallback* callback) { | |
| 382 scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); | |
| 383 operation->OpenNextEntry(iter, next_entry); | |
| 384 PostOperation(operation); | |
| 385 } | |
| 386 | |
| 387 void InFlightBackendIO::OpenNextEntry(void** iter, Entry** next_entry, | |
| 388 const net::CompletionCallback& callback) { | 367 const net::CompletionCallback& callback) { |
| 389 scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); | 368 scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); |
| 390 operation->OpenNextEntry(iter, next_entry); | 369 operation->OpenNextEntry(iter, next_entry); |
| 391 PostOperation(operation); | 370 PostOperation(operation); |
| 392 } | 371 } |
| 393 | 372 |
| 394 void InFlightBackendIO::OpenPrevEntry(void** iter, Entry** prev_entry, | 373 void InFlightBackendIO::OpenPrevEntry(void** iter, Entry** prev_entry, |
| 395 OldCompletionCallback* callback) { | 374 OldCompletionCallback* callback) { |
| 396 scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); | 375 scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); |
| 397 operation->OpenPrevEntry(iter, prev_entry); | 376 operation->OpenPrevEntry(iter, prev_entry); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 op->callback().Run(op->result()); | 485 op->callback().Run(op->result()); |
| 507 } | 486 } |
| 508 | 487 |
| 509 void InFlightBackendIO::PostOperation(BackendIO* operation) { | 488 void InFlightBackendIO::PostOperation(BackendIO* operation) { |
| 510 background_thread_->PostTask(FROM_HERE, | 489 background_thread_->PostTask(FROM_HERE, |
| 511 base::Bind(&BackendIO::ExecuteOperation, operation)); | 490 base::Bind(&BackendIO::ExecuteOperation, operation)); |
| 512 OnOperationPosted(operation); | 491 OnOperationPosted(operation); |
| 513 } | 492 } |
| 514 | 493 |
| 515 } // namespace | 494 } // namespace |
| OLD | NEW |