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 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
847 new RelayDelete(file_path, true, callback)); | 847 new RelayDelete(file_path, true, callback)); |
848 } | 848 } |
849 | 849 |
850 // static | 850 // static |
851 bool FileUtilProxy::Read( | 851 bool FileUtilProxy::Read( |
852 scoped_refptr<MessageLoopProxy> message_loop_proxy, | 852 scoped_refptr<MessageLoopProxy> message_loop_proxy, |
853 PlatformFile file, | 853 PlatformFile file, |
854 int64 offset, | 854 int64 offset, |
855 int bytes_to_read, | 855 int bytes_to_read, |
856 ReadCallback* callback) { | 856 ReadCallback* callback) { |
| 857 if (bytes_to_read < 0) |
| 858 return false; |
857 return Start(FROM_HERE, message_loop_proxy, | 859 return Start(FROM_HERE, message_loop_proxy, |
858 new RelayRead(file, offset, bytes_to_read, callback)); | 860 new RelayRead(file, offset, bytes_to_read, callback)); |
859 } | 861 } |
860 | 862 |
861 // static | 863 // static |
862 bool FileUtilProxy::Write( | 864 bool FileUtilProxy::Write( |
863 scoped_refptr<MessageLoopProxy> message_loop_proxy, | 865 scoped_refptr<MessageLoopProxy> message_loop_proxy, |
864 PlatformFile file, | 866 PlatformFile file, |
865 int64 offset, | 867 int64 offset, |
866 const char* buffer, | 868 const char* buffer, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
916 | 918 |
917 // static | 919 // static |
918 bool FileUtilProxy::Flush( | 920 bool FileUtilProxy::Flush( |
919 scoped_refptr<MessageLoopProxy> message_loop_proxy, | 921 scoped_refptr<MessageLoopProxy> message_loop_proxy, |
920 PlatformFile file, | 922 PlatformFile file, |
921 StatusCallback* callback) { | 923 StatusCallback* callback) { |
922 return Start(FROM_HERE, message_loop_proxy, new RelayFlush(file, callback)); | 924 return Start(FROM_HERE, message_loop_proxy, new RelayFlush(file, callback)); |
923 } | 925 } |
924 | 926 |
925 } // namespace base | 927 } // namespace base |
OLD | NEW |