| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "native_client/src/shared/ppapi_proxy/plugin_ppb_file_ref.h" | 5 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_file_ref.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "native_client/src/include/nacl_scoped_ptr.h" | 11 #include "native_client/src/include/nacl_scoped_ptr.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 | 82 |
| 83 if (srpc_result == NACL_SRPC_RESULT_OK) | 83 if (srpc_result == NACL_SRPC_RESULT_OK) |
| 84 return static_cast<PP_FileSystemType>(file_system_type); | 84 return static_cast<PP_FileSystemType>(file_system_type); |
| 85 return PP_FILESYSTEMTYPE_INVALID; | 85 return PP_FILESYSTEMTYPE_INVALID; |
| 86 } | 86 } |
| 87 | 87 |
| 88 PP_Var GetName(PP_Resource file_ref) { | 88 PP_Var GetName(PP_Resource file_ref) { |
| 89 DebugPrintf("PPB_FileRef::GetName: file_ref=%"NACL_PRIu32"\n", file_ref); | 89 DebugPrintf("PPB_FileRef::GetName: file_ref=%"NACL_PRIu32"\n", file_ref); |
| 90 | 90 |
| 91 PP_Var name = PP_MakeUndefined(); | 91 PP_Var name = PP_MakeUndefined(); |
| 92 nacl_abi_size_t length = kMaxVarSize; | 92 nacl_abi_size_t length = kMaxReturnVarSize; |
| 93 nacl::scoped_array<char> name_bytes(new char[length]); | 93 nacl::scoped_array<char> name_bytes(new char[length]); |
| 94 NaClSrpcError srpc_result = PpbFileRefRpcClient::PPB_FileRef_GetName( | 94 NaClSrpcError srpc_result = PpbFileRefRpcClient::PPB_FileRef_GetName( |
| 95 GetMainSrpcChannel(), | 95 GetMainSrpcChannel(), |
| 96 file_ref, | 96 file_ref, |
| 97 &length, | 97 &length, |
| 98 name_bytes.get()); | 98 name_bytes.get()); |
| 99 DebugPrintf("PPB_FileRef::GetName: %s\n", NaClSrpcErrorString(srpc_result)); | 99 DebugPrintf("PPB_FileRef::GetName: %s\n", NaClSrpcErrorString(srpc_result)); |
| 100 | 100 |
| 101 if (srpc_result == NACL_SRPC_RESULT_OK) { | 101 if (srpc_result == NACL_SRPC_RESULT_OK) { |
| 102 if (DeserializeTo(name_bytes.get(), length, 1 /* argc */, &name)) | 102 if (DeserializeTo(name_bytes.get(), length, 1 /* argc */, &name)) |
| 103 return name; | 103 return name; |
| 104 } | 104 } |
| 105 return PP_MakeUndefined(); | 105 return PP_MakeUndefined(); |
| 106 } | 106 } |
| 107 | 107 |
| 108 PP_Var GetPath(PP_Resource file_ref) { | 108 PP_Var GetPath(PP_Resource file_ref) { |
| 109 DebugPrintf("PPB_FileRef::GetPath: file_ref=%"NACL_PRIu32"\n", file_ref); | 109 DebugPrintf("PPB_FileRef::GetPath: file_ref=%"NACL_PRIu32"\n", file_ref); |
| 110 | 110 |
| 111 PP_Var path = PP_MakeUndefined(); | 111 PP_Var path = PP_MakeUndefined(); |
| 112 nacl_abi_size_t length = kMaxVarSize; | 112 nacl_abi_size_t length = kMaxReturnVarSize; |
| 113 nacl::scoped_array<char> path_bytes(new char[length]); | 113 nacl::scoped_array<char> path_bytes(new char[length]); |
| 114 NaClSrpcError srpc_result = PpbFileRefRpcClient::PPB_FileRef_GetPath( | 114 NaClSrpcError srpc_result = PpbFileRefRpcClient::PPB_FileRef_GetPath( |
| 115 GetMainSrpcChannel(), | 115 GetMainSrpcChannel(), |
| 116 file_ref, | 116 file_ref, |
| 117 &length, | 117 &length, |
| 118 path_bytes.get()); | 118 path_bytes.get()); |
| 119 DebugPrintf("PPB_FileRef::GetPath: %s\n", | 119 DebugPrintf("PPB_FileRef::GetPath: %s\n", |
| 120 NaClSrpcErrorString(srpc_result)); | 120 NaClSrpcErrorString(srpc_result)); |
| 121 | 121 |
| 122 if (srpc_result == NACL_SRPC_RESULT_OK && | 122 if (srpc_result == NACL_SRPC_RESULT_OK && |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 GetPath, | 243 GetPath, |
| 244 GetParent, | 244 GetParent, |
| 245 MakeDirectory, | 245 MakeDirectory, |
| 246 Touch, | 246 Touch, |
| 247 Delete, | 247 Delete, |
| 248 Rename | 248 Rename |
| 249 }; | 249 }; |
| 250 return &file_ref_interface; | 250 return &file_ref_interface; |
| 251 } | 251 } |
| 252 } // namespace ppapi_proxy | 252 } // namespace ppapi_proxy |
| OLD | NEW |