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

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

Issue 4192012: Convert implicit scoped_refptr constructor calls to explicit ones, part 1 (Closed) Base URL: http://git.chromium.org/git/chromium.git
Patch Set: fix presubmit Created 10 years, 1 month 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/disk_cache/file_posix.cc ('k') | net/disk_cache/mem_entry_impl.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "net/base/net_errors.h" 9 #include "net/base/net_errors.h"
10 #include "net/disk_cache/backend_impl.h" 10 #include "net/disk_cache/backend_impl.h"
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 base::MessageLoopProxy* background_thread) 284 base::MessageLoopProxy* background_thread)
285 : backend_(backend), 285 : backend_(backend),
286 background_thread_(background_thread), 286 background_thread_(background_thread),
287 queue_entry_ops_(false) { 287 queue_entry_ops_(false) {
288 } 288 }
289 289
290 InFlightBackendIO::~InFlightBackendIO() { 290 InFlightBackendIO::~InFlightBackendIO() {
291 } 291 }
292 292
293 void InFlightBackendIO::Init(CompletionCallback* callback) { 293 void InFlightBackendIO::Init(CompletionCallback* callback) {
294 scoped_refptr<BackendIO> operation = new BackendIO(this, backend_, callback); 294 scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback));
295 operation->Init(); 295 operation->Init();
296 QueueOperation(operation); 296 QueueOperation(operation);
297 } 297 }
298 298
299 void InFlightBackendIO::OpenEntry(const std::string& key, Entry** entry, 299 void InFlightBackendIO::OpenEntry(const std::string& key, Entry** entry,
300 CompletionCallback* callback) { 300 CompletionCallback* callback) {
301 scoped_refptr<BackendIO> operation = new BackendIO(this, backend_, callback); 301 scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback));
302 operation->OpenEntry(key, entry); 302 operation->OpenEntry(key, entry);
303 QueueOperation(operation); 303 QueueOperation(operation);
304 } 304 }
305 305
306 void InFlightBackendIO::CreateEntry(const std::string& key, Entry** entry, 306 void InFlightBackendIO::CreateEntry(const std::string& key, Entry** entry,
307 CompletionCallback* callback) { 307 CompletionCallback* callback) {
308 scoped_refptr<BackendIO> operation = new BackendIO(this, backend_, callback); 308 scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback));
309 operation->CreateEntry(key, entry); 309 operation->CreateEntry(key, entry);
310 QueueOperation(operation); 310 QueueOperation(operation);
311 } 311 }
312 312
313 void InFlightBackendIO::DoomEntry(const std::string& key, 313 void InFlightBackendIO::DoomEntry(const std::string& key,
314 CompletionCallback* callback) { 314 CompletionCallback* callback) {
315 scoped_refptr<BackendIO> operation = new BackendIO(this, backend_, callback); 315 scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback));
316 operation->DoomEntry(key); 316 operation->DoomEntry(key);
317 QueueOperation(operation); 317 QueueOperation(operation);
318 } 318 }
319 319
320 void InFlightBackendIO::DoomAllEntries(CompletionCallback* callback) { 320 void InFlightBackendIO::DoomAllEntries(CompletionCallback* callback) {
321 scoped_refptr<BackendIO> operation = new BackendIO(this, backend_, callback); 321 scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback));
322 operation->DoomAllEntries(); 322 operation->DoomAllEntries();
323 QueueOperation(operation); 323 QueueOperation(operation);
324 } 324 }
325 325
326 void InFlightBackendIO::DoomEntriesBetween(const base::Time initial_time, 326 void InFlightBackendIO::DoomEntriesBetween(const base::Time initial_time,
327 const base::Time end_time, 327 const base::Time end_time,
328 CompletionCallback* callback) { 328 CompletionCallback* callback) {
329 scoped_refptr<BackendIO> operation = new BackendIO(this, backend_, callback); 329 scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback));
330 operation->DoomEntriesBetween(initial_time, end_time); 330 operation->DoomEntriesBetween(initial_time, end_time);
331 QueueOperation(operation); 331 QueueOperation(operation);
332 } 332 }
333 333
334 void InFlightBackendIO::DoomEntriesSince(const base::Time initial_time, 334 void InFlightBackendIO::DoomEntriesSince(const base::Time initial_time,
335 CompletionCallback* callback) { 335 CompletionCallback* callback) {
336 scoped_refptr<BackendIO> operation = new BackendIO(this, backend_, callback); 336 scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback));
337 operation->DoomEntriesSince(initial_time); 337 operation->DoomEntriesSince(initial_time);
338 QueueOperation(operation); 338 QueueOperation(operation);
339 } 339 }
340 340
341 void InFlightBackendIO::OpenNextEntry(void** iter, Entry** next_entry, 341 void InFlightBackendIO::OpenNextEntry(void** iter, Entry** next_entry,
342 CompletionCallback* callback) { 342 CompletionCallback* callback) {
343 scoped_refptr<BackendIO> operation = new BackendIO(this, backend_, callback); 343 scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback));
344 operation->OpenNextEntry(iter, next_entry); 344 operation->OpenNextEntry(iter, next_entry);
345 QueueOperation(operation); 345 QueueOperation(operation);
346 } 346 }
347 347
348 void InFlightBackendIO::OpenPrevEntry(void** iter, Entry** prev_entry, 348 void InFlightBackendIO::OpenPrevEntry(void** iter, Entry** prev_entry,
349 CompletionCallback* callback) { 349 CompletionCallback* callback) {
350 scoped_refptr<BackendIO> operation = new BackendIO(this, backend_, callback); 350 scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback));
351 operation->OpenPrevEntry(iter, prev_entry); 351 operation->OpenPrevEntry(iter, prev_entry);
352 QueueOperation(operation); 352 QueueOperation(operation);
353 } 353 }
354 354
355 void InFlightBackendIO::EndEnumeration(void* iterator) { 355 void InFlightBackendIO::EndEnumeration(void* iterator) {
356 scoped_refptr<BackendIO> operation = new BackendIO(this, backend_, NULL); 356 scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, NULL));
357 operation->EndEnumeration(iterator); 357 operation->EndEnumeration(iterator);
358 QueueOperation(operation); 358 QueueOperation(operation);
359 } 359 }
360 360
361 void InFlightBackendIO::CloseEntryImpl(EntryImpl* entry) { 361 void InFlightBackendIO::CloseEntryImpl(EntryImpl* entry) {
362 scoped_refptr<BackendIO> operation = new BackendIO(this, backend_, NULL); 362 scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, NULL));
363 operation->CloseEntryImpl(entry); 363 operation->CloseEntryImpl(entry);
364 QueueOperation(operation); 364 QueueOperation(operation);
365 } 365 }
366 366
367 void InFlightBackendIO::DoomEntryImpl(EntryImpl* entry) { 367 void InFlightBackendIO::DoomEntryImpl(EntryImpl* entry) {
368 scoped_refptr<BackendIO> operation = new BackendIO(this, backend_, NULL); 368 scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, NULL));
369 operation->DoomEntryImpl(entry); 369 operation->DoomEntryImpl(entry);
370 QueueOperation(operation); 370 QueueOperation(operation);
371 } 371 }
372 372
373 void InFlightBackendIO::FlushQueue(net::CompletionCallback* callback) { 373 void InFlightBackendIO::FlushQueue(net::CompletionCallback* callback) {
374 scoped_refptr<BackendIO> operation = new BackendIO(this, backend_, callback); 374 scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback));
375 operation->FlushQueue(); 375 operation->FlushQueue();
376 QueueOperation(operation); 376 QueueOperation(operation);
377 } 377 }
378 378
379 void InFlightBackendIO::RunTask(Task* task, net::CompletionCallback* callback) { 379 void InFlightBackendIO::RunTask(Task* task, net::CompletionCallback* callback) {
380 scoped_refptr<BackendIO> operation = new BackendIO(this, backend_, callback); 380 scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback));
381 operation->RunTask(task); 381 operation->RunTask(task);
382 QueueOperation(operation); 382 QueueOperation(operation);
383 } 383 }
384 384
385 void InFlightBackendIO::ReadData(EntryImpl* entry, int index, int offset, 385 void InFlightBackendIO::ReadData(EntryImpl* entry, int index, int offset,
386 net::IOBuffer* buf, int buf_len, 386 net::IOBuffer* buf, int buf_len,
387 CompletionCallback* callback) { 387 CompletionCallback* callback) {
388 scoped_refptr<BackendIO> operation = new BackendIO(this, backend_, callback); 388 scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback));
389 operation->ReadData(entry, index, offset, buf, buf_len); 389 operation->ReadData(entry, index, offset, buf, buf_len);
390 QueueOperation(operation); 390 QueueOperation(operation);
391 } 391 }
392 392
393 void InFlightBackendIO::WriteData(EntryImpl* entry, int index, int offset, 393 void InFlightBackendIO::WriteData(EntryImpl* entry, int index, int offset,
394 net::IOBuffer* buf, int buf_len, 394 net::IOBuffer* buf, int buf_len,
395 bool truncate, 395 bool truncate,
396 CompletionCallback* callback) { 396 CompletionCallback* callback) {
397 scoped_refptr<BackendIO> operation = new BackendIO(this, backend_, callback); 397 scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback));
398 operation->WriteData(entry, index, offset, buf, buf_len, truncate); 398 operation->WriteData(entry, index, offset, buf, buf_len, truncate);
399 QueueOperation(operation); 399 QueueOperation(operation);
400 } 400 }
401 401
402 void InFlightBackendIO::ReadSparseData(EntryImpl* entry, int64 offset, 402 void InFlightBackendIO::ReadSparseData(EntryImpl* entry, int64 offset,
403 net::IOBuffer* buf, int buf_len, 403 net::IOBuffer* buf, int buf_len,
404 CompletionCallback* callback) { 404 CompletionCallback* callback) {
405 scoped_refptr<BackendIO> operation = new BackendIO(this, backend_, callback); 405 scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback));
406 operation->ReadSparseData(entry, offset, buf, buf_len); 406 operation->ReadSparseData(entry, offset, buf, buf_len);
407 QueueOperation(operation); 407 QueueOperation(operation);
408 } 408 }
409 409
410 void InFlightBackendIO::WriteSparseData(EntryImpl* entry, int64 offset, 410 void InFlightBackendIO::WriteSparseData(EntryImpl* entry, int64 offset,
411 net::IOBuffer* buf, int buf_len, 411 net::IOBuffer* buf, int buf_len,
412 CompletionCallback* callback) { 412 CompletionCallback* callback) {
413 scoped_refptr<BackendIO> operation = new BackendIO(this, backend_, callback); 413 scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback));
414 operation->WriteSparseData(entry, offset, buf, buf_len); 414 operation->WriteSparseData(entry, offset, buf, buf_len);
415 QueueOperation(operation); 415 QueueOperation(operation);
416 } 416 }
417 417
418 void InFlightBackendIO::GetAvailableRange(EntryImpl* entry, int64 offset, 418 void InFlightBackendIO::GetAvailableRange(EntryImpl* entry, int64 offset,
419 int len, int64* start, 419 int len, int64* start,
420 CompletionCallback* callback) { 420 CompletionCallback* callback) {
421 scoped_refptr<BackendIO> operation = new BackendIO(this, backend_, callback); 421 scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback));
422 operation->GetAvailableRange(entry, offset, len, start); 422 operation->GetAvailableRange(entry, offset, len, start);
423 QueueOperation(operation); 423 QueueOperation(operation);
424 } 424 }
425 425
426 void InFlightBackendIO::CancelSparseIO(EntryImpl* entry) { 426 void InFlightBackendIO::CancelSparseIO(EntryImpl* entry) {
427 scoped_refptr<BackendIO> operation = new BackendIO(this, backend_, NULL); 427 scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, NULL));
428 operation->CancelSparseIO(entry); 428 operation->CancelSparseIO(entry);
429 QueueOperation(operation); 429 QueueOperation(operation);
430 } 430 }
431 431
432 void InFlightBackendIO::ReadyForSparseIO(EntryImpl* entry, 432 void InFlightBackendIO::ReadyForSparseIO(EntryImpl* entry,
433 CompletionCallback* callback) { 433 CompletionCallback* callback) {
434 scoped_refptr<BackendIO> operation = new BackendIO(this, backend_, callback); 434 scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback));
435 operation->ReadyForSparseIO(entry); 435 operation->ReadyForSparseIO(entry);
436 QueueOperation(operation); 436 QueueOperation(operation);
437 } 437 }
438 438
439 void InFlightBackendIO::WaitForPendingIO() { 439 void InFlightBackendIO::WaitForPendingIO() {
440 // We clear the list first so that we don't post more operations after this 440 // We clear the list first so that we don't post more operations after this
441 // point. 441 // point.
442 pending_ops_.clear(); 442 pending_ops_.clear();
443 InFlightIO::WaitForPendingIO(); 443 InFlightIO::WaitForPendingIO();
444 } 444 }
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 510
511 void InFlightBackendIO::QueueOperationToList(BackendIO* operation, 511 void InFlightBackendIO::QueueOperationToList(BackendIO* operation,
512 OperationList* list) { 512 OperationList* list) {
513 if (list->empty()) 513 if (list->empty())
514 return PostOperation(operation); 514 return PostOperation(operation);
515 515
516 list->push_back(operation); 516 list->push_back(operation);
517 } 517 }
518 518
519 } // namespace 519 } // namespace
OLDNEW
« no previous file with comments | « net/disk_cache/file_posix.cc ('k') | net/disk_cache/mem_entry_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698