| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/renderer_host/video_layer_proxy.h" | |
| 6 | |
| 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" | |
| 10 #include "gfx/rect.h" | |
| 11 | |
| 12 VideoLayerProxy::VideoLayerProxy(RenderWidgetHost* widget, | |
| 13 const gfx::Size& size, | |
| 14 GpuProcessHostUIShim* process_shim, | |
| 15 int32 routing_id) | |
| 16 : VideoLayer(widget, size), | |
| 17 process_shim_(process_shim), | |
| 18 routing_id_(routing_id) { | |
| 19 process_shim_->AddRoute(routing_id_, this); | |
| 20 } | |
| 21 | |
| 22 VideoLayerProxy::~VideoLayerProxy() { | |
| 23 process_shim_->RemoveRoute(routing_id_); | |
| 24 } | |
| 25 | |
| 26 void VideoLayerProxy::CopyTransportDIB(RenderProcessHost* process, | |
| 27 TransportDIB::Id bitmap, | |
| 28 const gfx::Rect& bitmap_rect) { | |
| 29 base::ProcessId process_id; | |
| 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( | |
| 37 routing_id_, process_id, bitmap, bitmap_rect))) { | |
| 38 } else { | |
| 39 // TODO(scherkus): what to do ?!?! | |
| 40 } | |
| 41 } | |
| 42 | |
| 43 void VideoLayerProxy::OnMessageReceived(const IPC::Message& msg) { | |
| 44 IPC_BEGIN_MESSAGE_MAP(VideoLayerProxy, msg) | |
| 45 IPC_MESSAGE_HANDLER(GpuHostMsg_PaintToVideoLayer_ACK, | |
| 46 OnPaintToVideoLayerACK) | |
| 47 IPC_END_MESSAGE_MAP_EX() | |
| 48 } | |
| 49 | |
| 50 void VideoLayerProxy::OnChannelConnected(int32 peer_pid) { | |
| 51 } | |
| 52 | |
| 53 void VideoLayerProxy::OnChannelError() { | |
| 54 } | |
| 55 | |
| 56 void VideoLayerProxy::OnPaintToVideoLayerACK() { | |
| 57 // TODO(scherkus): we may not need to ACK video layer updates at all. | |
| 58 NOTIMPLEMENTED(); | |
| 59 } | |
| OLD | NEW |