| OLD | NEW |
| 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 #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/proxy/var_serialization_rules.h" | 12 #include "ppapi/proxy/var_serialization_rules.h" |
| 13 | 13 |
| 14 struct PPB_Var; | |
| 15 | |
| 16 namespace ppapi { | 14 namespace ppapi { |
| 17 namespace proxy { | 15 namespace proxy { |
| 18 | 16 |
| 19 // Implementation of the VarSerializationRules interface for the host side. | 17 // Implementation of the VarSerializationRules interface for the host side. |
| 20 class HostVarSerializationRules : public VarSerializationRules { | 18 class HostVarSerializationRules : public VarSerializationRules { |
| 21 public: | 19 public: |
| 22 HostVarSerializationRules(const PPB_Var* var_interface, | 20 HostVarSerializationRules(PP_Module pp_module); |
| 23 PP_Module pp_module); | |
| 24 ~HostVarSerializationRules(); | 21 ~HostVarSerializationRules(); |
| 25 | 22 |
| 26 // VarSerialization implementation. | 23 // VarSerialization implementation. |
| 27 virtual PP_Var SendCallerOwned(const PP_Var& var, std::string* str_val); | 24 virtual PP_Var SendCallerOwned(const PP_Var& var, std::string* str_val); |
| 28 virtual PP_Var BeginReceiveCallerOwned(const PP_Var& var, | 25 virtual PP_Var BeginReceiveCallerOwned(const PP_Var& var, |
| 29 const std::string* str_val, | 26 const std::string* str_val, |
| 30 Dispatcher* dispatcher); | 27 Dispatcher* dispatcher); |
| 31 virtual void EndReceiveCallerOwned(const PP_Var& var); | 28 virtual void EndReceiveCallerOwned(const PP_Var& var); |
| 32 virtual PP_Var ReceivePassRef(const PP_Var& var, | 29 virtual PP_Var ReceivePassRef(const PP_Var& var, |
| 33 const std::string& str_val, | 30 const std::string& str_val, |
| 34 Dispatcher* dispatcher); | 31 Dispatcher* dispatcher); |
| 35 virtual PP_Var BeginSendPassRef(const PP_Var& var, std::string* str_val); | 32 virtual PP_Var BeginSendPassRef(const PP_Var& var, std::string* str_val); |
| 36 virtual void EndSendPassRef(const PP_Var& var, Dispatcher* dispatcher); | 33 virtual void EndSendPassRef(const PP_Var& var, Dispatcher* dispatcher); |
| 37 virtual void ReleaseObjectRef(const PP_Var& var); | 34 virtual void ReleaseObjectRef(const PP_Var& var); |
| 38 | 35 |
| 39 private: | 36 private: |
| 40 // Converts the given var (which must be a VARTYPE_STRING) to the given | 37 // Converts the given var (which must be a VARTYPE_STRING) to the given |
| 41 // string object. | 38 // string object. |
| 42 void VarToString(const PP_Var& var, std::string* str); | 39 void VarToString(const PP_Var& var, std::string* str); |
| 43 | 40 |
| 44 const PPB_Var* var_interface_; | |
| 45 PP_Module pp_module_; | 41 PP_Module pp_module_; |
| 46 | 42 |
| 47 DISALLOW_COPY_AND_ASSIGN(HostVarSerializationRules); | 43 DISALLOW_COPY_AND_ASSIGN(HostVarSerializationRules); |
| 48 }; | 44 }; |
| 49 | 45 |
| 50 } // namespace proxy | 46 } // namespace proxy |
| 51 } // namespace ppapi | 47 } // namespace ppapi |
| 52 | 48 |
| 53 #endif // PPAPI_PROXY_HOST_VAR_SERIALIZATION_RULES_H_ | 49 #endif // PPAPI_PROXY_HOST_VAR_SERIALIZATION_RULES_H_ |
| OLD | NEW |