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/ppp_instance_proxy.h" | 5 #include "ppapi/proxy/ppp_instance_proxy.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ppapi/c/dev/ppb_fullscreen_dev.h" | 9 #include "ppapi/c/dev/ppb_fullscreen_dev.h" |
10 #include "ppapi/c/pp_var.h" | 10 #include "ppapi/c/pp_var.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 *result = PP_FALSE; | 158 *result = PP_FALSE; |
159 if (argn.size() != argv.size()) | 159 if (argn.size() != argv.size()) |
160 return; | 160 return; |
161 | 161 |
162 // Set up the routing associating this new instance with the dispatcher we | 162 // Set up the routing associating this new instance with the dispatcher we |
163 // just got the message from. This must be done before calling into the | 163 // just got the message from. This must be done before calling into the |
164 // plugin so it can in turn call PPAPI functions. | 164 // plugin so it can in turn call PPAPI functions. |
165 PluginDispatcher* plugin_dispatcher = | 165 PluginDispatcher* plugin_dispatcher = |
166 static_cast<PluginDispatcher*>(dispatcher()); | 166 static_cast<PluginDispatcher*>(dispatcher()); |
167 plugin_dispatcher->DidCreateInstance(instance); | 167 plugin_dispatcher->DidCreateInstance(instance); |
| 168 ppapi::TrackerBase::Get()->GetResourceTracker()->DidCreateInstance(instance); |
168 | 169 |
169 // Make sure the arrays always have at least one element so we can take the | 170 // Make sure the arrays always have at least one element so we can take the |
170 // address below. | 171 // address below. |
171 std::vector<const char*> argn_array( | 172 std::vector<const char*> argn_array( |
172 std::max(static_cast<size_t>(1), argn.size())); | 173 std::max(static_cast<size_t>(1), argn.size())); |
173 std::vector<const char*> argv_array( | 174 std::vector<const char*> argv_array( |
174 std::max(static_cast<size_t>(1), argn.size())); | 175 std::max(static_cast<size_t>(1), argn.size())); |
175 for (size_t i = 0; i < argn.size(); i++) { | 176 for (size_t i = 0; i < argn.size(); i++) { |
176 argn_array[i] = argn[i].c_str(); | 177 argn_array[i] = argn[i].c_str(); |
177 argv_array[i] = argv[i].c_str(); | 178 argv_array[i] = argv[i].c_str(); |
178 } | 179 } |
179 | 180 |
180 DCHECK(combined_interface_.get()); | 181 DCHECK(combined_interface_.get()); |
181 *result = combined_interface_->DidCreate(instance, | 182 *result = combined_interface_->DidCreate(instance, |
182 static_cast<uint32_t>(argn.size()), | 183 static_cast<uint32_t>(argn.size()), |
183 &argn_array[0], &argv_array[0]); | 184 &argn_array[0], &argv_array[0]); |
184 } | 185 } |
185 | 186 |
186 void PPP_Instance_Proxy::OnMsgDidDestroy(PP_Instance instance) { | 187 void PPP_Instance_Proxy::OnMsgDidDestroy(PP_Instance instance) { |
187 combined_interface_->DidDestroy(instance); | 188 combined_interface_->DidDestroy(instance); |
| 189 ppapi::TrackerBase::Get()->GetResourceTracker()->DidDeleteInstance(instance); |
188 static_cast<PluginDispatcher*>(dispatcher())->DidDestroyInstance(instance); | 190 static_cast<PluginDispatcher*>(dispatcher())->DidDestroyInstance(instance); |
189 } | 191 } |
190 | 192 |
191 void PPP_Instance_Proxy::OnMsgDidChangeView(PP_Instance instance, | 193 void PPP_Instance_Proxy::OnMsgDidChangeView(PP_Instance instance, |
192 const PP_Rect& position, | 194 const PP_Rect& position, |
193 const PP_Rect& clip, | 195 const PP_Rect& clip, |
194 PP_Bool fullscreen) { | 196 PP_Bool fullscreen) { |
195 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); | 197 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); |
196 if (!dispatcher) | 198 if (!dispatcher) |
197 return; | 199 return; |
(...skipping 21 matching lines...) Expand all Loading... |
219 // with. The plugin will normally take an additional reference which will keep | 221 // with. The plugin will normally take an additional reference which will keep |
220 // the resource alive in the plugin (and the one reference in the renderer | 222 // the resource alive in the plugin (and the one reference in the renderer |
221 // representing all plugin references). | 223 // representing all plugin references). |
222 // Once all references at the plugin side are released, the renderer side will | 224 // Once all references at the plugin side are released, the renderer side will |
223 // be notified and release the reference added in HandleDocumentLoad() above. | 225 // be notified and release the reference added in HandleDocumentLoad() above. |
224 PluginResourceTracker::GetInstance()->ReleaseResource(plugin_loader); | 226 PluginResourceTracker::GetInstance()->ReleaseResource(plugin_loader); |
225 } | 227 } |
226 | 228 |
227 } // namespace proxy | 229 } // namespace proxy |
228 } // namespace pp | 230 } // namespace pp |
OLD | NEW |