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

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

Issue 7583053: Add MessageLoopProxy::current (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: No need for MessageLoopProxy destruction observer. Created 9 years, 4 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) 2006-2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-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_io.h" 5 #include "net/disk_cache/in_flight_io.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace disk_cache { 9 namespace disk_cache {
10 10
(...skipping 15 matching lines...) Expand all
26 BackgroundIO::~BackgroundIO() {} 26 BackgroundIO::~BackgroundIO() {}
27 27
28 // Runs on the background thread. 28 // Runs on the background thread.
29 void BackgroundIO::NotifyController() { 29 void BackgroundIO::NotifyController() {
30 controller_->OnIOComplete(this); 30 controller_->OnIOComplete(this);
31 } 31 }
32 32
33 // --------------------------------------------------------------------------- 33 // ---------------------------------------------------------------------------
34 34
35 InFlightIO::InFlightIO() 35 InFlightIO::InFlightIO()
36 : callback_thread_(base::MessageLoopProxy::CreateForCurrentThread()), 36 : callback_thread_(base::MessageLoopProxy::current()),
37 running_(false), single_thread_(false) { 37 running_(false), single_thread_(false) {
38 } 38 }
39 39
40 InFlightIO::~InFlightIO() { 40 InFlightIO::~InFlightIO() {
41 } 41 }
42 42
43 void InFlightIO::WaitForPendingIO() { 43 void InFlightIO::WaitForPendingIO() {
44 while (!io_list_.empty()) { 44 while (!io_list_.empty()) {
45 // Block the current thread until all pending IO completes. 45 // Block the current thread until all pending IO completes.
46 IOList::iterator it = io_list_.begin(); 46 IOList::iterator it = io_list_.begin();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 OnOperationComplete(operation, cancel_task); 78 OnOperationComplete(operation, cancel_task);
79 } 79 }
80 80
81 // Runs on the primary thread. 81 // Runs on the primary thread.
82 void InFlightIO::OnOperationPosted(BackgroundIO* operation) { 82 void InFlightIO::OnOperationPosted(BackgroundIO* operation) {
83 DCHECK(callback_thread_->BelongsToCurrentThread()); 83 DCHECK(callback_thread_->BelongsToCurrentThread());
84 io_list_.insert(make_scoped_refptr(operation)); 84 io_list_.insert(make_scoped_refptr(operation));
85 } 85 }
86 86
87 } // namespace disk_cache 87 } // namespace disk_cache
OLDNEW
« no previous file with comments | « net/disk_cache/disk_cache_test_util.cc ('k') | net/proxy/dhcp_proxy_script_adapter_fetcher_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698