Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: content/renderer/pepper/pepper_plugin_delegate_impl.cc

Issue 10949008: Fix up instance registration with the browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix browser tag test Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | content/renderer/pepper/renderer_ppapi_host_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "content/renderer/pepper/pepper_plugin_delegate_impl.h" 5 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <cstddef> 8 #include <cstddef>
9 #include <map> 9 #include <map>
10 #include <queue> 10 #include <queue>
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 // This class wraps a dispatcher and has the same lifetime. A dispatcher has 105 // This class wraps a dispatcher and has the same lifetime. A dispatcher has
106 // the same lifetime as a plugin module, which is longer than any particular 106 // the same lifetime as a plugin module, which is longer than any particular
107 // RenderView or plugin instance. 107 // RenderView or plugin instance.
108 class HostDispatcherWrapper 108 class HostDispatcherWrapper
109 : public webkit::ppapi::PluginDelegate::OutOfProcessProxy { 109 : public webkit::ppapi::PluginDelegate::OutOfProcessProxy {
110 public: 110 public:
111 HostDispatcherWrapper(webkit::ppapi::PluginModule* module, 111 HostDispatcherWrapper(webkit::ppapi::PluginModule* module,
112 int plugin_child_id, 112 int plugin_child_id,
113 const ppapi::PpapiPermissions& perms) 113 const ppapi::PpapiPermissions& perms)
114 : module_(module), 114 : module_(module),
115 /*TODO(brettw) bug 149850 put this back. 115 plugin_child_id_(plugin_child_id),
116 plugin_child_id_(plugin_child_id),*/
117 permissions_(perms) { 116 permissions_(perms) {
118 } 117 }
119 virtual ~HostDispatcherWrapper() {} 118 virtual ~HostDispatcherWrapper() {}
120 119
121 bool Init(const IPC::ChannelHandle& channel_handle, 120 bool Init(const IPC::ChannelHandle& channel_handle,
122 PP_GetInterface_Func local_get_interface, 121 PP_GetInterface_Func local_get_interface,
123 const ppapi::Preferences& preferences, 122 const ppapi::Preferences& preferences,
124 const ppapi::PpapiPermissions& permissions, 123 const ppapi::PpapiPermissions& permissions,
125 PepperHungPluginFilter* filter) { 124 PepperHungPluginFilter* filter) {
126 if (channel_handle.name.empty()) 125 if (channel_handle.name.empty())
(...skipping 22 matching lines...) Expand all
149 return true; 148 return true;
150 } 149 }
151 150
152 // OutOfProcessProxy implementation. 151 // OutOfProcessProxy implementation.
153 virtual const void* GetProxiedInterface(const char* name) { 152 virtual const void* GetProxiedInterface(const char* name) {
154 return dispatcher_->GetProxiedInterface(name); 153 return dispatcher_->GetProxiedInterface(name);
155 } 154 }
156 virtual void AddInstance(PP_Instance instance) { 155 virtual void AddInstance(PP_Instance instance) {
157 ppapi::proxy::HostDispatcher::SetForInstance(instance, dispatcher_.get()); 156 ppapi::proxy::HostDispatcher::SetForInstance(instance, dispatcher_.get());
158 157
159 /* TODO(brettw) bug 149850 put this back with crash fix. 158 RendererPpapiHostImpl* host =
160 render_view_->Send(new ViewHostMsg_DidCreateOutOfProcessPepperInstance( 159 RendererPpapiHostImpl::GetForPPInstance(instance);
161 plugin_child_id_, 160 // TODO(brettw) remove this null check when the old-style pepper-based
162 instance, 161 // browser tag is removed from this file. Getting this notification should
163 render_view_->routing_id())); 162 // always give us an instance we can find in the map otherwise, but that
164 */ 163 // isn't true for browser tag support.
164 if (host) {
165 RenderView* render_view = host->GetRenderViewForInstance(instance);
166 render_view->Send(new ViewHostMsg_DidCreateOutOfProcessPepperInstance(
167 plugin_child_id_,
168 instance,
169 render_view->GetRoutingID()));
170 }
165 } 171 }
166 virtual void RemoveInstance(PP_Instance instance) { 172 virtual void RemoveInstance(PP_Instance instance) {
167 ppapi::proxy::HostDispatcher::RemoveForInstance(instance); 173 ppapi::proxy::HostDispatcher::RemoveForInstance(instance);
168 174
169 /* TODO(brettw) bug 149850 put this back with crash fix. 175 RendererPpapiHostImpl* host =
170 render_view_->Send(new ViewHostMsg_DidDeleteOutOfProcessPepperInstance( 176 RendererPpapiHostImpl::GetForPPInstance(instance);
171 plugin_child_id_, 177 // TODO(brettw) remove null check as described in AddInstance.
172 instance)); 178 if (host) {
173 */ 179 RenderView* render_view = host->GetRenderViewForInstance(instance);
180 render_view->Send(new ViewHostMsg_DidDeleteOutOfProcessPepperInstance(
181 plugin_child_id_,
182 instance));
183 }
174 } 184 }
175 185
176 ppapi::proxy::HostDispatcher* dispatcher() { return dispatcher_.get(); } 186 ppapi::proxy::HostDispatcher* dispatcher() { return dispatcher_.get(); }
177 187
178 private: 188 private:
179 webkit::ppapi::PluginModule* module_; 189 webkit::ppapi::PluginModule* module_;
180 190
181 // ID that the browser process uses to idetify the child process for the 191 // ID that the browser process uses to idetify the child process for the
182 // plugin. This isn't directly useful from our process (the renderer) except 192 // plugin. This isn't directly useful from our process (the renderer) except
183 // in messages to the browser to disambiguate plugins. 193 // in messages to the browser to disambiguate plugins.
184 // TODO(brettw) bug 149850 put this back with crash fix. 194 int plugin_child_id_;
185 //int plugin_child_id_;
186 195
187 ppapi::PpapiPermissions permissions_; 196 ppapi::PpapiPermissions permissions_;
188 197
189 scoped_ptr<ppapi::proxy::HostDispatcher> dispatcher_; 198 scoped_ptr<ppapi::proxy::HostDispatcher> dispatcher_;
190 scoped_ptr<ppapi::proxy::ProxyChannel::Delegate> dispatcher_delegate_; 199 scoped_ptr<ppapi::proxy::ProxyChannel::Delegate> dispatcher_delegate_;
191 }; 200 };
192 201
193 class QuotaCallbackTranslator : public QuotaDispatcher::Callback { 202 class QuotaCallbackTranslator : public QuotaDispatcher::Callback {
194 public: 203 public:
195 typedef webkit::ppapi::PluginDelegate::AvailableSpaceCallback PluginCallback; 204 typedef webkit::ppapi::PluginDelegate::AvailableSpaceCallback PluginCallback;
(...skipping 1667 matching lines...) Expand 10 before | Expand all | Expand 10 after
1863 else 1872 else
1864 return render_view_->mouse_lock_dispatcher(); 1873 return render_view_->mouse_lock_dispatcher();
1865 } 1874 }
1866 1875
1867 webkit_glue::ClipboardClient* 1876 webkit_glue::ClipboardClient*
1868 PepperPluginDelegateImpl::CreateClipboardClient() const { 1877 PepperPluginDelegateImpl::CreateClipboardClient() const {
1869 return new RendererClipboardClient; 1878 return new RendererClipboardClient;
1870 } 1879 }
1871 1880
1872 } // namespace content 1881 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/pepper/renderer_ppapi_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698