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