| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 // so these callback adapters relay back the results to the calling thread | 144 // so these callback adapters relay back the results to the calling thread |
| 145 // if necessary. | 145 // if necessary. |
| 146 | 146 |
| 147 void OpenFileSystemCallbackAdapter( | 147 void OpenFileSystemCallbackAdapter( |
| 148 int thread_id, int callbacks_id, | 148 int thread_id, int callbacks_id, |
| 149 WaitableCallbackResults* waitable_results, | 149 WaitableCallbackResults* waitable_results, |
| 150 const std::string& name, const GURL& root) { | 150 const std::string& name, const GURL& root) { |
| 151 CallbackFileSystemCallbacks( | 151 CallbackFileSystemCallbacks( |
| 152 thread_id, callbacks_id, waitable_results, | 152 thread_id, callbacks_id, waitable_results, |
| 153 &WebFileSystemCallbacks::didOpenFileSystem, | 153 &WebFileSystemCallbacks::didOpenFileSystem, |
| 154 MakeTuple(UTF8ToUTF16(name), root)); | 154 MakeTuple(base::UTF8ToUTF16(name), root)); |
| 155 } | 155 } |
| 156 | 156 |
| 157 void ResolveURLCallbackAdapter( | 157 void ResolveURLCallbackAdapter( |
| 158 int thread_id, int callbacks_id, | 158 int thread_id, int callbacks_id, |
| 159 WaitableCallbackResults* waitable_results, | 159 WaitableCallbackResults* waitable_results, |
| 160 const fileapi::FileSystemInfo& info, | 160 const fileapi::FileSystemInfo& info, |
| 161 const base::FilePath& file_path, bool is_directory) { | 161 const base::FilePath& file_path, bool is_directory) { |
| 162 base::FilePath normalized_path( | 162 base::FilePath normalized_path( |
| 163 fileapi::VirtualPath::GetNormalizedFilePath(file_path)); | 163 fileapi::VirtualPath::GetNormalizedFilePath(file_path)); |
| 164 CallbackFileSystemCallbacks( | 164 CallbackFileSystemCallbacks( |
| 165 thread_id, callbacks_id, waitable_results, | 165 thread_id, callbacks_id, waitable_results, |
| 166 &WebFileSystemCallbacks::didResolveURL, | 166 &WebFileSystemCallbacks::didResolveURL, |
| 167 MakeTuple(UTF8ToUTF16(info.name), info.root_url, | 167 MakeTuple(base::UTF8ToUTF16(info.name), info.root_url, |
| 168 static_cast<blink::WebFileSystemType>(info.mount_type), | 168 static_cast<blink::WebFileSystemType>(info.mount_type), |
| 169 normalized_path.AsUTF16Unsafe(), is_directory)); | 169 normalized_path.AsUTF16Unsafe(), is_directory)); |
| 170 } | 170 } |
| 171 | 171 |
| 172 void StatusCallbackAdapter(int thread_id, int callbacks_id, | 172 void StatusCallbackAdapter(int thread_id, int callbacks_id, |
| 173 WaitableCallbackResults* waitable_results, | 173 WaitableCallbackResults* waitable_results, |
| 174 base::PlatformFileError error) { | 174 base::PlatformFileError error) { |
| 175 if (error == base::PLATFORM_FILE_OK) { | 175 if (error == base::PLATFORM_FILE_OK) { |
| 176 CallbackFileSystemCallbacks( | 176 CallbackFileSystemCallbacks( |
| 177 thread_id, callbacks_id, waitable_results, | 177 thread_id, callbacks_id, waitable_results, |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 int callbacks_id) { | 605 int callbacks_id) { |
| 606 DCHECK(CalledOnValidThread()); | 606 DCHECK(CalledOnValidThread()); |
| 607 CallbacksMap::iterator found = callbacks_.find(callbacks_id); | 607 CallbacksMap::iterator found = callbacks_.find(callbacks_id); |
| 608 DCHECK(found != callbacks_.end()); | 608 DCHECK(found != callbacks_.end()); |
| 609 WebFileSystemCallbacks callbacks = found->second; | 609 WebFileSystemCallbacks callbacks = found->second; |
| 610 callbacks_.erase(found); | 610 callbacks_.erase(found); |
| 611 return callbacks; | 611 return callbacks; |
| 612 } | 612 } |
| 613 | 613 |
| 614 } // namespace content | 614 } // namespace content |
| OLD | NEW |