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/gpu_view_host.h" | |
6 | |
7 #include "chrome/browser/gpu_process_host_ui_shim.h" | |
8 #include "chrome/browser/renderer_host/backing_store_proxy.h" | |
9 #include "chrome/browser/renderer_host/video_layer_proxy.h" | |
10 #include "chrome/common/gpu_messages.h" | |
11 | |
12 GpuViewHost::GpuViewHost(RenderWidgetHost* widget, GpuNativeWindowHandle parent) | |
13 : widget_(widget), | |
14 process_shim_(GpuProcessHostUIShim::Get()), | |
15 routing_id_(0) { | |
16 if (!process_shim_) { | |
17 // TODO(brettw) handle error. | |
18 return; | |
19 } | |
20 routing_id_ = process_shim_->NewRenderWidgetHostView(parent); | |
21 } | |
22 | |
23 GpuViewHost::~GpuViewHost() { | |
24 } | |
25 | |
26 BackingStore* GpuViewHost::CreateBackingStore(const gfx::Size& size) { | |
27 int32 backing_store_routing_id = process_shim_->GetNextRoutingId(); | |
28 BackingStoreProxy* result = | |
29 new BackingStoreProxy(widget_, size, | |
30 process_shim_, backing_store_routing_id); | |
31 process_shim_->Send(new GpuMsg_NewBackingStore(routing_id_, | |
32 backing_store_routing_id, | |
33 size)); | |
34 return result; | |
35 } | |
36 | |
37 VideoLayer* GpuViewHost::CreateVideoLayer(const gfx::Size& size) { | |
38 int32 video_layer_routing_id = process_shim_->GetNextRoutingId(); | |
39 VideoLayerProxy* result = | |
40 new VideoLayerProxy(widget_, size, | |
41 process_shim_, video_layer_routing_id); | |
42 process_shim_->Send(new GpuMsg_NewVideoLayer(routing_id_, | |
43 video_layer_routing_id, | |
44 size)); | |
45 return result; | |
46 } | |
47 | |
48 void GpuViewHost::OnWindowPainted() { | |
49 process_shim_->Send(new GpuMsg_WindowPainted(routing_id_)); | |
50 } | |
OLD | NEW |