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

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

Issue 11649028: Add an IO thread index bitmap to disk cache. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: windows build fix Created 7 years, 11 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
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/in_flight_io.h" 5 #include "net/disk_cache/in_flight_io.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/logging.h" 9 #include "base/logging.h"
10 #include "base/threading/thread_restrictions.h" 10 #include "base/threading/thread_restrictions.h"
(...skipping 30 matching lines...) Expand all
41 InFlightIO::~InFlightIO() { 41 InFlightIO::~InFlightIO() {
42 } 42 }
43 43
44 // Runs on the background thread. 44 // Runs on the background thread.
45 void BackgroundIO::NotifyController() { 45 void BackgroundIO::NotifyController() {
46 base::AutoLock lock(controller_lock_); 46 base::AutoLock lock(controller_lock_);
47 if (controller_) 47 if (controller_)
48 controller_->OnIOComplete(this); 48 controller_->OnIOComplete(this);
49 } 49 }
50 50
51 scoped_refptr<base::MessageLoopProxy> BackgroundIO::GetCallbackThread() {
52 base::AutoLock lock(controller_lock_);
53 if (!controller_)
54 return NULL;
55 return controller_->callback_thread();
56 }
57
51 void InFlightIO::WaitForPendingIO() { 58 void InFlightIO::WaitForPendingIO() {
52 while (!io_list_.empty()) { 59 while (!io_list_.empty()) {
53 // Block the current thread until all pending IO completes. 60 // Block the current thread until all pending IO completes.
54 IOList::iterator it = io_list_.begin(); 61 IOList::iterator it = io_list_.begin();
55 InvokeCallback(*it, true); 62 InvokeCallback(*it, true);
56 } 63 }
57 } 64 }
58 65
59 void InFlightIO::DropPendingIO() { 66 void InFlightIO::DropPendingIO() {
60 while (!io_list_.empty()) { 67 while (!io_list_.empty()) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 OnOperationComplete(operation, cancel_task); 108 OnOperationComplete(operation, cancel_task);
102 } 109 }
103 110
104 // Runs on the primary thread. 111 // Runs on the primary thread.
105 void InFlightIO::OnOperationPosted(BackgroundIO* operation) { 112 void InFlightIO::OnOperationPosted(BackgroundIO* operation) {
106 DCHECK(callback_thread_->BelongsToCurrentThread()); 113 DCHECK(callback_thread_->BelongsToCurrentThread());
107 io_list_.insert(make_scoped_refptr(operation)); 114 io_list_.insert(make_scoped_refptr(operation));
108 } 115 }
109 116
110 } // namespace disk_cache 117 } // namespace disk_cache
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698