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

Side by Side Diff: ppapi/proxy/serialized_var.h

Issue 6519057: Implement proxying for FileRef and FileChooser.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 10 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #ifndef PPAPI_PROXY_SERIALIZED_VAR_H_ 5 #ifndef PPAPI_PROXY_SERIALIZED_VAR_H_
6 #define PPAPI_PROXY_SERIALIZED_VAR_H_ 6 #define PPAPI_PROXY_SERIALIZED_VAR_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 // return result.Return(dispatcher()); 208 // return result.Return(dispatcher());
209 // } 209 // }
210 class ReceiveSerializedVarReturnValue : public SerializedVar { 210 class ReceiveSerializedVarReturnValue : public SerializedVar {
211 public: 211 public:
212 // Note that we can't set the dispatcher in the constructor because the 212 // Note that we can't set the dispatcher in the constructor because the
213 // data will be overridden when the return value is set. 213 // data will be overridden when the return value is set.
214 ReceiveSerializedVarReturnValue(); 214 ReceiveSerializedVarReturnValue();
215 215
216 PP_Var Return(Dispatcher* dispatcher); 216 PP_Var Return(Dispatcher* dispatcher);
217 217
218 // Helper function for code that doesn't use the pattern above, but gets
219 // a return value from the remote side via a struct. You can pass in the
220 // SerializedVar and a PP_Var will be created with return value semantics.
221 static PP_Var Convert(Dispatcher* dispatcher,
222 const SerializedVar& serialized);
223
218 private: 224 private:
219 DISALLOW_COPY_AND_ASSIGN(ReceiveSerializedVarReturnValue); 225 DISALLOW_COPY_AND_ASSIGN(ReceiveSerializedVarReturnValue);
220 }; 226 };
221 227
222 // Example for API: 228 // Example for API:
223 // "void MyFunction(PP_Var* exception);" 229 // "void MyFunction(PP_Var* exception);"
224 // IPC message: 230 // IPC message:
225 // IPC_SYNC_MESSAGE_ROUTED0_1(MyFunction, SerializedVar); 231 // IPC_SYNC_MESSAGE_ROUTED0_1(MyFunction, SerializedVar);
226 // Message handler would be: 232 // Message handler would be:
227 // void OnMsgMyFunction(PP_Var* exception) { 233 // void OnMsgMyFunction(PP_Var* exception) {
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 // } 354 // }
349 class SerializedVarReturnValue { 355 class SerializedVarReturnValue {
350 public: 356 public:
351 // We rely on the implicit constructor here since the IPC layer will call 357 // We rely on the implicit constructor here since the IPC layer will call
352 // us with a SerializedVar*. Pass this object by value, the copy constructor 358 // us with a SerializedVar*. Pass this object by value, the copy constructor
353 // will pass along the pointer (as cheap as passing a pointer arg). 359 // will pass along the pointer (as cheap as passing a pointer arg).
354 SerializedVarReturnValue(SerializedVar* serialized); 360 SerializedVarReturnValue(SerializedVar* serialized);
355 361
356 void Return(Dispatcher* dispatcher, const PP_Var& var); 362 void Return(Dispatcher* dispatcher, const PP_Var& var);
357 363
364 // Helper function for code that doesn't use the pattern above, but gets
365 // a return value from the remote side via a struct. You can pass in the
366 // SerializedVar and a PP_Var will be created with return value semantics.
367 static SerializedVar Convert(Dispatcher* dispatcher, const PP_Var& var);
368
358 private: 369 private:
359 SerializedVar* serialized_; 370 SerializedVar* serialized_;
360 }; 371 };
361 372
362 // For writing an out param to the remote side. 373 // For writing an out param to the remote side.
363 // 374 //
364 // Example for API: 375 // Example for API:
365 // "void MyFunction(PP_Var* out);" 376 // "void MyFunction(PP_Var* out);"
366 // IPC message: 377 // IPC message:
367 // IPC_SYNC_MESSAGE_ROUTED0_1(MyFunction, SerializedVar); 378 // IPC_SYNC_MESSAGE_ROUTED0_1(MyFunction, SerializedVar);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 PP_Var GetIncompleteVar() const { return inner_->GetIncompleteVar(); } 444 PP_Var GetIncompleteVar() const { return inner_->GetIncompleteVar(); }
434 445
435 const std::string& GetString() const { return inner_->GetString(); } 446 const std::string& GetString() const { return inner_->GetString(); }
436 }; 447 };
437 448
438 } // namespace proxy 449 } // namespace proxy
439 } // namespace pp 450 } // namespace pp
440 451
441 #endif // PPAPI_PROXY_SERIALIZED_VAR_H_ 452 #endif // PPAPI_PROXY_SERIALIZED_VAR_H_
442 453
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698