OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/renderer_host/video_layer_proxy.h" | 5 #include "chrome/browser/renderer_host/video_layer_proxy.h" |
6 | 6 |
7 #include "chrome/browser/gpu_process_host.h" | 7 #include "chrome/browser/gpu_process_host_ui_shim.h" |
8 #include "chrome/browser/renderer_host/render_process_host.h" | 8 #include "chrome/browser/renderer_host/render_process_host.h" |
9 #include "chrome/common/gpu_messages.h" | 9 #include "chrome/common/gpu_messages.h" |
10 #include "gfx/rect.h" | 10 #include "gfx/rect.h" |
11 | 11 |
12 VideoLayerProxy::VideoLayerProxy(RenderWidgetHost* widget, | 12 VideoLayerProxy::VideoLayerProxy(RenderWidgetHost* widget, |
13 const gfx::Size& size, | 13 const gfx::Size& size, |
14 GpuProcessHost* process, | 14 GpuProcessHostUIShim* process_shim, |
15 int32 routing_id) | 15 int32 routing_id) |
16 : VideoLayer(widget, size), | 16 : VideoLayer(widget, size), |
17 process_(process), | 17 process_shim_(process_shim), |
18 routing_id_(routing_id) { | 18 routing_id_(routing_id) { |
19 process_->AddRoute(routing_id_, this); | 19 process_shim_->AddRoute(routing_id_, this); |
20 } | 20 } |
21 | 21 |
22 VideoLayerProxy::~VideoLayerProxy() { | 22 VideoLayerProxy::~VideoLayerProxy() { |
23 process_->RemoveRoute(routing_id_); | 23 process_shim_->RemoveRoute(routing_id_); |
24 } | 24 } |
25 | 25 |
26 void VideoLayerProxy::CopyTransportDIB(RenderProcessHost* process, | 26 void VideoLayerProxy::CopyTransportDIB(RenderProcessHost* process, |
27 TransportDIB::Id bitmap, | 27 TransportDIB::Id bitmap, |
28 const gfx::Rect& bitmap_rect) { | 28 const gfx::Rect& bitmap_rect) { |
29 base::ProcessId process_id; | 29 base::ProcessId process_id; |
30 #if defined(OS_WIN) | 30 #if defined(OS_WIN) |
31 process_id = ::GetProcessId(process->GetHandle()); | 31 process_id = ::GetProcessId(process->GetHandle()); |
32 #elif defined(OS_POSIX) | 32 #elif defined(OS_POSIX) |
33 process_id = process->GetHandle(); | 33 process_id = process->GetHandle(); |
34 #endif | 34 #endif |
35 | 35 |
36 if (process_->Send(new GpuMsg_PaintToVideoLayer( | 36 if (process_shim_->Send(new GpuMsg_PaintToVideoLayer( |
37 routing_id_, process_id, bitmap, bitmap_rect))) { | 37 routing_id_, process_id, bitmap, bitmap_rect))) { |
38 } else { | 38 } else { |
39 // TODO(scherkus): what to do ?!?! | 39 // TODO(scherkus): what to do ?!?! |
40 } | 40 } |
41 } | 41 } |
42 | 42 |
43 void VideoLayerProxy::OnMessageReceived(const IPC::Message& msg) { | 43 void VideoLayerProxy::OnMessageReceived(const IPC::Message& msg) { |
44 IPC_BEGIN_MESSAGE_MAP(VideoLayerProxy, msg) | 44 IPC_BEGIN_MESSAGE_MAP(VideoLayerProxy, msg) |
45 IPC_MESSAGE_HANDLER(GpuHostMsg_PaintToVideoLayer_ACK, | 45 IPC_MESSAGE_HANDLER(GpuHostMsg_PaintToVideoLayer_ACK, |
46 OnPaintToVideoLayerACK) | 46 OnPaintToVideoLayerACK) |
47 IPC_END_MESSAGE_MAP_EX() | 47 IPC_END_MESSAGE_MAP_EX() |
48 } | 48 } |
49 | 49 |
50 void VideoLayerProxy::OnChannelConnected(int32 peer_pid) { | 50 void VideoLayerProxy::OnChannelConnected(int32 peer_pid) { |
51 } | 51 } |
52 | 52 |
53 void VideoLayerProxy::OnChannelError() { | 53 void VideoLayerProxy::OnChannelError() { |
54 } | 54 } |
55 | 55 |
56 void VideoLayerProxy::OnPaintToVideoLayerACK() { | 56 void VideoLayerProxy::OnPaintToVideoLayerACK() { |
57 // TODO(scherkus): we may not need to ACK video layer updates at all. | 57 // TODO(scherkus): we may not need to ACK video layer updates at all. |
58 NOTIMPLEMENTED(); | 58 NOTIMPLEMENTED(); |
59 } | 59 } |
OLD | NEW |