OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "webkit/fileapi/file_system_file_util_proxy.h" | 5 #include "webkit/fileapi/file_system_file_util_proxy.h" |
6 | 6 |
7 #include "base/message_loop_proxy.h" | 7 #include "base/message_loop_proxy.h" |
8 #include "webkit/fileapi/file_system_context.h" | 8 #include "webkit/fileapi/file_system_context.h" |
9 #include "webkit/fileapi/file_system_file_util.h" | 9 #include "webkit/fileapi/file_system_file_util.h" |
10 #include "webkit/fileapi/file_system_operation_context.h" | 10 #include "webkit/fileapi/file_system_operation_context.h" |
11 | 11 |
12 namespace { | 12 namespace { |
13 | 13 |
14 class MessageLoopRelay | 14 class MessageLoopRelay |
15 : public base::RefCountedThreadSafe<MessageLoopRelay> { | 15 : public base::RefCountedThreadSafe<MessageLoopRelay> { |
16 public: | 16 public: |
17 // FileSystemOperationContext is passed by value from the IO thread to the | 17 // FileSystemOperationContext is passed by value from the IO thread to the |
18 // File thread. | 18 // File thread. |
19 explicit MessageLoopRelay(const fileapi::FileSystemOperationContext& context) | 19 explicit MessageLoopRelay(const fileapi::FileSystemOperationContext& context) |
20 : origin_message_loop_proxy_( | 20 : origin_message_loop_proxy_( |
21 base::MessageLoopProxy::CreateForCurrentThread()), | 21 base::MessageLoopProxy::current()), |
22 error_code_(base::PLATFORM_FILE_OK), | 22 error_code_(base::PLATFORM_FILE_OK), |
23 context_(context), | 23 context_(context), |
24 file_system_file_util_(NULL) { | 24 file_system_file_util_(NULL) { |
25 } | 25 } |
26 | 26 |
27 bool Start(scoped_refptr<base::MessageLoopProxy> message_loop_proxy, | 27 bool Start(scoped_refptr<base::MessageLoopProxy> message_loop_proxy, |
28 const tracked_objects::Location& from_here) { | 28 const tracked_objects::Location& from_here) { |
29 return message_loop_proxy->PostTask( | 29 return message_loop_proxy->PostTask( |
30 from_here, | 30 from_here, |
31 NewRunnableMethod(this, &MessageLoopRelay::ProcessOnTargetThread)); | 31 NewRunnableMethod(this, &MessageLoopRelay::ProcessOnTargetThread)); |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 const FileSystemOperationContext& context, | 565 const FileSystemOperationContext& context, |
566 scoped_refptr<MessageLoopProxy> message_loop_proxy, | 566 scoped_refptr<MessageLoopProxy> message_loop_proxy, |
567 const FilePath& path, | 567 const FilePath& path, |
568 int64 length, | 568 int64 length, |
569 StatusCallback* callback) { | 569 StatusCallback* callback) { |
570 return Start(FROM_HERE, message_loop_proxy, | 570 return Start(FROM_HERE, message_loop_proxy, |
571 new RelayTruncate(context, path, length, callback)); | 571 new RelayTruncate(context, path, length, callback)); |
572 } | 572 } |
573 | 573 |
574 } // namespace fileapi | 574 } // namespace fileapi |
OLD | NEW |