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 "base/file_util_proxy.h" | 5 #include "base/file_util_proxy.h" |
6 | 6 |
7 #include "base/message_loop_proxy.h" | 7 #include "base/message_loop_proxy.h" |
8 | 8 |
9 // TODO(jianli): Move the code from anonymous namespace to base namespace so | 9 // TODO(jianli): Move the code from anonymous namespace to base namespace so |
10 // that all of the base:: prefixes would be unnecessary. | 10 // that all of the base:: prefixes would be unnecessary. |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 return base::PLATFORM_FILE_OK; | 66 return base::PLATFORM_FILE_OK; |
67 } | 67 } |
68 | 68 |
69 } // anonymous namespace | 69 } // anonymous namespace |
70 | 70 |
71 class MessageLoopRelay | 71 class MessageLoopRelay |
72 : public base::RefCountedThreadSafe<MessageLoopRelay> { | 72 : public base::RefCountedThreadSafe<MessageLoopRelay> { |
73 public: | 73 public: |
74 MessageLoopRelay() | 74 MessageLoopRelay() |
75 : origin_message_loop_proxy_( | 75 : origin_message_loop_proxy_( |
76 base::MessageLoopProxy::CreateForCurrentThread()), | 76 base::MessageLoopProxy::current()), |
77 error_code_(base::PLATFORM_FILE_OK) { | 77 error_code_(base::PLATFORM_FILE_OK) { |
78 } | 78 } |
79 | 79 |
80 bool Start(scoped_refptr<base::MessageLoopProxy> message_loop_proxy, | 80 bool Start(scoped_refptr<base::MessageLoopProxy> message_loop_proxy, |
81 const tracked_objects::Location& from_here) { | 81 const tracked_objects::Location& from_here) { |
82 return message_loop_proxy->PostTask( | 82 return message_loop_proxy->PostTask( |
83 from_here, | 83 from_here, |
84 NewRunnableMethod(this, &MessageLoopRelay::ProcessOnTargetThread)); | 84 NewRunnableMethod(this, &MessageLoopRelay::ProcessOnTargetThread)); |
85 } | 85 } |
86 | 86 |
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
916 | 916 |
917 // static | 917 // static |
918 bool FileUtilProxy::Flush( | 918 bool FileUtilProxy::Flush( |
919 scoped_refptr<MessageLoopProxy> message_loop_proxy, | 919 scoped_refptr<MessageLoopProxy> message_loop_proxy, |
920 PlatformFile file, | 920 PlatformFile file, |
921 StatusCallback* callback) { | 921 StatusCallback* callback) { |
922 return Start(FROM_HERE, message_loop_proxy, new RelayFlush(file, callback)); | 922 return Start(FROM_HERE, message_loop_proxy, new RelayFlush(file, callback)); |
923 } | 923 } |
924 | 924 |
925 } // namespace base | 925 } // namespace base |
OLD | NEW |