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

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

Issue 5974006: Convert srpc definitions from using int64 to using PP_Instance, PP_Module, an... (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: Created 10 years 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("Browser::PPP_Instance::DidCreate(%"NACL_PRId64")\n", instance); 73 DebugPrintf("Browser::PPP_Instance::DidCreate(%"NACL_PRId32")\n", instance);
nfullagar 2010/12/23 21:37:00 Is PP_Instance 32 bit or is this left over from th
polina 2010/12/23 21:58:30 Same question. I think this is premature.
noelallen_use_chromium 2010/12/23 22:23:23 Whoops, stale edit. Done. On 2010/12/23 21:37:00,
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 NaClSrpcChannel* channel = LookupBrowserPppForInstance(instance)->channel(); 84 NaClSrpcChannel* channel = LookupBrowserPppForInstance(instance)->channel();
85 int32_t int_argc = static_cast<int32_t>(argc); 85 int32_t int_argc = static_cast<int32_t>(argc);
86 int32_t success; 86 int32_t success;
87 NaClSrpcError retval = 87 NaClSrpcError retval =
88 PppInstanceRpcClient::PPP_Instance_DidCreate(channel, 88 PppInstanceRpcClient::PPP_Instance_DidCreate(channel,
89 instance, 89 instance,
90 int_argc, 90 int_argc,
91 argn_size, 91 argn_size,
92 argn_serial.get(), 92 argn_serial.get(),
93 argv_size, 93 argv_size,
94 argv_serial.get(), 94 argv_serial.get(),
95 &success); 95 &success);
96 if (retval != NACL_SRPC_RESULT_OK) { 96 if (retval != NACL_SRPC_RESULT_OK) {
97 return PP_FALSE; 97 return PP_FALSE;
98 } 98 }
99 return static_cast<PP_Bool>(success != 0); 99 return static_cast<PP_Bool>(success != 0);
100 } 100 }
101 101
102 void DidDestroy(PP_Instance instance) { 102 void DidDestroy(PP_Instance instance) {
103 DebugPrintf("Browser::PPP_Instance::Delete(%"NACL_PRId64")\n", instance); 103 DebugPrintf("Browser::PPP_Instance::Delete(%"NACL_PRId32")\n", instance);
104 NaClSrpcChannel* channel = LookupBrowserPppForInstance(instance)->channel(); 104 NaClSrpcChannel* channel = LookupBrowserPppForInstance(instance)->channel();
105 (void) PppInstanceRpcClient::PPP_Instance_DidDestroy(channel, instance); 105 (void) PppInstanceRpcClient::PPP_Instance_DidDestroy(channel, instance);
106 } 106 }
107 107
108 void DidChangeView(PP_Instance instance, 108 void DidChangeView(PP_Instance instance,
109 const PP_Rect* position, 109 const PP_Rect* position,
110 const PP_Rect* clip) { 110 const PP_Rect* clip) {
111 DebugPrintf("Browser::PPP_Instance::DidChangeView(%"NACL_PRId64")\n", 111 DebugPrintf("Browser::PPP_Instance::DidChangeView(%"NACL_PRId32")\n",
112 instance); 112 instance);
113 NaClSrpcChannel* channel = LookupBrowserPppForInstance(instance)->channel(); 113 NaClSrpcChannel* channel = LookupBrowserPppForInstance(instance)->channel();
114 int32_t position_array[4]; 114 int32_t position_array[4];
115 const uint32_t kPositionArraySize = NACL_ARRAY_SIZE(position_array); 115 const uint32_t kPositionArraySize = NACL_ARRAY_SIZE(position_array);
116 position_array[0] = position->point.x; 116 position_array[0] = position->point.x;
117 position_array[1] = position->point.y; 117 position_array[1] = position->point.y;
118 position_array[2] = position->size.width; 118 position_array[2] = position->size.width;
119 position_array[3] = position->size.height; 119 position_array[3] = position->size.height;
120 int32_t clip_array[4]; 120 int32_t clip_array[4];
121 const uint32_t kClipArraySize = NACL_ARRAY_SIZE(clip_array); 121 const uint32_t kClipArraySize = NACL_ARRAY_SIZE(clip_array);
122 clip_array[0] = clip->point.x; 122 clip_array[0] = clip->point.x;
123 clip_array[1] = clip->point.y; 123 clip_array[1] = clip->point.y;
124 clip_array[2] = clip->size.width; 124 clip_array[2] = clip->size.width;
125 clip_array[3] = clip->size.height; 125 clip_array[3] = clip->size.height;
126 (void) PppInstanceRpcClient::PPP_Instance_DidChangeView(channel, 126 (void) PppInstanceRpcClient::PPP_Instance_DidChangeView(channel,
127 instance, 127 instance,
128 kPositionArraySize, 128 kPositionArraySize,
129 position_array, 129 position_array,
130 kClipArraySize, 130 kClipArraySize,
131 clip_array); 131 clip_array);
132 } 132 }
133 133
134 void DidChangeFocus(PP_Instance instance, PP_Bool has_focus) { 134 void DidChangeFocus(PP_Instance instance, PP_Bool has_focus) {
135 DebugPrintf("Browser::PPP_Instance::DidChangeFocus(%"NACL_PRId64")\n", 135 DebugPrintf("Browser::PPP_Instance::DidChangeFocus(%"NACL_PRId32")\n",
136 instance); 136 instance);
137 NaClSrpcChannel* channel = LookupBrowserPppForInstance(instance)->channel(); 137 NaClSrpcChannel* channel = LookupBrowserPppForInstance(instance)->channel();
138 // DidChangeFocus() always succeeds, no need to check the SRPC return value. 138 // DidChangeFocus() always succeeds, no need to check the SRPC return value.
139 (void) PppInstanceRpcClient::PPP_Instance_DidChangeFocus(channel, 139 (void) PppInstanceRpcClient::PPP_Instance_DidChangeFocus(channel,
140 instance, static_cast<bool>(PP_TRUE == has_focus)); 140 instance, 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("Browser::PPP_Instance::HandleInputEvent(%"NACL_PRId64")\n", 144 DebugPrintf("Browser::PPP_Instance::HandleInputEvent(%"NACL_PRId32")\n",
145 instance); 145 instance);
146 NaClSrpcChannel* channel = LookupBrowserPppForInstance(instance)->channel(); 146 NaClSrpcChannel* channel = LookupBrowserPppForInstance(instance)->channel();
147 int32_t success; 147 int32_t success;
148 char* event_data = const_cast<char*>(reinterpret_cast<const char*>(event)); 148 char* event_data = const_cast<char*>(reinterpret_cast<const char*>(event));
149 NaClSrpcError retval = 149 NaClSrpcError retval =
150 PppInstanceRpcClient::PPP_Instance_HandleInputEvent(channel, 150 PppInstanceRpcClient::PPP_Instance_HandleInputEvent(channel,
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("Browser::PPP_Instance::HandleDocumentLoad(%"NACL_PRId64")\n", 162 DebugPrintf("Browser::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("Browser::PPP_Instance::GetInstanceObject(%"NACL_PRId64")\n", 171 DebugPrintf("Browser::PPP_Instance::GetInstanceObject(%"NACL_PRId32")\n",
172 instance); 172 instance);
173 NaClSrpcChannel* channel = LookupBrowserPppForInstance(instance)->channel(); 173 NaClSrpcChannel* channel = LookupBrowserPppForInstance(instance)->channel();
174 ObjectCapability capability; 174 ObjectCapability capability;
175 uint32_t capability_bytes = static_cast<uint32_t>(sizeof(capability)); 175 uint32_t capability_bytes = static_cast<uint32_t>(sizeof(capability));
176 NaClSrpcError retval = 176 NaClSrpcError retval =
177 PppInstanceRpcClient::PPP_Instance_GetInstanceObject( 177 PppInstanceRpcClient::PPP_Instance_GetInstanceObject(
178 channel, 178 channel,
179 instance, 179 instance,
180 &capability_bytes, 180 &capability_bytes,
181 reinterpret_cast<char*>(&capability)); 181 reinterpret_cast<char*>(&capability));
(...skipping 11 matching lines...) Expand all
193 DidChangeView, 193 DidChangeView,
194 DidChangeFocus, 194 DidChangeFocus,
195 HandleInputEvent, 195 HandleInputEvent,
196 HandleDocumentLoad, 196 HandleDocumentLoad,
197 GetInstanceObject 197 GetInstanceObject
198 }; 198 };
199 return &instance_interface; 199 return &instance_interface;
200 } 200 }
201 201
202 } // namespace ppapi_proxy 202 } // namespace ppapi_proxy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698