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

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

Issue 2894863002: Rename TaskRunner::RunsTasksOnCurrentThread() in //net (Closed)
Patch Set: fixed build error Created 3 years, 7 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
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_io.h" 5 #include "net/disk_cache/blockfile/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/profiler/scoped_tracker.h" 9 #include "base/profiler/scoped_tracker.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 void InFlightIO::DropPendingIO() { 66 void InFlightIO::DropPendingIO() {
67 while (!io_list_.empty()) { 67 while (!io_list_.empty()) {
68 IOList::iterator it = io_list_.begin(); 68 IOList::iterator it = io_list_.begin();
69 BackgroundIO* operation = it->get(); 69 BackgroundIO* operation = it->get();
70 operation->Cancel(); 70 operation->Cancel();
71 DCHECK(io_list_.find(operation) != io_list_.end()); 71 DCHECK(io_list_.find(operation) != io_list_.end());
72 io_list_.erase(make_scoped_refptr(operation)); 72 io_list_.erase(make_scoped_refptr(operation));
73 } 73 }
74 } 74 }
75 75
76 // Runs on a background thread. 76 // Runs in a background sequence.
77 void InFlightIO::OnIOComplete(BackgroundIO* operation) { 77 void InFlightIO::OnIOComplete(BackgroundIO* operation) {
78 #if DCHECK_IS_ON() 78 #if DCHECK_IS_ON()
79 if (callback_task_runner_->RunsTasksOnCurrentThread()) { 79 if (callback_task_runner_->RunsTasksInCurrentSequence()) {
80 DCHECK(single_thread_ || !running_); 80 DCHECK(single_thread_ || !running_);
81 single_thread_ = true; 81 single_thread_ = true;
82 } 82 }
83 #endif 83 #endif
84 84
85 callback_task_runner_->PostTask( 85 callback_task_runner_->PostTask(
86 FROM_HERE, base::Bind(&BackgroundIO::OnIOSignalled, operation)); 86 FROM_HERE, base::Bind(&BackgroundIO::OnIOSignalled, operation));
87 operation->io_completed()->Signal(); 87 operation->io_completed()->Signal();
88 } 88 }
89 89
(...skipping 12 matching lines...) Expand all
102 // Make sure that we remove the operation from the list before invoking the 102 // Make sure that we remove the operation from the list before invoking the
103 // callback (so that a subsequent cancel does not invoke the callback again). 103 // callback (so that a subsequent cancel does not invoke the callback again).
104 DCHECK(io_list_.find(operation) != io_list_.end()); 104 DCHECK(io_list_.find(operation) != io_list_.end());
105 DCHECK(!operation->HasOneRef()); 105 DCHECK(!operation->HasOneRef());
106 io_list_.erase(make_scoped_refptr(operation)); 106 io_list_.erase(make_scoped_refptr(operation));
107 OnOperationComplete(operation, cancel_task); 107 OnOperationComplete(operation, cancel_task);
108 } 108 }
109 109
110 // Runs on the primary thread. 110 // Runs on the primary thread.
111 void InFlightIO::OnOperationPosted(BackgroundIO* operation) { 111 void InFlightIO::OnOperationPosted(BackgroundIO* operation) {
112 DCHECK(callback_task_runner_->RunsTasksOnCurrentThread()); 112 DCHECK(callback_task_runner_->RunsTasksInCurrentSequence());
113 io_list_.insert(make_scoped_refptr(operation)); 113 io_list_.insert(make_scoped_refptr(operation));
114 } 114 }
115 115
116 } // namespace disk_cache 116 } // namespace disk_cache
OLDNEW
« no previous file with comments | « net/disk_cache/blockfile/in_flight_backend_io.h ('k') | net/extras/sqlite/sqlite_channel_id_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698