| 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_testing.h" | 5 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_testing.h" |
| 6 | 6 |
| 7 #include <cstddef> | 7 #include <cstddef> |
| 8 #include <new> | 8 #include <new> |
| 9 | 9 |
| 10 #include "native_client/src/include/nacl_scoped_ptr.h" | 10 #include "native_client/src/include/nacl_scoped_ptr.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 } | 95 } |
| 96 | 96 |
| 97 PP_Bool IsOutOfProcess() { | 97 PP_Bool IsOutOfProcess() { |
| 98 // The NaCl plugin is run in-process, and all calls are synchronous, so even | 98 // The NaCl plugin is run in-process, and all calls are synchronous, so even |
| 99 // though a NaCl module runs in a separate process, it behaves as if it were | 99 // though a NaCl module runs in a separate process, it behaves as if it were |
| 100 // in-process. Furthermore, calls off of the main thread are not supported | 100 // in-process. Furthermore, calls off of the main thread are not supported |
| 101 // (same as trusted in-process). | 101 // (same as trusted in-process). |
| 102 return PP_FALSE; | 102 return PP_FALSE; |
| 103 } | 103 } |
| 104 | 104 |
| 105 void SimulateInputEvent(PP_Instance instance, PP_Resource input_event) { |
| 106 DebugPrintf("PPB_Testing::SimulateInputEvent: instance=%"NACL_PRId32", " |
| 107 "input_event=%"NACL_PRId32"\n", |
| 108 instance, input_event); |
| 109 |
| 110 NaClSrpcError srpc_result = |
| 111 PpbTestingRpcClient::PPB_Testing_SimulateInputEvent(GetMainSrpcChannel(), |
| 112 instance, |
| 113 input_event); |
| 114 DebugPrintf("PPB_Testing::SimulateInputEvent: %s\n", |
| 115 NaClSrpcErrorString(srpc_result)); |
| 116 } |
| 117 |
| 105 struct PP_Var GetDocumentURL(PP_Instance instance, | 118 struct PP_Var GetDocumentURL(PP_Instance instance, |
| 106 struct PP_URLComponents_Dev* components) { | 119 struct PP_URLComponents_Dev* components) { |
| 107 DebugPrintf("PPB_Testing::GetDocumentURL: " | 120 DebugPrintf("PPB_Testing::GetDocumentURL: " |
| 108 "instance=%"NACL_PRIu32"\n", instance); | 121 "instance=%"NACL_PRIu32"\n", instance); |
| 109 | 122 |
| 110 NaClSrpcChannel* channel = GetMainSrpcChannel(); | 123 NaClSrpcChannel* channel = GetMainSrpcChannel(); |
| 111 nacl_abi_size_t components_size = kPPURLComponentsDevBytes; | 124 nacl_abi_size_t components_size = kPPURLComponentsDevBytes; |
| 112 nacl_abi_size_t url_size = kMaxVarSize; | 125 nacl_abi_size_t url_size = kMaxVarSize; |
| 113 nacl::scoped_array<char> url_bytes(new (std::nothrow) char[url_size]); | 126 nacl::scoped_array<char> url_bytes(new (std::nothrow) char[url_size]); |
| 114 if (url_bytes.get() == NULL) | 127 if (url_bytes.get() == NULL) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 133 | 146 |
| 134 } // namespace | 147 } // namespace |
| 135 | 148 |
| 136 const PPB_Testing_Dev* PluginTesting::GetInterface() { | 149 const PPB_Testing_Dev* PluginTesting::GetInterface() { |
| 137 static const PPB_Testing_Dev testing_interface = { | 150 static const PPB_Testing_Dev testing_interface = { |
| 138 ReadImageData, | 151 ReadImageData, |
| 139 RunMessageLoop, | 152 RunMessageLoop, |
| 140 QuitMessageLoop, | 153 QuitMessageLoop, |
| 141 GetLiveObjectsForInstance, | 154 GetLiveObjectsForInstance, |
| 142 IsOutOfProcess, | 155 IsOutOfProcess, |
| 143 NULL, | 156 SimulateInputEvent, |
| 144 GetDocumentURL | 157 GetDocumentURL |
| 145 }; | 158 }; |
| 146 return &testing_interface; | 159 return &testing_interface; |
| 147 } | 160 } |
| 148 | 161 |
| 149 } // namespace ppapi_proxy | 162 } // namespace ppapi_proxy |
| OLD | NEW |