| 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 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 GURL(filesystem_url), | 436 GURL(filesystem_url), |
| 437 base::Bind(&ResolveURLCallbackAdapter, | 437 base::Bind(&ResolveURLCallbackAdapter, |
| 438 base::ThreadTaskRunnerHandle::Get(), callbacks_id, | 438 base::ThreadTaskRunnerHandle::Get(), callbacks_id, |
| 439 base::RetainedRef(waitable_results)), | 439 base::RetainedRef(waitable_results)), |
| 440 base::Bind(&StatusCallbackAdapter, | 440 base::Bind(&StatusCallbackAdapter, |
| 441 base::ThreadTaskRunnerHandle::Get(), callbacks_id, | 441 base::ThreadTaskRunnerHandle::Get(), callbacks_id, |
| 442 base::RetainedRef(waitable_results))), | 442 base::RetainedRef(waitable_results))), |
| 443 waitable_results.get()); | 443 waitable_results.get()); |
| 444 } | 444 } |
| 445 | 445 |
| 446 void WebFileSystemImpl::deleteFileSystem( | |
| 447 const blink::WebURL& storage_partition, | |
| 448 blink::WebFileSystemType type, | |
| 449 WebFileSystemCallbacks callbacks) { | |
| 450 int callbacks_id = RegisterCallbacks(callbacks); | |
| 451 scoped_refptr<WaitableCallbackResults> waitable_results = | |
| 452 MaybeCreateWaitableResults(callbacks, callbacks_id); | |
| 453 CallDispatcherOnMainThread( | |
| 454 main_thread_task_runner_, &FileSystemDispatcher::DeleteFileSystem, | |
| 455 std::make_tuple( | |
| 456 GURL(storage_partition), static_cast<storage::FileSystemType>(type), | |
| 457 base::Bind(&StatusCallbackAdapter, | |
| 458 base::ThreadTaskRunnerHandle::Get(), callbacks_id, | |
| 459 base::RetainedRef(waitable_results))), | |
| 460 waitable_results.get()); | |
| 461 } | |
| 462 | |
| 463 void WebFileSystemImpl::move( | 446 void WebFileSystemImpl::move( |
| 464 const blink::WebURL& src_path, | 447 const blink::WebURL& src_path, |
| 465 const blink::WebURL& dest_path, | 448 const blink::WebURL& dest_path, |
| 466 WebFileSystemCallbacks callbacks) { | 449 WebFileSystemCallbacks callbacks) { |
| 467 int callbacks_id = RegisterCallbacks(callbacks); | 450 int callbacks_id = RegisterCallbacks(callbacks); |
| 468 scoped_refptr<WaitableCallbackResults> waitable_results = | 451 scoped_refptr<WaitableCallbackResults> waitable_results = |
| 469 MaybeCreateWaitableResults(callbacks, callbacks_id); | 452 MaybeCreateWaitableResults(callbacks, callbacks_id); |
| 470 CallDispatcherOnMainThread( | 453 CallDispatcherOnMainThread( |
| 471 main_thread_task_runner_, &FileSystemDispatcher::Move, | 454 main_thread_task_runner_, &FileSystemDispatcher::Move, |
| 472 std::make_tuple( | 455 std::make_tuple( |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 709 WaitableCallbackResults* WebFileSystemImpl::MaybeCreateWaitableResults( | 692 WaitableCallbackResults* WebFileSystemImpl::MaybeCreateWaitableResults( |
| 710 const WebFileSystemCallbacks& callbacks, int callbacks_id) { | 693 const WebFileSystemCallbacks& callbacks, int callbacks_id) { |
| 711 if (!callbacks.shouldBlockUntilCompletion()) | 694 if (!callbacks.shouldBlockUntilCompletion()) |
| 712 return NULL; | 695 return NULL; |
| 713 WaitableCallbackResults* results = new WaitableCallbackResults(); | 696 WaitableCallbackResults* results = new WaitableCallbackResults(); |
| 714 waitable_results_[callbacks_id] = results; | 697 waitable_results_[callbacks_id] = results; |
| 715 return results; | 698 return results; |
| 716 } | 699 } |
| 717 | 700 |
| 718 } // namespace content | 701 } // namespace content |
| OLD | NEW |