OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 14 matching lines...) Expand all Loading... |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "modules/filesystem/LocalFileSystem.h" | 31 #include "modules/filesystem/LocalFileSystem.h" |
32 | 32 |
33 #include "core/dom/Document.h" | 33 #include "core/dom/Document.h" |
34 #include "core/dom/ExecutionContext.h" | 34 #include "core/dom/ExecutionContext.h" |
35 #include "core/dom/ExecutionContextTask.h" | |
36 #include "core/dom/TaskRunnerHelper.h" | 35 #include "core/dom/TaskRunnerHelper.h" |
37 #include "core/fileapi/FileError.h" | 36 #include "core/fileapi/FileError.h" |
38 #include "core/frame/LocalFrame.h" | 37 #include "core/frame/LocalFrame.h" |
39 #include "core/workers/WorkerGlobalScope.h" | 38 #include "core/workers/WorkerGlobalScope.h" |
40 #include "modules/filesystem/FileSystemClient.h" | 39 #include "modules/filesystem/FileSystemClient.h" |
41 #include "platform/AsyncFileSystemCallbacks.h" | 40 #include "platform/AsyncFileSystemCallbacks.h" |
42 #include "platform/ContentSettingCallbacks.h" | 41 #include "platform/ContentSettingCallbacks.h" |
43 #include "public/platform/Platform.h" | 42 #include "public/platform/Platform.h" |
44 #include "public/platform/WebFileSystem.h" | 43 #include "public/platform/WebFileSystem.h" |
45 #include "wtf/Functional.h" | 44 #include "wtf/Functional.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 (*allowed)(); | 128 (*allowed)(); |
130 return; | 129 return; |
131 } | 130 } |
132 client()->requestFileSystemAccessAsync( | 131 client()->requestFileSystemAccessAsync( |
133 context, | 132 context, |
134 ContentSettingCallbacks::create(std::move(allowed), std::move(denied))); | 133 ContentSettingCallbacks::create(std::move(allowed), std::move(denied))); |
135 } | 134 } |
136 | 135 |
137 void LocalFileSystem::fileSystemNotAvailable(ExecutionContext* context, | 136 void LocalFileSystem::fileSystemNotAvailable(ExecutionContext* context, |
138 CallbackWrapper* callbacks) { | 137 CallbackWrapper* callbacks) { |
139 context->postTask( | 138 TaskRunnerHelper::get(TaskType::FileReading, context) |
140 TaskType::FileReading, BLINK_FROM_HERE, | 139 ->postTask(BLINK_FROM_HERE, |
141 createSameThreadTask(&reportFailure, WTF::passed(callbacks->release()), | 140 WTF::bind(&reportFailure, WTF::passed(callbacks->release()), |
142 FileError::kAbortErr)); | 141 FileError::kAbortErr)); |
143 } | 142 } |
144 | 143 |
145 void LocalFileSystem::fileSystemNotAllowedInternal(ExecutionContext* context, | 144 void LocalFileSystem::fileSystemNotAllowedInternal(ExecutionContext* context, |
146 CallbackWrapper* callbacks) { | 145 CallbackWrapper* callbacks) { |
147 context->postTask( | 146 TaskRunnerHelper::get(TaskType::FileReading, context) |
148 TaskType::FileReading, BLINK_FROM_HERE, | 147 ->postTask(BLINK_FROM_HERE, |
149 createSameThreadTask(&reportFailure, WTF::passed(callbacks->release()), | 148 WTF::bind(&reportFailure, WTF::passed(callbacks->release()), |
150 FileError::kAbortErr)); | 149 FileError::kAbortErr)); |
151 } | 150 } |
152 | 151 |
153 void LocalFileSystem::fileSystemAllowedInternal(ExecutionContext* context, | 152 void LocalFileSystem::fileSystemAllowedInternal(ExecutionContext* context, |
154 FileSystemType type, | 153 FileSystemType type, |
155 CallbackWrapper* callbacks) { | 154 CallbackWrapper* callbacks) { |
156 WebFileSystem* fileSystem = getFileSystem(); | 155 WebFileSystem* fileSystem = getFileSystem(); |
157 if (!fileSystem) { | 156 if (!fileSystem) { |
158 fileSystemNotAvailable(context, callbacks); | 157 fileSystemNotAvailable(context, callbacks); |
159 return; | 158 return; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 } | 216 } |
218 | 217 |
219 void provideLocalFileSystemToWorker(WorkerClients* workerClients, | 218 void provideLocalFileSystemToWorker(WorkerClients* workerClients, |
220 std::unique_ptr<FileSystemClient> client) { | 219 std::unique_ptr<FileSystemClient> client) { |
221 Supplement<WorkerClients>::provideTo( | 220 Supplement<WorkerClients>::provideTo( |
222 *workerClients, LocalFileSystem::supplementName(), | 221 *workerClients, LocalFileSystem::supplementName(), |
223 new LocalFileSystem(*workerClients, std::move(client))); | 222 new LocalFileSystem(*workerClients, std::move(client))); |
224 } | 223 } |
225 | 224 |
226 } // namespace blink | 225 } // namespace blink |
OLD | NEW |