Chromium Code Reviews| 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 "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 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 92 nacl_abi_size_t length = kMaxVarSize; | 92 nacl_abi_size_t length = kMaxVarSize; |
| 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(GetMainSrpcChannel(), name_bytes.get(), length, | 102 if (DeserializeTo(name_bytes.get(), length, 1 /* argc */, &name)) |
| 103 1, // argc | |
| 104 &name)) | |
| 105 return name; | 103 return name; |
| 106 } | 104 } |
| 107 return PP_MakeUndefined(); | 105 return PP_MakeUndefined(); |
| 108 } | 106 } |
| 109 | 107 |
| 110 PP_Var GetPath(PP_Resource file_ref) { | 108 PP_Var GetPath(PP_Resource file_ref) { |
| 111 DebugPrintf("PPB_FileRef::GetPath: file_ref=%"NACL_PRIu32"\n", file_ref); | 109 DebugPrintf("PPB_FileRef::GetPath: file_ref=%"NACL_PRIu32"\n", file_ref); |
| 112 | 110 |
| 113 PP_Var path = PP_MakeUndefined(); | 111 PP_Var path = PP_MakeUndefined(); |
| 114 nacl_abi_size_t length = kMaxVarSize; | 112 nacl_abi_size_t length = kMaxVarSize; |
| 115 nacl::scoped_array<char> path_bytes(new char[length]); | 113 nacl::scoped_array<char> path_bytes(new char[length]); |
| 116 NaClSrpcError srpc_result = PpbFileRefRpcClient::PPB_FileRef_GetPath( | 114 NaClSrpcError srpc_result = PpbFileRefRpcClient::PPB_FileRef_GetPath( |
| 117 GetMainSrpcChannel(), | 115 GetMainSrpcChannel(), |
| 118 file_ref, | 116 file_ref, |
| 119 &length, | 117 &length, |
| 120 path_bytes.get()); | 118 path_bytes.get()); |
| 121 DebugPrintf("PPB_FileRef::GetPath: %s\n", | 119 DebugPrintf("PPB_FileRef::GetPath: %s\n", |
| 122 NaClSrpcErrorString(srpc_result)); | 120 NaClSrpcErrorString(srpc_result)); |
| 123 | 121 |
| 124 if (srpc_result == NACL_SRPC_RESULT_OK && | 122 if (srpc_result == NACL_SRPC_RESULT_OK && |
| 125 DeserializeTo(GetMainSrpcChannel(), path_bytes.get(), length, | 123 DeserializeTo(path_bytes.get(), length, 1 /* argc */, &path)) { |
|
bbudge
2011/12/07 16:00:34
indentation + 2?
dmichael (off chromium)
2011/12/07 18:07:38
Done.
| |
| 126 1, // argc | |
| 127 &path)) { | |
| 128 return path; | 124 return path; |
|
bbudge
2011/12/07 16:00:34
indentation - 2?
dmichael (off chromium)
2011/12/07 18:07:38
Done.
| |
| 129 } | 125 } |
| 130 return PP_MakeUndefined(); | 126 return PP_MakeUndefined(); |
| 131 } | 127 } |
| 132 | 128 |
| 133 PP_Resource GetParent(PP_Resource file_ref) { | 129 PP_Resource GetParent(PP_Resource file_ref) { |
| 134 DebugPrintf("PPB_FileRef::GetParent: file_ref=%"NACL_PRIu32"\n", file_ref); | 130 DebugPrintf("PPB_FileRef::GetParent: file_ref=%"NACL_PRIu32"\n", file_ref); |
| 135 | 131 |
| 136 PP_Resource parent = kInvalidResourceId; | 132 PP_Resource parent = kInvalidResourceId; |
| 137 NaClSrpcError srpc_result = PpbFileRefRpcClient::PPB_FileRef_GetParent( | 133 NaClSrpcError srpc_result = PpbFileRefRpcClient::PPB_FileRef_GetParent( |
| 138 GetMainSrpcChannel(), | 134 GetMainSrpcChannel(), |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 247 GetPath, | 243 GetPath, |
| 248 GetParent, | 244 GetParent, |
| 249 MakeDirectory, | 245 MakeDirectory, |
| 250 Touch, | 246 Touch, |
| 251 Delete, | 247 Delete, |
| 252 Rename | 248 Rename |
| 253 }; | 249 }; |
| 254 return &file_ref_interface; | 250 return &file_ref_interface; |
| 255 } | 251 } |
| 256 } // namespace ppapi_proxy | 252 } // namespace ppapi_proxy |
| OLD | NEW |