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 #include "ppapi/proxy/plugin_var_serialization_rules.h" | 5 #include "ppapi/proxy/plugin_var_serialization_rules.h" |
6 | 6 |
7 #include "ppapi/proxy/plugin_dispatcher.h" | 7 #include "ppapi/proxy/plugin_dispatcher.h" |
8 #include "ppapi/proxy/plugin_var_tracker.h" | 8 #include "ppapi/proxy/plugin_var_tracker.h" |
9 | 9 |
10 namespace pp { | 10 namespace pp { |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 111 |
112 // Objects need special translations to get the IDs valid in the host. | 112 // Objects need special translations to get the IDs valid in the host. |
113 if (var.type == PP_VARTYPE_OBJECT) | 113 if (var.type == PP_VARTYPE_OBJECT) |
114 return var_tracker_->GetHostObject(var); | 114 return var_tracker_->GetHostObject(var); |
115 | 115 |
116 if (var.type == PP_VARTYPE_STRING) | 116 if (var.type == PP_VARTYPE_STRING) |
117 *str_val = var_tracker_->GetString(var); | 117 *str_val = var_tracker_->GetString(var); |
118 return var; | 118 return var; |
119 } | 119 } |
120 | 120 |
121 void PluginVarSerializationRules::EndSendPassRef(const PP_Var& var) { | 121 void PluginVarSerializationRules::EndSendPassRef(const PP_Var& var, |
| 122 Dispatcher* dispatcher) { |
122 // See BeginSendPassRef for an example of why we release our ref here. | 123 // See BeginSendPassRef for an example of why we release our ref here. |
| 124 // The var we have in our inner class has been converted to a host object |
| 125 // by BeginSendPassRef. This means it's not a normal var valid in the plugin, |
| 126 // so we need to use the special ReleaseHostObject. |
123 if (var.type == PP_VARTYPE_OBJECT) | 127 if (var.type == PP_VARTYPE_OBJECT) |
124 var_tracker_->Release(var); | 128 var_tracker_->ReleaseHostObject(dispatcher, var); |
125 } | 129 } |
126 | 130 |
127 void PluginVarSerializationRules::ReleaseObjectRef(const PP_Var& var) { | 131 void PluginVarSerializationRules::ReleaseObjectRef(const PP_Var& var) { |
128 var_tracker_->Release(var); | 132 var_tracker_->Release(var); |
129 } | 133 } |
130 | 134 |
131 } // namespace proxy | 135 } // namespace proxy |
132 } // namespace pp | 136 } // namespace pp |
OLD | NEW |