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

Side by Side Diff: ppapi/proxy/ppb_var_deprecated_proxy.cc

Issue 8333004: Rename InterfaceID to ApiID and move the file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged Created 9 years, 2 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
« no previous file with comments | « ppapi/proxy/ppb_url_response_info_proxy.cc ('k') | ppapi/proxy/ppb_video_capture_proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ppapi/proxy/ppb_var_deprecated_proxy.h" 5 #include "ppapi/proxy/ppb_var_deprecated_proxy.h"
6 6
7 #include <stdlib.h> // For malloc 7 #include <stdlib.h> // For malloc
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 PP_Var name, 86 PP_Var name,
87 PP_Var* exception) { 87 PP_Var* exception) {
88 Dispatcher* dispatcher = CheckExceptionAndGetDispatcher(var, exception); 88 Dispatcher* dispatcher = CheckExceptionAndGetDispatcher(var, exception);
89 if (!dispatcher) 89 if (!dispatcher)
90 return false; 90 return false;
91 91
92 ReceiveSerializedException se(dispatcher, exception); 92 ReceiveSerializedException se(dispatcher, exception);
93 PP_Bool result = PP_FALSE; 93 PP_Bool result = PP_FALSE;
94 if (!se.IsThrown()) { 94 if (!se.IsThrown()) {
95 dispatcher->Send(new PpapiHostMsg_PPBVar_HasProperty( 95 dispatcher->Send(new PpapiHostMsg_PPBVar_HasProperty(
96 INTERFACE_ID_PPB_VAR_DEPRECATED, 96 API_ID_PPB_VAR_DEPRECATED,
97 SerializedVarSendInput(dispatcher, var), 97 SerializedVarSendInput(dispatcher, var),
98 SerializedVarSendInput(dispatcher, name), &se, &result)); 98 SerializedVarSendInput(dispatcher, name), &se, &result));
99 } 99 }
100 return PP_ToBool(result); 100 return PP_ToBool(result);
101 } 101 }
102 102
103 bool HasMethod(PP_Var var, 103 bool HasMethod(PP_Var var,
104 PP_Var name, 104 PP_Var name,
105 PP_Var* exception) { 105 PP_Var* exception) {
106 Dispatcher* dispatcher = CheckExceptionAndGetDispatcher(var, exception); 106 Dispatcher* dispatcher = CheckExceptionAndGetDispatcher(var, exception);
107 if (!dispatcher) 107 if (!dispatcher)
108 return false; 108 return false;
109 109
110 ReceiveSerializedException se(dispatcher, exception); 110 ReceiveSerializedException se(dispatcher, exception);
111 PP_Bool result = PP_FALSE; 111 PP_Bool result = PP_FALSE;
112 if (!se.IsThrown()) { 112 if (!se.IsThrown()) {
113 dispatcher->Send(new PpapiHostMsg_PPBVar_HasMethodDeprecated( 113 dispatcher->Send(new PpapiHostMsg_PPBVar_HasMethodDeprecated(
114 INTERFACE_ID_PPB_VAR_DEPRECATED, 114 API_ID_PPB_VAR_DEPRECATED,
115 SerializedVarSendInput(dispatcher, var), 115 SerializedVarSendInput(dispatcher, var),
116 SerializedVarSendInput(dispatcher, name), &se, &result)); 116 SerializedVarSendInput(dispatcher, name), &se, &result));
117 } 117 }
118 return PP_ToBool(result); 118 return PP_ToBool(result);
119 } 119 }
120 120
121 PP_Var GetProperty(PP_Var var, 121 PP_Var GetProperty(PP_Var var,
122 PP_Var name, 122 PP_Var name,
123 PP_Var* exception) { 123 PP_Var* exception) {
124 Dispatcher* dispatcher = CheckExceptionAndGetDispatcher(var, exception); 124 Dispatcher* dispatcher = CheckExceptionAndGetDispatcher(var, exception);
125 if (!dispatcher) 125 if (!dispatcher)
126 return PP_MakeUndefined(); 126 return PP_MakeUndefined();
127 127
128 ReceiveSerializedException se(dispatcher, exception); 128 ReceiveSerializedException se(dispatcher, exception);
129 ReceiveSerializedVarReturnValue result; 129 ReceiveSerializedVarReturnValue result;
130 if (!se.IsThrown()) { 130 if (!se.IsThrown()) {
131 dispatcher->Send(new PpapiHostMsg_PPBVar_GetProperty( 131 dispatcher->Send(new PpapiHostMsg_PPBVar_GetProperty(
132 INTERFACE_ID_PPB_VAR_DEPRECATED, 132 API_ID_PPB_VAR_DEPRECATED,
133 SerializedVarSendInput(dispatcher, var), 133 SerializedVarSendInput(dispatcher, var),
134 SerializedVarSendInput(dispatcher, name), &se, &result)); 134 SerializedVarSendInput(dispatcher, name), &se, &result));
135 } 135 }
136 return result.Return(dispatcher); 136 return result.Return(dispatcher);
137 } 137 }
138 138
139 void EnumerateProperties(PP_Var var, 139 void EnumerateProperties(PP_Var var,
140 uint32_t* property_count, 140 uint32_t* property_count,
141 PP_Var** properties, 141 PP_Var** properties,
142 PP_Var* exception) { 142 PP_Var* exception) {
143 Dispatcher* dispatcher = CheckExceptionAndGetDispatcher(var, exception); 143 Dispatcher* dispatcher = CheckExceptionAndGetDispatcher(var, exception);
144 if (!dispatcher) { 144 if (!dispatcher) {
145 *property_count = 0; 145 *property_count = 0;
146 *properties = NULL; 146 *properties = NULL;
147 return; 147 return;
148 } 148 }
149 149
150 ReceiveSerializedVarVectorOutParam out_vector(dispatcher, 150 ReceiveSerializedVarVectorOutParam out_vector(dispatcher,
151 property_count, properties); 151 property_count, properties);
152 ReceiveSerializedException se(dispatcher, exception); 152 ReceiveSerializedException se(dispatcher, exception);
153 if (!se.IsThrown()) { 153 if (!se.IsThrown()) {
154 dispatcher->Send(new PpapiHostMsg_PPBVar_EnumerateProperties( 154 dispatcher->Send(new PpapiHostMsg_PPBVar_EnumerateProperties(
155 INTERFACE_ID_PPB_VAR_DEPRECATED, 155 API_ID_PPB_VAR_DEPRECATED,
156 SerializedVarSendInput(dispatcher, var), 156 SerializedVarSendInput(dispatcher, var),
157 out_vector.OutParam(), &se)); 157 out_vector.OutParam(), &se));
158 } 158 }
159 } 159 }
160 160
161 void SetProperty(PP_Var var, 161 void SetProperty(PP_Var var,
162 PP_Var name, 162 PP_Var name,
163 PP_Var value, 163 PP_Var value,
164 PP_Var* exception) { 164 PP_Var* exception) {
165 Dispatcher* dispatcher = CheckExceptionAndGetDispatcher(var, exception); 165 Dispatcher* dispatcher = CheckExceptionAndGetDispatcher(var, exception);
166 if (!dispatcher) 166 if (!dispatcher)
167 return; 167 return;
168 168
169 ReceiveSerializedException se(dispatcher, exception); 169 ReceiveSerializedException se(dispatcher, exception);
170 if (!se.IsThrown()) { 170 if (!se.IsThrown()) {
171 dispatcher->Send(new PpapiHostMsg_PPBVar_SetPropertyDeprecated( 171 dispatcher->Send(new PpapiHostMsg_PPBVar_SetPropertyDeprecated(
172 INTERFACE_ID_PPB_VAR_DEPRECATED, 172 API_ID_PPB_VAR_DEPRECATED,
173 SerializedVarSendInput(dispatcher, var), 173 SerializedVarSendInput(dispatcher, var),
174 SerializedVarSendInput(dispatcher, name), 174 SerializedVarSendInput(dispatcher, name),
175 SerializedVarSendInput(dispatcher, value), &se)); 175 SerializedVarSendInput(dispatcher, value), &se));
176 } 176 }
177 } 177 }
178 178
179 void RemoveProperty(PP_Var var, 179 void RemoveProperty(PP_Var var,
180 PP_Var name, 180 PP_Var name,
181 PP_Var* exception) { 181 PP_Var* exception) {
182 Dispatcher* dispatcher = CheckExceptionAndGetDispatcher(var, exception); 182 Dispatcher* dispatcher = CheckExceptionAndGetDispatcher(var, exception);
183 if (!dispatcher) 183 if (!dispatcher)
184 return; 184 return;
185 185
186 ReceiveSerializedException se(dispatcher, exception); 186 ReceiveSerializedException se(dispatcher, exception);
187 PP_Bool result = PP_FALSE; 187 PP_Bool result = PP_FALSE;
188 if (!se.IsThrown()) { 188 if (!se.IsThrown()) {
189 dispatcher->Send(new PpapiHostMsg_PPBVar_DeleteProperty( 189 dispatcher->Send(new PpapiHostMsg_PPBVar_DeleteProperty(
190 INTERFACE_ID_PPB_VAR_DEPRECATED, 190 API_ID_PPB_VAR_DEPRECATED,
191 SerializedVarSendInput(dispatcher, var), 191 SerializedVarSendInput(dispatcher, var),
192 SerializedVarSendInput(dispatcher, name), &se, &result)); 192 SerializedVarSendInput(dispatcher, name), &se, &result));
193 } 193 }
194 } 194 }
195 195
196 PP_Var Call(PP_Var object, 196 PP_Var Call(PP_Var object,
197 PP_Var method_name, 197 PP_Var method_name,
198 uint32_t argc, 198 uint32_t argc,
199 PP_Var* argv, 199 PP_Var* argv,
200 PP_Var* exception) { 200 PP_Var* exception) {
201 Dispatcher* dispatcher = CheckExceptionAndGetDispatcher(object, exception); 201 Dispatcher* dispatcher = CheckExceptionAndGetDispatcher(object, exception);
202 if (!dispatcher) 202 if (!dispatcher)
203 return PP_MakeUndefined(); 203 return PP_MakeUndefined();
204 204
205 ReceiveSerializedVarReturnValue result; 205 ReceiveSerializedVarReturnValue result;
206 ReceiveSerializedException se(dispatcher, exception); 206 ReceiveSerializedException se(dispatcher, exception);
207 if (!se.IsThrown()) { 207 if (!se.IsThrown()) {
208 std::vector<SerializedVar> argv_vect; 208 std::vector<SerializedVar> argv_vect;
209 SerializedVarSendInput::ConvertVector(dispatcher, argv, argc, &argv_vect); 209 SerializedVarSendInput::ConvertVector(dispatcher, argv, argc, &argv_vect);
210 210
211 dispatcher->Send(new PpapiHostMsg_PPBVar_CallDeprecated( 211 dispatcher->Send(new PpapiHostMsg_PPBVar_CallDeprecated(
212 INTERFACE_ID_PPB_VAR_DEPRECATED, 212 API_ID_PPB_VAR_DEPRECATED,
213 SerializedVarSendInput(dispatcher, object), 213 SerializedVarSendInput(dispatcher, object),
214 SerializedVarSendInput(dispatcher, method_name), argv_vect, 214 SerializedVarSendInput(dispatcher, method_name), argv_vect,
215 &se, &result)); 215 &se, &result));
216 } 216 }
217 return result.Return(dispatcher); 217 return result.Return(dispatcher);
218 } 218 }
219 219
220 PP_Var Construct(PP_Var object, 220 PP_Var Construct(PP_Var object,
221 uint32_t argc, 221 uint32_t argc,
222 PP_Var* argv, 222 PP_Var* argv,
223 PP_Var* exception) { 223 PP_Var* exception) {
224 Dispatcher* dispatcher = CheckExceptionAndGetDispatcher(object, exception); 224 Dispatcher* dispatcher = CheckExceptionAndGetDispatcher(object, exception);
225 if (!dispatcher) 225 if (!dispatcher)
226 return PP_MakeUndefined(); 226 return PP_MakeUndefined();
227 227
228 ReceiveSerializedVarReturnValue result; 228 ReceiveSerializedVarReturnValue result;
229 ReceiveSerializedException se(dispatcher, exception); 229 ReceiveSerializedException se(dispatcher, exception);
230 if (!se.IsThrown()) { 230 if (!se.IsThrown()) {
231 std::vector<SerializedVar> argv_vect; 231 std::vector<SerializedVar> argv_vect;
232 SerializedVarSendInput::ConvertVector(dispatcher, argv, argc, &argv_vect); 232 SerializedVarSendInput::ConvertVector(dispatcher, argv, argc, &argv_vect);
233 233
234 dispatcher->Send(new PpapiHostMsg_PPBVar_Construct( 234 dispatcher->Send(new PpapiHostMsg_PPBVar_Construct(
235 INTERFACE_ID_PPB_VAR_DEPRECATED, 235 API_ID_PPB_VAR_DEPRECATED,
236 SerializedVarSendInput(dispatcher, object), 236 SerializedVarSendInput(dispatcher, object),
237 argv_vect, &se, &result)); 237 argv_vect, &se, &result));
238 } 238 }
239 return result.Return(dispatcher); 239 return result.Return(dispatcher);
240 } 240 }
241 241
242 bool IsInstanceOf(PP_Var var, 242 bool IsInstanceOf(PP_Var var,
243 const PPP_Class_Deprecated* ppp_class, 243 const PPP_Class_Deprecated* ppp_class,
244 void** ppp_class_data) { 244 void** ppp_class_data) {
245 Dispatcher* dispatcher = CheckExceptionAndGetDispatcher(var, NULL); 245 Dispatcher* dispatcher = CheckExceptionAndGetDispatcher(var, NULL);
246 if (!dispatcher) 246 if (!dispatcher)
247 return false; 247 return false;
248 248
249 PP_Bool result = PP_FALSE; 249 PP_Bool result = PP_FALSE;
250 int64 class_int = static_cast<int64>(reinterpret_cast<intptr_t>(ppp_class)); 250 int64 class_int = static_cast<int64>(reinterpret_cast<intptr_t>(ppp_class));
251 int64 class_data_int = 0; 251 int64 class_data_int = 0;
252 dispatcher->Send(new PpapiHostMsg_PPBVar_IsInstanceOfDeprecated( 252 dispatcher->Send(new PpapiHostMsg_PPBVar_IsInstanceOfDeprecated(
253 INTERFACE_ID_PPB_VAR_DEPRECATED, SerializedVarSendInput(dispatcher, var), 253 API_ID_PPB_VAR_DEPRECATED, SerializedVarSendInput(dispatcher, var),
254 class_int, &class_data_int, &result)); 254 class_int, &class_data_int, &result));
255 *ppp_class_data = 255 *ppp_class_data =
256 reinterpret_cast<void*>(static_cast<intptr_t>(class_data_int)); 256 reinterpret_cast<void*>(static_cast<intptr_t>(class_data_int));
257 return PP_ToBool(result); 257 return PP_ToBool(result);
258 } 258 }
259 259
260 PP_Var CreateObject(PP_Instance instance, 260 PP_Var CreateObject(PP_Instance instance,
261 const PPP_Class_Deprecated* ppp_class, 261 const PPP_Class_Deprecated* ppp_class,
262 void* ppp_class_data) { 262 void* ppp_class_data) {
263 Dispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); 263 Dispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
264 if (!dispatcher) 264 if (!dispatcher)
265 return PP_MakeUndefined(); 265 return PP_MakeUndefined();
266 266
267 ReceiveSerializedVarReturnValue result; 267 ReceiveSerializedVarReturnValue result;
268 int64 class_int = static_cast<int64>(reinterpret_cast<intptr_t>(ppp_class)); 268 int64 class_int = static_cast<int64>(reinterpret_cast<intptr_t>(ppp_class));
269 int64 data_int = 269 int64 data_int =
270 static_cast<int64>(reinterpret_cast<intptr_t>(ppp_class_data)); 270 static_cast<int64>(reinterpret_cast<intptr_t>(ppp_class_data));
271 dispatcher->Send(new PpapiHostMsg_PPBVar_CreateObjectDeprecated( 271 dispatcher->Send(new PpapiHostMsg_PPBVar_CreateObjectDeprecated(
272 INTERFACE_ID_PPB_VAR_DEPRECATED, instance, class_int, data_int, 272 API_ID_PPB_VAR_DEPRECATED, instance, class_int, data_int,
273 &result)); 273 &result));
274 return result.Return(dispatcher); 274 return result.Return(dispatcher);
275 } 275 }
276 276
277 const PPB_Var_Deprecated var_deprecated_interface = { 277 const PPB_Var_Deprecated var_deprecated_interface = {
278 &AddRefVar, 278 &AddRefVar,
279 &ReleaseVar, 279 &ReleaseVar,
280 &VarFromUtf8, 280 &VarFromUtf8,
281 &VarToUtf8, 281 &VarToUtf8,
282 &HasProperty, 282 &HasProperty,
(...skipping 26 matching lines...) Expand all
309 } 309 }
310 310
311 PPB_Var_Deprecated_Proxy::~PPB_Var_Deprecated_Proxy() { 311 PPB_Var_Deprecated_Proxy::~PPB_Var_Deprecated_Proxy() {
312 } 312 }
313 313
314 // static 314 // static
315 const InterfaceProxy::Info* PPB_Var_Deprecated_Proxy::GetInfo() { 315 const InterfaceProxy::Info* PPB_Var_Deprecated_Proxy::GetInfo() {
316 static const Info info = { 316 static const Info info = {
317 &var_deprecated_interface, 317 &var_deprecated_interface,
318 PPB_VAR_DEPRECATED_INTERFACE, 318 PPB_VAR_DEPRECATED_INTERFACE,
319 INTERFACE_ID_PPB_VAR_DEPRECATED, 319 API_ID_PPB_VAR_DEPRECATED,
320 false, 320 false,
321 &CreateVarDeprecatedProxy, 321 &CreateVarDeprecatedProxy,
322 }; 322 };
323 return &info; 323 return &info;
324 } 324 }
325 325
326 bool PPB_Var_Deprecated_Proxy::OnMessageReceived(const IPC::Message& msg) { 326 bool PPB_Var_Deprecated_Proxy::OnMessageReceived(const IPC::Message& msg) {
327 // Prevent the dispatcher from going away during a call to Call or other 327 // Prevent the dispatcher from going away during a call to Call or other
328 // function that could mutate the DOM. This must happen OUTSIDE of 328 // function that could mutate the DOM. This must happen OUTSIDE of
329 // the message handlers since the SerializedVars use the dispatcher upon 329 // the message handlers since the SerializedVars use the dispatcher upon
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 521
522 void PPB_Var_Deprecated_Proxy::DoReleaseObject(int64 object_id) { 522 void PPB_Var_Deprecated_Proxy::DoReleaseObject(int64 object_id) {
523 PP_Var var; 523 PP_Var var;
524 var.type = PP_VARTYPE_OBJECT; 524 var.type = PP_VARTYPE_OBJECT;
525 var.value.as_id = object_id; 525 var.value.as_id = object_id;
526 ppb_var_impl_->Release(var); 526 ppb_var_impl_->Release(var);
527 } 527 }
528 528
529 } // namespace proxy 529 } // namespace proxy
530 } // namespace ppapi 530 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_url_response_info_proxy.cc ('k') | ppapi/proxy/ppb_video_capture_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698