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

Side by Side Diff: src/shared/ppapi_proxy/browser_ppp_instance.cc

Issue 6218004: Resource64->32, NaCl side. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: First Created 9 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 /* 1 /*
2 * Copyright 2010 The Native Client Authors. All rights reserved. 2 * Copyright 2010 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can 3 * Use of this source code is governed by a BSD-style license that can
4 * be found in the LICENSE file. 4 * be found in the LICENSE file.
5 */ 5 */
6 6
7 #include "native_client/src/shared/ppapi_proxy/browser_ppp_instance.h" 7 #include "native_client/src/shared/ppapi_proxy/browser_ppp_instance.h"
8 8
9 #include <stdio.h> 9 #include <stdio.h>
10 #include <string.h> 10 #include <string.h>
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 strncpy(serial_array + pos, array[i], len); 63 strncpy(serial_array + pos, array[i], len);
64 pos += len; 64 pos += len;
65 } 65 }
66 return serial_array; 66 return serial_array;
67 } 67 }
68 68
69 PP_Bool DidCreate(PP_Instance instance, 69 PP_Bool DidCreate(PP_Instance instance,
70 uint32_t argc, 70 uint32_t argc,
71 const char* argn[], 71 const char* argn[],
72 const char* argv[]) { 72 const char* argv[]) {
73 DebugPrintf("PPP_Instance::DidCreate(%"NACL_PRId64")\n", instance); 73 DebugPrintf("PPP_Instance::DidCreate(%"NACL_PRId32")\n", instance);
74 uint32_t argn_size; 74 uint32_t argn_size;
75 scoped_array<char> argn_serial(ArgArraySerialize(argc, argn, &argn_size)); 75 scoped_array<char> argn_serial(ArgArraySerialize(argc, argn, &argn_size));
76 if (argn_serial.get() == NULL) { 76 if (argn_serial.get() == NULL) {
77 return PP_FALSE; 77 return PP_FALSE;
78 } 78 }
79 uint32_t argv_size; 79 uint32_t argv_size;
80 scoped_array<char> argv_serial(ArgArraySerialize(argc, argv, &argv_size)); 80 scoped_array<char> argv_serial(ArgArraySerialize(argc, argv, &argv_size));
81 if (argv_serial.get() == NULL) { 81 if (argv_serial.get() == NULL) {
82 return PP_FALSE; 82 return PP_FALSE;
83 } 83 }
84 int32_t int_argc = static_cast<int32_t>(argc); 84 int32_t int_argc = static_cast<int32_t>(argc);
85 int32_t success; 85 int32_t success;
86 NaClSrpcError retval = 86 NaClSrpcError retval =
87 PppInstanceRpcClient::PPP_Instance_DidCreate(GetMainSrpcChannel(instance), 87 PppInstanceRpcClient::PPP_Instance_DidCreate(GetMainSrpcChannel(instance),
88 instance, 88 instance,
89 int_argc, 89 int_argc,
90 argn_size, 90 argn_size,
91 argn_serial.get(), 91 argn_serial.get(),
92 argv_size, 92 argv_size,
93 argv_serial.get(), 93 argv_serial.get(),
94 &success); 94 &success);
95 if (retval != NACL_SRPC_RESULT_OK) { 95 if (retval != NACL_SRPC_RESULT_OK) {
96 return PP_FALSE; 96 return PP_FALSE;
97 } 97 }
98 return static_cast<PP_Bool>(success != 0); 98 return static_cast<PP_Bool>(success != 0);
99 } 99 }
100 100
101 void DidDestroy(PP_Instance instance) { 101 void DidDestroy(PP_Instance instance) {
102 DebugPrintf("PPP_Instance::Delete(%"NACL_PRId64")\n", instance); 102 DebugPrintf("PPP_Instance::Delete(%"NACL_PRId32")\n", instance);
103 (void) PppInstanceRpcClient::PPP_Instance_DidDestroy( 103 (void) PppInstanceRpcClient::PPP_Instance_DidDestroy(
104 GetMainSrpcChannel(instance), instance); 104 GetMainSrpcChannel(instance), instance);
105 } 105 }
106 106
107 void DidChangeView(PP_Instance instance, 107 void DidChangeView(PP_Instance instance,
108 const PP_Rect* position, 108 const PP_Rect* position,
109 const PP_Rect* clip) { 109 const PP_Rect* clip) {
110 DebugPrintf("PPP_Instance::DidChangeView(%"NACL_PRId64")\n", 110 DebugPrintf("PPP_Instance::DidChangeView(%"NACL_PRId32")\n",
111 instance); 111 instance);
112 int32_t position_array[4]; 112 int32_t position_array[4];
113 const uint32_t kPositionArraySize = NACL_ARRAY_SIZE(position_array); 113 const uint32_t kPositionArraySize = NACL_ARRAY_SIZE(position_array);
114 position_array[0] = position->point.x; 114 position_array[0] = position->point.x;
115 position_array[1] = position->point.y; 115 position_array[1] = position->point.y;
116 position_array[2] = position->size.width; 116 position_array[2] = position->size.width;
117 position_array[3] = position->size.height; 117 position_array[3] = position->size.height;
118 int32_t clip_array[4]; 118 int32_t clip_array[4];
119 const uint32_t kClipArraySize = NACL_ARRAY_SIZE(clip_array); 119 const uint32_t kClipArraySize = NACL_ARRAY_SIZE(clip_array);
120 clip_array[0] = clip->point.x; 120 clip_array[0] = clip->point.x;
121 clip_array[1] = clip->point.y; 121 clip_array[1] = clip->point.y;
122 clip_array[2] = clip->size.width; 122 clip_array[2] = clip->size.width;
123 clip_array[3] = clip->size.height; 123 clip_array[3] = clip->size.height;
124 (void) PppInstanceRpcClient::PPP_Instance_DidChangeView( 124 (void) PppInstanceRpcClient::PPP_Instance_DidChangeView(
125 GetMainSrpcChannel(instance), 125 GetMainSrpcChannel(instance),
126 instance, 126 instance,
127 kPositionArraySize, 127 kPositionArraySize,
128 position_array, 128 position_array,
129 kClipArraySize, 129 kClipArraySize,
130 clip_array); 130 clip_array);
131 } 131 }
132 132
133 void DidChangeFocus(PP_Instance instance, PP_Bool has_focus) { 133 void DidChangeFocus(PP_Instance instance, PP_Bool has_focus) {
134 DebugPrintf("PPP_Instance::DidChangeFocus(%"NACL_PRId64")\n", 134 DebugPrintf("PPP_Instance::DidChangeFocus(%"NACL_PRId32")\n",
135 instance); 135 instance);
136 // DidChangeFocus() always succeeds, no need to check the SRPC return value. 136 // DidChangeFocus() always succeeds, no need to check the SRPC return value.
137 (void) PppInstanceRpcClient::PPP_Instance_DidChangeFocus( 137 (void) PppInstanceRpcClient::PPP_Instance_DidChangeFocus(
138 GetMainSrpcChannel(instance), 138 GetMainSrpcChannel(instance),
139 instance, 139 instance,
140 static_cast<bool>(PP_TRUE == has_focus)); 140 static_cast<bool>(PP_TRUE == has_focus));
141 } 141 }
142 142
143 PP_Bool HandleInputEvent(PP_Instance instance, const PP_InputEvent* event) { 143 PP_Bool HandleInputEvent(PP_Instance instance, const PP_InputEvent* event) {
144 DebugPrintf("PPP_Instance::HandleInputEvent(%"NACL_PRId64")\n", 144 DebugPrintf("PPP_Instance::HandleInputEvent(%"NACL_PRId32")\n",
145 instance); 145 instance);
146 int32_t success; 146 int32_t success;
147 char* event_data = const_cast<char*>(reinterpret_cast<const char*>(event)); 147 char* event_data = const_cast<char*>(reinterpret_cast<const char*>(event));
148 NaClSrpcError retval = 148 NaClSrpcError retval =
149 PppInstanceRpcClient::PPP_Instance_HandleInputEvent( 149 PppInstanceRpcClient::PPP_Instance_HandleInputEvent(
150 GetMainSrpcChannel(instance), 150 GetMainSrpcChannel(instance),
151 instance, 151 instance,
152 sizeof(*event), 152 sizeof(*event),
153 event_data, 153 event_data,
154 &success); 154 &success);
155 if (retval != NACL_SRPC_RESULT_OK) { 155 if (retval != NACL_SRPC_RESULT_OK) {
156 return PP_FALSE; 156 return PP_FALSE;
157 } 157 }
158 return static_cast<PP_Bool>(success != 0); 158 return static_cast<PP_Bool>(success != 0);
159 } 159 }
160 160
161 PP_Bool HandleDocumentLoad(PP_Instance instance, PP_Resource url_loader) { 161 PP_Bool HandleDocumentLoad(PP_Instance instance, PP_Resource url_loader) {
162 DebugPrintf("PPP_Instance::HandleDocumentLoad(%"NACL_PRId64")\n", 162 DebugPrintf("PPP_Instance::HandleDocumentLoad(%"NACL_PRId32")\n",
163 instance); 163 instance);
164 // TODO(sehr): implement HandleDocumentLoad. 164 // TODO(sehr): implement HandleDocumentLoad.
165 UNREFERENCED_PARAMETER(instance); 165 UNREFERENCED_PARAMETER(instance);
166 UNREFERENCED_PARAMETER(url_loader); 166 UNREFERENCED_PARAMETER(url_loader);
167 return PP_FALSE; 167 return PP_FALSE;
168 } 168 }
169 169
170 PP_Var GetInstanceObject(PP_Instance instance) { 170 PP_Var GetInstanceObject(PP_Instance instance) {
171 DebugPrintf("PPP_Instance::GetInstanceObject(%"NACL_PRId64")\n", 171 DebugPrintf("PPP_Instance::GetInstanceObject(%"NACL_PRId32")\n",
172 instance); 172 instance);
173 ObjectCapability capability; 173 ObjectCapability capability;
174 uint32_t capability_bytes = static_cast<uint32_t>(sizeof(capability)); 174 uint32_t capability_bytes = static_cast<uint32_t>(sizeof(capability));
175 NaClSrpcChannel* main_channel = GetMainSrpcChannel(instance); 175 NaClSrpcChannel* main_channel = GetMainSrpcChannel(instance);
176 NaClSrpcError retval = 176 NaClSrpcError retval =
177 PppInstanceRpcClient::PPP_Instance_GetInstanceObject( 177 PppInstanceRpcClient::PPP_Instance_GetInstanceObject(
178 main_channel, 178 main_channel,
179 instance, 179 instance,
180 &capability_bytes, 180 &capability_bytes,
181 reinterpret_cast<char*>(&capability)); 181 reinterpret_cast<char*>(&capability));
(...skipping 12 matching lines...) Expand all
194 DidChangeView, 194 DidChangeView,
195 DidChangeFocus, 195 DidChangeFocus,
196 HandleInputEvent, 196 HandleInputEvent,
197 HandleDocumentLoad, 197 HandleDocumentLoad,
198 GetInstanceObject 198 GetInstanceObject
199 }; 199 };
200 return &instance_interface; 200 return &instance_interface;
201 } 201 }
202 202
203 } // namespace ppapi_proxy 203 } // namespace ppapi_proxy
OLDNEW
« no previous file with comments | « no previous file | src/shared/ppapi_proxy/ppb_rpc_client.cc » ('j') | tests/fake_browser_ppapi/fake_host.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698