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

Side by Side Diff: content/browser/browser_plugin/browser_plugin_message_filter.cc

Issue 444813002: Remove BrowserPlugin's -internal-attach method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't crash on tear down Created 6 years, 4 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
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/browser/browser_plugin/browser_plugin_message_filter.h" 5 #include "content/browser/browser_plugin/browser_plugin_message_filter.h"
6 6
7 #include "base/supports_user_data.h" 7 #include "base/supports_user_data.h"
8 #include "content/browser/browser_plugin/browser_plugin_guest.h" 8 #include "content/browser/browser_plugin/browser_plugin_guest.h"
9 #include "content/browser/gpu/gpu_process_host.h" 9 #include "content/browser/gpu/gpu_process_host.h"
10 #include "content/browser/web_contents/web_contents_impl.h" 10 #include "content/browser/web_contents/web_contents_impl.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 WebContents* guest_web_contents) { 63 WebContents* guest_web_contents) {
64 if (!guest_web_contents) 64 if (!guest_web_contents)
65 return; 65 return;
66 static_cast<WebContentsImpl*>(guest_web_contents)->GetBrowserPluginGuest()-> 66 static_cast<WebContentsImpl*>(guest_web_contents)->GetBrowserPluginGuest()->
67 OnMessageReceivedFromEmbedder(message); 67 OnMessageReceivedFromEmbedder(message);
68 } 68 }
69 69
70 void BrowserPluginMessageFilter::ForwardMessageToGuest( 70 void BrowserPluginMessageFilter::ForwardMessageToGuest(
71 const IPC::Message& message) { 71 const IPC::Message& message) {
72 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 72 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
73 RenderProcessHostImpl* host = static_cast<RenderProcessHostImpl*>( 73 RenderViewHost* rvh = RenderViewHost::FromID(render_process_id_,
74 RenderProcessHost::FromID(render_process_id_)); 74 message.routing_id());
75 if (!host) 75 if (!rvh)
76 return; 76 return;
77 77
78 int instance_id = 0; 78 WebContents* embedder_web_contents = WebContents::FromRenderViewHost(rvh);
79
80 int browser_plugin_instance_id = 0;
79 // All allowed messages must have instance_id as their first parameter. 81 // All allowed messages must have instance_id as their first parameter.
80 PickleIterator iter(message); 82 PickleIterator iter(message);
81 bool success = iter.ReadInt(&instance_id); 83 bool success = iter.ReadInt(&browser_plugin_instance_id);
82 DCHECK(success); 84 DCHECK(success);
83 host->GetBrowserContext()->GetGuestManager()-> 85 embedder_web_contents->GetBrowserContext()->GetGuestManager()->
84 MaybeGetGuestByInstanceIDOrKill( 86 MaybeGetGuestByInstanceIDOrKill(
85 instance_id, 87 embedder_web_contents,
86 render_process_id_, 88 browser_plugin_instance_id,
87 base::Bind(&BrowserPluginGuestMessageCallback, 89 base::Bind(&BrowserPluginGuestMessageCallback,
88 message)); 90 message));
89 } 91 }
90 92
91 void BrowserPluginMessageFilter::OnSwapBuffersACK( 93 void BrowserPluginMessageFilter::OnSwapBuffersACK(
92 const FrameHostMsg_BuffersSwappedACK_Params& params) { 94 const FrameHostMsg_BuffersSwappedACK_Params& params) {
93 GpuProcessHost* gpu_host = GpuProcessHost::FromID(params.gpu_host_id); 95 GpuProcessHost* gpu_host = GpuProcessHost::FromID(params.gpu_host_id);
94 if (!gpu_host) 96 if (!gpu_host)
95 return; 97 return;
96 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; 98 AcceleratedSurfaceMsg_BufferPresented_Params ack_params;
97 ack_params.mailbox = params.mailbox; 99 ack_params.mailbox = params.mailbox;
98 ack_params.sync_point = params.sync_point; 100 ack_params.sync_point = params.sync_point;
99 gpu_host->Send(new AcceleratedSurfaceMsg_BufferPresented(params.gpu_route_id, 101 gpu_host->Send(new AcceleratedSurfaceMsg_BufferPresented(params.gpu_route_id,
100 ack_params)); 102 ack_params));
101 } 103 }
102 104
103 } // namespace content 105 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_guest.cc ('k') | content/browser/frame_host/render_widget_host_view_guest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698