OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // This file is used to define IPC::ParamTraits<> specializations for a number | 5 // This file is used to define IPC::ParamTraits<> specializations for a number |
6 // of types so that they can be serialized over IPC. IPC::ParamTraits<> | 6 // of types so that they can be serialized over IPC. IPC::ParamTraits<> |
7 // specializations for basic types (like int and std::string) and types in the | 7 // specializations for basic types (like int and std::string) and types in the |
8 // 'base' project can be found in ipc/ipc_message_utils.h. This file contains | 8 // 'base' project can be found in ipc/ipc_message_utils.h. This file contains |
9 // specializations for types that are used by the content code, and which need | 9 // specializations for types that are used by the content code, and which need |
10 // manual serialization code. This is usually because they're not structs with | 10 // manual serialization code. This is usually because they're not structs with |
(...skipping 13 matching lines...) Expand all Loading... |
24 // Define the NPVariant_Param struct and its enum here since it needs manual | 24 // Define the NPVariant_Param struct and its enum here since it needs manual |
25 // serialization code. | 25 // serialization code. |
26 enum NPVariant_ParamEnum { | 26 enum NPVariant_ParamEnum { |
27 NPVARIANT_PARAM_VOID, | 27 NPVARIANT_PARAM_VOID, |
28 NPVARIANT_PARAM_NULL, | 28 NPVARIANT_PARAM_NULL, |
29 NPVARIANT_PARAM_BOOL, | 29 NPVARIANT_PARAM_BOOL, |
30 NPVARIANT_PARAM_INT, | 30 NPVARIANT_PARAM_INT, |
31 NPVARIANT_PARAM_DOUBLE, | 31 NPVARIANT_PARAM_DOUBLE, |
32 NPVARIANT_PARAM_STRING, | 32 NPVARIANT_PARAM_STRING, |
33 // Used when when the NPObject is running in the caller's process, so we | 33 // Used when when the NPObject is running in the caller's process, so we |
34 // create an NPObjectProxy in the other process. | 34 // create an NPObjectProxy in the other process. To support object ownership |
| 35 // tracking the routing-Id of the NPObject's owning plugin instance is |
| 36 // passed alongside that of the object itself. |
35 NPVARIANT_PARAM_SENDER_OBJECT_ROUTING_ID, | 37 NPVARIANT_PARAM_SENDER_OBJECT_ROUTING_ID, |
36 // Used when the NPObject we're sending is running in the callee's process | 38 // Used when the NPObject we're sending is running in the callee's process |
37 // (i.e. we have an NPObjectProxy for it). In that case we want the callee | 39 // (i.e. we have an NPObjectProxy for it). In that case we want the callee |
38 // to just use the raw pointer. | 40 // to just use the raw pointer. |
39 NPVARIANT_PARAM_RECEIVER_OBJECT_ROUTING_ID, | 41 NPVARIANT_PARAM_RECEIVER_OBJECT_ROUTING_ID, |
40 }; | 42 }; |
41 | 43 |
42 struct NPVariant_Param { | 44 struct NPVariant_Param { |
43 NPVariant_Param(); | 45 NPVariant_Param(); |
44 ~NPVariant_Param(); | 46 ~NPVariant_Param(); |
45 | 47 |
46 NPVariant_ParamEnum type; | 48 NPVariant_ParamEnum type; |
47 bool bool_value; | 49 bool bool_value; |
48 int int_value; | 50 int int_value; |
49 double double_value; | 51 double double_value; |
50 std::string string_value; | 52 std::string string_value; |
51 int npobject_routing_id; | 53 int npobject_routing_id; |
| 54 int npobject_owner_id; |
52 }; | 55 }; |
53 | 56 |
54 struct NPIdentifier_Param { | 57 struct NPIdentifier_Param { |
55 NPIdentifier_Param(); | 58 NPIdentifier_Param(); |
56 ~NPIdentifier_Param(); | 59 ~NPIdentifier_Param(); |
57 | 60 |
58 NPIdentifier identifier; | 61 NPIdentifier identifier; |
59 }; | 62 }; |
60 | 63 |
61 } // namespace content | 64 } // namespace content |
(...skipping 12 matching lines...) Expand all Loading... |
74 struct ParamTraits<content::NPIdentifier_Param> { | 77 struct ParamTraits<content::NPIdentifier_Param> { |
75 typedef content::NPIdentifier_Param param_type; | 78 typedef content::NPIdentifier_Param param_type; |
76 static void Write(Message* m, const param_type& p); | 79 static void Write(Message* m, const param_type& p); |
77 static bool Read(const Message* m, PickleIterator* iter, param_type* r); | 80 static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
78 static void Log(const param_type& p, std::string* l); | 81 static void Log(const param_type& p, std::string* l); |
79 }; | 82 }; |
80 | 83 |
81 } // namespace IPC | 84 } // namespace IPC |
82 | 85 |
83 #endif // CONTENT_CHILD_PLUGIN_PARAM_TRAITS_H_ | 86 #endif // CONTENT_CHILD_PLUGIN_PARAM_TRAITS_H_ |
OLD | NEW |