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

Side by Side Diff: content/child/fileapi/webfilewriter_impl.cc

Issue 2873333004: Rename TaskRunner::RunsTasksOnCurrentThread() in //content (Closed)
Patch Set: 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/child/fileapi/webfilewriter_impl.h" 5 #include "content/child/fileapi/webfilewriter_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/synchronization/waitable_event.h" 8 #include "base/synchronization/waitable_event.h"
9 #include "base/threading/thread_task_runner_handle.h" 9 #include "base/threading/thread_task_runner_handle.h"
10 #include "content/child/child_thread_impl.h" 10 #include "content/child/child_thread_impl.h"
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 base::Bind(&WebFileWriterImpl::DidWrite, AsWeakPtr()), 155 base::Bind(&WebFileWriterImpl::DidWrite, AsWeakPtr()),
156 base::Bind(&WebFileWriterImpl::DidFinish, AsWeakPtr()))); 156 base::Bind(&WebFileWriterImpl::DidFinish, AsWeakPtr())));
157 } 157 }
158 158
159 void WebFileWriterImpl::DoCancel() { 159 void WebFileWriterImpl::DoCancel() {
160 RunOnMainThread(base::Bind(&WriterBridge::Cancel, bridge_, 160 RunOnMainThread(base::Bind(&WriterBridge::Cancel, bridge_,
161 base::Bind(&WebFileWriterImpl::DidFinish, AsWeakPtr()))); 161 base::Bind(&WebFileWriterImpl::DidFinish, AsWeakPtr())));
162 } 162 }
163 163
164 void WebFileWriterImpl::RunOnMainThread(const base::Closure& closure) { 164 void WebFileWriterImpl::RunOnMainThread(const base::Closure& closure) {
165 if (main_thread_task_runner_->RunsTasksOnCurrentThread()) { 165 if (main_thread_task_runner_->RunsTasksInCurrentSequence()) {
166 DCHECK(!bridge_->waitable_event()); 166 DCHECK(!bridge_->waitable_event());
167 closure.Run(); 167 closure.Run();
168 return; 168 return;
169 } 169 }
170 main_thread_task_runner_->PostTask(FROM_HERE, closure); 170 main_thread_task_runner_->PostTask(FROM_HERE, closure);
171 if (bridge_->waitable_event()) 171 if (bridge_->waitable_event())
172 bridge_->WaitAndRun(); 172 bridge_->WaitAndRun();
173 } 173 }
174 174
175 } // namespace content 175 } // namespace content
OLDNEW
« no previous file with comments | « content/child/fileapi/webfilesystem_impl.cc ('k') | content/child/service_worker/service_worker_provider_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698