OLD | NEW |
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_VAR_SERIALIZATION_RULES_H_ | 5 #ifndef PPAPI_PROXY_VAR_SERIALIZATION_RULES_H_ |
6 #define PPAPI_PROXY_VAR_SERIALIZATION_RULES_H_ | 6 #define PPAPI_PROXY_VAR_SERIALIZATION_RULES_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "ppapi/c/pp_var.h" | 9 #include "ppapi/c/pp_var.h" |
10 | 10 |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 namespace ppapi { | 13 namespace ppapi { |
14 namespace proxy { | 14 namespace proxy { |
15 | 15 |
16 // Encapsulates the rules for serializing and deserializing vars to and from | 16 // Encapsulates the rules for serializing and deserializing vars to and from |
17 // the local process. The renderer and the plugin process each have separate | 17 // the local process. The renderer and the plugin process each have separate |
18 // bookkeeping rules. | 18 // bookkeeping rules. |
19 class VarSerializationRules : public base::RefCounted<VarSerializationRules> { | 19 class VarSerializationRules : public base::RefCounted<VarSerializationRules> { |
20 public: | 20 public: |
21 virtual ~VarSerializationRules() {} | |
22 | |
23 // Caller-owned calls -------------------------------------------------------- | 21 // Caller-owned calls -------------------------------------------------------- |
24 // | 22 // |
25 // A caller-owned call is when doing a function call with a "normal" input | 23 // A caller-owned call is when doing a function call with a "normal" input |
26 // argument. The caller has a reference to the var, and the caller is | 24 // argument. The caller has a reference to the var, and the caller is |
27 // responsible for freeing that reference. | 25 // responsible for freeing that reference. |
28 | 26 |
29 // Prepares the given var for sending to the remote process. For object vars, | 27 // Prepares the given var for sending to the remote process. For object vars, |
30 // the returned var will contain the id valid for the host process. | 28 // the returned var will contain the id valid for the host process. |
31 // Otherwise, the returned var is valid in the local process. | 29 // Otherwise, the returned var is valid in the local process. |
32 virtual PP_Var SendCallerOwned(const PP_Var& var) = 0; | 30 virtual PP_Var SendCallerOwned(const PP_Var& var) = 0; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 // local process. This same var must be passed to EndSendPassRef. | 70 // local process. This same var must be passed to EndSendPassRef. |
73 virtual PP_Var BeginSendPassRef(const PP_Var& var) = 0; | 71 virtual PP_Var BeginSendPassRef(const PP_Var& var) = 0; |
74 virtual void EndSendPassRef(const PP_Var& var) = 0; | 72 virtual void EndSendPassRef(const PP_Var& var) = 0; |
75 | 73 |
76 // --------------------------------------------------------------------------- | 74 // --------------------------------------------------------------------------- |
77 | 75 |
78 virtual void ReleaseObjectRef(const PP_Var& var) = 0; | 76 virtual void ReleaseObjectRef(const PP_Var& var) = 0; |
79 | 77 |
80 protected: | 78 protected: |
81 VarSerializationRules() {} | 79 VarSerializationRules() {} |
| 80 virtual ~VarSerializationRules() {} |
| 81 |
| 82 private: |
| 83 friend class base::RefCounted<VarSerializationRules>; |
82 }; | 84 }; |
83 | 85 |
84 } // namespace proxy | 86 } // namespace proxy |
85 } // namespace ppapi | 87 } // namespace ppapi |
86 | 88 |
87 #endif // PPAPI_PROXY_VAR_SERIALIZATION_RULES_H_ | 89 #endif // PPAPI_PROXY_VAR_SERIALIZATION_RULES_H_ |
OLD | NEW |