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

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

Issue 9138027: PPAPI: Reduce string copying in SerializedVar. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Duh Created 8 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
« no previous file with comments | « no previous file | ppapi/proxy/host_var_serialization_rules.cc » ('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) 2012 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 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_HOST_VAR_SERIALIZATION_RULES_H_ 5 #ifndef PPAPI_PROXY_HOST_VAR_SERIALIZATION_RULES_H_
6 #define PPAPI_PROXY_HOST_VAR_SERIALIZATION_RULES_H_ 6 #define PPAPI_PROXY_HOST_VAR_SERIALIZATION_RULES_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "ppapi/c/pp_module.h" 11 #include "ppapi/c/pp_module.h"
12 #include "ppapi/c/ppb_var.h" 12 #include "ppapi/c/ppb_var.h"
13 #include "ppapi/proxy/var_serialization_rules.h" 13 #include "ppapi/proxy/var_serialization_rules.h"
14 14
15 namespace ppapi { 15 namespace ppapi {
16 namespace proxy { 16 namespace proxy {
17 17
18 // Implementation of the VarSerializationRules interface for the host side. 18 // Implementation of the VarSerializationRules interface for the host side.
19 class HostVarSerializationRules : public VarSerializationRules { 19 class HostVarSerializationRules : public VarSerializationRules {
20 public: 20 public:
21 HostVarSerializationRules(PP_Module pp_module); 21 HostVarSerializationRules(PP_Module pp_module);
22 ~HostVarSerializationRules(); 22 ~HostVarSerializationRules();
23 23
24 // VarSerialization implementation. 24 // VarSerialization implementation.
25 virtual PP_Var SendCallerOwned(const PP_Var& var, std::string* str_val); 25 virtual PP_Var SendCallerOwned(const PP_Var& var,
26 const std::string** str_ptr_out);
26 virtual PP_Var BeginReceiveCallerOwned(const PP_Var& var, 27 virtual PP_Var BeginReceiveCallerOwned(const PP_Var& var,
27 const std::string* str_val, 28 scoped_ptr<std::string> str,
28 Dispatcher* dispatcher); 29 Dispatcher* dispatcher);
29 virtual void EndReceiveCallerOwned(const PP_Var& var); 30 virtual void EndReceiveCallerOwned(const PP_Var& var);
30 virtual PP_Var ReceivePassRef(const PP_Var& var, 31 virtual PP_Var ReceivePassRef(const PP_Var& var,
31 const std::string& str_val, 32 scoped_ptr<std::string> str,
32 Dispatcher* dispatcher); 33 Dispatcher* dispatcher);
33 virtual PP_Var BeginSendPassRef(const PP_Var& var, std::string* str_val); 34 virtual PP_Var BeginSendPassRef(const PP_Var& var,
35 const std::string** str_ptr_out);
34 virtual void EndSendPassRef(const PP_Var& var, Dispatcher* dispatcher); 36 virtual void EndSendPassRef(const PP_Var& var, Dispatcher* dispatcher);
35 virtual void ReleaseObjectRef(const PP_Var& var); 37 virtual void ReleaseObjectRef(const PP_Var& var);
36 38
37 private: 39 private:
38 // Converts the given var (which must be a VARTYPE_STRING) to the given 40 // Converts the given var (which must be a VARTYPE_STRING) to the given
39 // string object. 41 // string object.
40 void VarToString(const PP_Var& var, std::string* str); 42 void VarToStringPtr(const PP_Var& var, const std::string** str);
41 43
42 PP_Module pp_module_; 44 PP_Module pp_module_;
43 45
44 DISALLOW_COPY_AND_ASSIGN(HostVarSerializationRules); 46 DISALLOW_COPY_AND_ASSIGN(HostVarSerializationRules);
45 }; 47 };
46 48
47 } // namespace proxy 49 } // namespace proxy
48 } // namespace ppapi 50 } // namespace ppapi
49 51
50 #endif // PPAPI_PROXY_HOST_VAR_SERIALIZATION_RULES_H_ 52 #endif // PPAPI_PROXY_HOST_VAR_SERIALIZATION_RULES_H_
OLDNEW
« no previous file with comments | « no previous file | ppapi/proxy/host_var_serialization_rules.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698