| 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 #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 "base/bind.h" |
| 9 #include "ppapi/c/pp_var.h" | 10 #include "ppapi/c/pp_var.h" |
| 10 #include "ppapi/c/ppb_core.h" | 11 #include "ppapi/c/ppb_core.h" |
| 11 #include "ppapi/c/ppb_fullscreen.h" | 12 #include "ppapi/c/ppb_fullscreen.h" |
| 12 #include "ppapi/c/ppp_instance.h" | 13 #include "ppapi/c/ppp_instance.h" |
| 13 #include "ppapi/c/private/ppb_flash_fullscreen.h" | 14 #include "ppapi/c/private/ppb_flash_fullscreen.h" |
| 14 #include "ppapi/proxy/host_dispatcher.h" | 15 #include "ppapi/proxy/host_dispatcher.h" |
| 15 #include "ppapi/proxy/plugin_dispatcher.h" | 16 #include "ppapi/proxy/plugin_dispatcher.h" |
| 16 #include "ppapi/proxy/plugin_resource_tracker.h" | 17 #include "ppapi/proxy/plugin_resource_tracker.h" |
| 17 #include "ppapi/proxy/ppapi_messages.h" | 18 #include "ppapi/proxy/ppapi_messages.h" |
| 18 #include "ppapi/proxy/ppb_url_loader_proxy.h" | 19 #include "ppapi/proxy/ppb_url_loader_proxy.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 if (dispatcher->IsPlugin()) { | 138 if (dispatcher->IsPlugin()) { |
| 138 // The PPP_Instance proxy works by always proxying the 1.1 version of the | 139 // The PPP_Instance proxy works by always proxying the 1.1 version of the |
| 139 // interface, and then detecting in the plugin process which one to use. | 140 // interface, and then detecting in the plugin process which one to use. |
| 140 // PPP_Instance_Combined handles dispatching to whatever interface is | 141 // PPP_Instance_Combined handles dispatching to whatever interface is |
| 141 // supported. | 142 // supported. |
| 142 // | 143 // |
| 143 // This means that if the plugin supports either 1.0 or 1.1 version of | 144 // This means that if the plugin supports either 1.0 or 1.1 version of |
| 144 // the interface, we want to say it supports the 1.1 version since we'll | 145 // the interface, we want to say it supports the 1.1 version since we'll |
| 145 // convert it here. This magic conversion code is hardcoded into | 146 // convert it here. This magic conversion code is hardcoded into |
| 146 // PluginDispatcher::OnMsgSupportsInterface. | 147 // PluginDispatcher::OnMsgSupportsInterface. |
| 147 const PPP_Instance* instance = static_cast<const PPP_Instance*>( | 148 combined_interface_.reset(PPP_Instance_Combined::Create( |
| 148 dispatcher->local_get_interface()(PPP_INSTANCE_INTERFACE)); | 149 base::Bind(dispatcher->local_get_interface()))); |
| 149 if (instance) { | |
| 150 combined_interface_.reset(new PPP_Instance_Combined(*instance)); | |
| 151 } else { | |
| 152 const PPP_Instance_1_0* instance_1_0 = | |
| 153 static_cast<const PPP_Instance_1_0*>( | |
| 154 dispatcher->local_get_interface()(PPP_INSTANCE_INTERFACE_1_0)); | |
| 155 combined_interface_.reset(new PPP_Instance_Combined(*instance_1_0)); | |
| 156 } | |
| 157 } | 150 } |
| 158 } | 151 } |
| 159 | 152 |
| 160 PPP_Instance_Proxy::~PPP_Instance_Proxy() { | 153 PPP_Instance_Proxy::~PPP_Instance_Proxy() { |
| 161 } | 154 } |
| 162 | 155 |
| 163 // static | 156 // static |
| 164 const PPP_Instance* PPP_Instance_Proxy::GetInstanceInterface() { | 157 const PPP_Instance* PPP_Instance_Proxy::GetInstanceInterface() { |
| 165 return &instance_interface; | 158 return &instance_interface; |
| 166 } | 159 } |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 // with. The plugin will normally take an additional reference which will keep | 257 // with. The plugin will normally take an additional reference which will keep |
| 265 // the resource alive in the plugin (and the one reference in the renderer | 258 // the resource alive in the plugin (and the one reference in the renderer |
| 266 // representing all plugin references). | 259 // representing all plugin references). |
| 267 // Once all references at the plugin side are released, the renderer side will | 260 // Once all references at the plugin side are released, the renderer side will |
| 268 // be notified and release the reference added in HandleDocumentLoad() above. | 261 // be notified and release the reference added in HandleDocumentLoad() above. |
| 269 PpapiGlobals::Get()->GetResourceTracker()->ReleaseResource(plugin_loader); | 262 PpapiGlobals::Get()->GetResourceTracker()->ReleaseResource(plugin_loader); |
| 270 } | 263 } |
| 271 | 264 |
| 272 } // namespace proxy | 265 } // namespace proxy |
| 273 } // namespace ppapi | 266 } // namespace ppapi |
| OLD | NEW |