| 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 "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" |
| 11 #include "content/common/browser_plugin/browser_plugin_constants.h" | 11 #include "content/common/browser_plugin/browser_plugin_constants.h" |
| 12 #include "content/common/browser_plugin/browser_plugin_messages.h" | 12 #include "content/common/browser_plugin/browser_plugin_messages.h" |
| 13 #include "content/common/gpu/gpu_messages.h" | 13 #include "content/common/gpu/gpu_messages.h" |
| 14 #include "content/common/view_messages.h" | 14 #include "content/common/view_messages.h" |
| 15 #include "content/public/browser/browser_context.h" | 15 #include "content/public/browser/browser_context.h" |
| 16 #include "content/public/browser/browser_plugin_guest_manager_delegate.h" | 16 #include "content/public/browser/browser_plugin_guest_manager.h" |
| 17 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
| 18 #include "content/public/browser/render_view_host.h" | 18 #include "content/public/browser/render_view_host.h" |
| 19 | 19 |
| 20 namespace content { | 20 namespace content { |
| 21 | 21 |
| 22 BrowserPluginMessageFilter::BrowserPluginMessageFilter(int render_process_id, | 22 BrowserPluginMessageFilter::BrowserPluginMessageFilter(int render_process_id, |
| 23 bool is_guest) | 23 bool is_guest) |
| 24 : BrowserMessageFilter(BrowserPluginMsgStart), | 24 : BrowserMessageFilter(BrowserPluginMsgStart), |
| 25 render_process_id_(render_process_id), | 25 render_process_id_(render_process_id), |
| 26 is_guest_(is_guest) { | 26 is_guest_(is_guest) { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 RenderProcessHostImpl* host = static_cast<RenderProcessHostImpl*>( | 76 RenderProcessHostImpl* host = static_cast<RenderProcessHostImpl*>( |
| 77 RenderProcessHost::FromID(render_process_id_)); | 77 RenderProcessHost::FromID(render_process_id_)); |
| 78 if (!host) | 78 if (!host) |
| 79 return; | 79 return; |
| 80 | 80 |
| 81 int instance_id = 0; | 81 int instance_id = 0; |
| 82 // All allowed messages must have instance_id as their first parameter. | 82 // All allowed messages must have instance_id as their first parameter. |
| 83 PickleIterator iter(message); | 83 PickleIterator iter(message); |
| 84 bool success = iter.ReadInt(&instance_id); | 84 bool success = iter.ReadInt(&instance_id); |
| 85 DCHECK(success); | 85 DCHECK(success); |
| 86 host->GetBrowserContext()->GetGuestManagerDelegate()-> | 86 host->GetBrowserContext()->GetGuestManager()-> |
| 87 MaybeGetGuestByInstanceIDOrKill( | 87 MaybeGetGuestByInstanceIDOrKill( |
| 88 instance_id, | 88 instance_id, |
| 89 render_process_id_, | 89 render_process_id_, |
| 90 base::Bind(&BrowserPluginGuestMessageCallback, | 90 base::Bind(&BrowserPluginGuestMessageCallback, |
| 91 message)); | 91 message)); |
| 92 } | 92 } |
| 93 | 93 |
| 94 void BrowserPluginMessageFilter::OnSwapBuffersACK( | 94 void BrowserPluginMessageFilter::OnSwapBuffersACK( |
| 95 const FrameHostMsg_BuffersSwappedACK_Params& params) { | 95 const FrameHostMsg_BuffersSwappedACK_Params& params) { |
| 96 GpuProcessHost* gpu_host = GpuProcessHost::FromID(params.gpu_host_id); | 96 GpuProcessHost* gpu_host = GpuProcessHost::FromID(params.gpu_host_id); |
| 97 if (!gpu_host) | 97 if (!gpu_host) |
| 98 return; | 98 return; |
| 99 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; | 99 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; |
| 100 ack_params.mailbox = params.mailbox; | 100 ack_params.mailbox = params.mailbox; |
| 101 ack_params.sync_point = params.sync_point; | 101 ack_params.sync_point = params.sync_point; |
| 102 gpu_host->Send(new AcceleratedSurfaceMsg_BufferPresented(params.gpu_route_id, | 102 gpu_host->Send(new AcceleratedSurfaceMsg_BufferPresented(params.gpu_route_id, |
| 103 ack_params)); | 103 ack_params)); |
| 104 } | 104 } |
| 105 | 105 |
| 106 } // namespace content | 106 } // namespace content |
| OLD | NEW |