Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(272)

Side by Side Diff: ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_input_event.cc

Issue 9187071: Lift the 64K message size limit for postMessage to/from NativeClient. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 2 // Use of this source code is governed by a BSD-style license that can be
3 // be found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_input_event.h" 5 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_input_event.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include "native_client/src/include/nacl_scoped_ptr.h" 10 #include "native_client/src/include/nacl_scoped_ptr.h"
11 #include "native_client/src/include/portability.h" 11 #include "native_client/src/include/portability.h"
12 #include "native_client/src/shared/ppapi_proxy/object_serialize.h" 12 #include "native_client/src/shared/ppapi_proxy/object_serialize.h"
13 #include "native_client/src/shared/ppapi_proxy/plugin_globals.h" 13 #include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
14 #include "native_client/src/shared/ppapi_proxy/plugin_resource.h" 14 #include "native_client/src/shared/ppapi_proxy/plugin_resource.h"
15 #include "native_client/src/shared/ppapi_proxy/untrusted/srpcgen/ppb_rpc.h" 15 #include "native_client/src/shared/ppapi_proxy/untrusted/srpcgen/ppb_rpc.h"
16 #include "native_client/src/shared/ppapi_proxy/utility.h" 16 #include "native_client/src/shared/ppapi_proxy/utility.h"
17 #include "native_client/src/shared/srpc/nacl_srpc.h" 17 #include "native_client/src/shared/srpc/nacl_srpc.h"
18 #include "ppapi/c/pp_errors.h" 18 #include "ppapi/c/pp_errors.h"
19 #include "ppapi/c/ppb_input_event.h" 19 #include "ppapi/c/ppb_input_event.h"
20 20
21 namespace { 21 namespace {
22 22
23 using ppapi_proxy::DebugPrintf; 23 using ppapi_proxy::DebugPrintf;
24 using ppapi_proxy::GetMainSrpcChannel; 24 using ppapi_proxy::GetMainSrpcChannel;
25 using ppapi_proxy::kInvalidResourceId; 25 using ppapi_proxy::kInvalidResourceId;
26 using ppapi_proxy::kMaxVarSize;
27 using ppapi_proxy::PluginInputEvent; 26 using ppapi_proxy::PluginInputEvent;
28 using ppapi_proxy::PluginResource; 27 using ppapi_proxy::PluginResource;
29 using ppapi_proxy::Serialize; 28 using ppapi_proxy::Serialize;
30 29
31 // InputEvent ------------------------------------------------------------------ 30 // InputEvent ------------------------------------------------------------------
32 31
33 int32_t RequestInputEvents(PP_Instance instance, uint32_t event_classes) { 32 int32_t RequestInputEvents(PP_Instance instance, uint32_t event_classes) {
34 DebugPrintf("PPB_InputEvent::RequestInputEvents: instance=%"NACL_PRIu32", " 33 DebugPrintf("PPB_InputEvent::RequestInputEvents: instance=%"NACL_PRIu32", "
35 "event_classes=%"NACL_PRIu32"\n", 34 "event_classes=%"NACL_PRIu32"\n",
36 instance, event_classes); 35 instance, event_classes);
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 PP_InputEvent_Type type, 264 PP_InputEvent_Type type,
266 PP_TimeTicks time_stamp, 265 PP_TimeTicks time_stamp,
267 uint32_t modifiers, 266 uint32_t modifiers,
268 uint32_t key_code, 267 uint32_t key_code,
269 struct PP_Var character_text) { 268 struct PP_Var character_text) {
270 DebugPrintf("PPB_InputEvent::CreateKeyboardInputEvent: instance=" 269 DebugPrintf("PPB_InputEvent::CreateKeyboardInputEvent: instance="
271 "%"NACL_PRIu32", type=%d, time_stamp=%lf, modifiers=" 270 "%"NACL_PRIu32", type=%d, time_stamp=%lf, modifiers="
272 "%"NACL_PRIu32", key_code=%"NACL_PRIu32"\n", 271 "%"NACL_PRIu32", key_code=%"NACL_PRIu32"\n",
273 instance, type, time_stamp, modifiers, key_code); 272 instance, type, time_stamp, modifiers, key_code);
274 // Serialize the character_text Var. 273 // Serialize the character_text Var.
275 uint32_t text_size = kMaxVarSize; 274 uint32_t text_size = 0;
276 nacl::scoped_array<char> text_bytes(Serialize(&character_text, 1, 275 nacl::scoped_array<char> text_bytes(Serialize(&character_text, 1,
277 &text_size)); 276 &text_size));
278 PP_Resource resource_id = kInvalidResourceId; 277 PP_Resource resource_id = kInvalidResourceId;
279 NaClSrpcError srpc_result = 278 NaClSrpcError srpc_result =
280 PpbInputEventRpcClient::PPB_InputEvent_CreateKeyboardInputEvent( 279 PpbInputEventRpcClient::PPB_InputEvent_CreateKeyboardInputEvent(
281 GetMainSrpcChannel(), 280 GetMainSrpcChannel(),
282 instance, 281 instance,
283 static_cast<int32_t>(type), 282 static_cast<int32_t>(type),
284 static_cast<double>(time_stamp), 283 static_cast<double>(time_stamp),
285 static_cast<int32_t>(modifiers), 284 static_cast<int32_t>(modifiers),
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 uint32_t PluginInputEvent::GetKeyCode() const { 433 uint32_t PluginInputEvent::GetKeyCode() const {
435 return input_event_data_.key_code; 434 return input_event_data_.key_code;
436 } 435 }
437 436
438 PP_Var PluginInputEvent::GetCharacterText() const { 437 PP_Var PluginInputEvent::GetCharacterText() const {
439 PPBVarInterface()->AddRef(character_text_); 438 PPBVarInterface()->AddRef(character_text_);
440 return character_text_; 439 return character_text_;
441 } 440 }
442 441
443 } // namespace ppapi_proxy 442 } // namespace ppapi_proxy
444
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698