OLD | NEW |
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/webfilesystem_impl.h" | 5 #include "content/child/fileapi/webfilesystem_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <tuple> | 8 #include <tuple> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 if (ChildThreadImpl::current()) | 90 if (ChildThreadImpl::current()) |
91 ChildThreadImpl::current()->Send( | 91 ChildThreadImpl::current()->Send( |
92 new FileSystemHostMsg_DidReceiveSnapshotFile(request_id)); | 92 new FileSystemHostMsg_DidReceiveSnapshotFile(request_id)); |
93 } | 93 } |
94 | 94 |
95 template <typename Method, typename Params> | 95 template <typename Method, typename Params> |
96 void CallDispatcherOnMainThread( | 96 void CallDispatcherOnMainThread( |
97 const scoped_refptr<base::SingleThreadTaskRunner>& main_thread_task_runner, | 97 const scoped_refptr<base::SingleThreadTaskRunner>& main_thread_task_runner, |
98 Method method, const Params& params, | 98 Method method, const Params& params, |
99 WaitableCallbackResults* waitable_results) { | 99 WaitableCallbackResults* waitable_results) { |
100 if (!main_thread_task_runner->RunsTasksOnCurrentThread()) { | 100 if (!main_thread_task_runner->RunsTasksInCurrentSequence()) { |
101 main_thread_task_runner->PostTask( | 101 main_thread_task_runner->PostTask( |
102 FROM_HERE, | 102 FROM_HERE, |
103 base::Bind(&CallDispatcherOnMainThread<Method, Params>, | 103 base::Bind(&CallDispatcherOnMainThread<Method, Params>, |
104 main_thread_task_runner, method, params, nullptr)); | 104 main_thread_task_runner, method, params, nullptr)); |
105 if (!waitable_results) | 105 if (!waitable_results) |
106 return; | 106 return; |
107 waitable_results->WaitAndRun(); | 107 waitable_results->WaitAndRun(); |
108 } | 108 } |
109 if (!ChildThreadImpl::current() || | 109 if (!ChildThreadImpl::current() || |
110 !ChildThreadImpl::current()->file_system_dispatcher()) | 110 !ChildThreadImpl::current()->file_system_dispatcher()) |
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 WaitableCallbackResults* WebFileSystemImpl::MaybeCreateWaitableResults( | 679 WaitableCallbackResults* WebFileSystemImpl::MaybeCreateWaitableResults( |
680 const WebFileSystemCallbacks& callbacks, int callbacks_id) { | 680 const WebFileSystemCallbacks& callbacks, int callbacks_id) { |
681 if (!callbacks.ShouldBlockUntilCompletion()) | 681 if (!callbacks.ShouldBlockUntilCompletion()) |
682 return NULL; | 682 return NULL; |
683 WaitableCallbackResults* results = new WaitableCallbackResults(); | 683 WaitableCallbackResults* results = new WaitableCallbackResults(); |
684 waitable_results_[callbacks_id] = results; | 684 waitable_results_[callbacks_id] = results; |
685 return results; | 685 return results; |
686 } | 686 } |
687 | 687 |
688 } // namespace content | 688 } // namespace content |
OLD | NEW |