Chromium Code Reviews| Index: ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_testing.cc |
| diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_testing.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_testing.cc |
| index 7c5a8a60404ff4def723085eb19614507772049a..3eea8c2d36b8b32b33690584972a0d3bcd220da1 100644 |
| --- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_testing.cc |
| +++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_testing.cc |
| @@ -4,6 +4,9 @@ |
| #include "native_client/src/shared/ppapi_proxy/plugin_ppb_testing.h" |
| +#include <cstddef> |
| +#include <vector> |
| + |
| #include "native_client/src/include/nacl_scoped_ptr.h" |
| #include "native_client/src/include/portability.h" |
| #include "native_client/src/shared/ppapi_proxy/object_serialize.h" |
| @@ -23,6 +26,8 @@ namespace { |
| const nacl_abi_size_t kPPPointBytes = |
| static_cast<nacl_abi_size_t>(sizeof(struct PP_Point)); |
| +const nacl_abi_size_t kPPURLComponentsDevBytes = |
| + static_cast<nacl_abi_size_t>(sizeof(struct PP_URLComponents_Dev)); |
| PP_Bool ReadImageData(PP_Resource device_context_2d, |
| PP_Resource image, |
| @@ -97,6 +102,33 @@ PP_Bool IsOutOfProcess() { |
| return PP_FALSE; |
| } |
| +struct PP_Var GetDocumentURL(PP_Instance instance, |
| + struct PP_URLComponents_Dev* components) { |
| + DebugPrintf("PPB_Testing::GetDocumentURL: " |
| + "instance=%"NACL_PRIu32"\n", instance); |
| + |
| + NaClSrpcChannel* channel = GetMainSrpcChannel(); |
| + nacl_abi_size_t components_size = kPPURLComponentsDevBytes; |
| + nacl_abi_size_t url_size = kMaxVarSize; |
| + std::vector<char> url_bytes(url_size); |
|
yzshen1
2011/12/13 18:49:54
It seems better to use things like
nacl::scoped_ar
ygorshenin
2011/12/14 17:41:10
Done.
|
| + NaClSrpcError srpc_result = |
| + PpbTestingRpcClient::PPB_Testing_GetDocumentURL( |
| + channel, |
| + instance, |
| + &components_size, reinterpret_cast<char*>(components), |
| + &url_size, &url_bytes[0]); |
| + |
| + struct PP_Var url = PP_MakeUndefined(); |
| + if (srpc_result == NACL_SRPC_RESULT_OK) |
| + (void) DeserializeTo( |
| + channel, &url_bytes[0], url_size, 1, &url); |
| + |
| + DebugPrintf("PPB_Testing::GetDocumentURL: %s\n", |
| + NaClSrpcErrorString(srpc_result)); |
| + |
| + return url; |
| +} |
| + |
| } // namespace |
| const PPB_Testing_Dev* PluginTesting::GetInterface() { |
| @@ -105,7 +137,9 @@ const PPB_Testing_Dev* PluginTesting::GetInterface() { |
| RunMessageLoop, |
| QuitMessageLoop, |
| GetLiveObjectsForInstance, |
| - IsOutOfProcess |
| + IsOutOfProcess, |
| + NULL, |
|
bbudge
2011/12/13 18:55:29
OK, but only because I will follow up immediately
ygorshenin
2011/12/14 17:41:10
Done.
|
| + GetDocumentURL |
| }; |
| return &testing_interface; |
| } |