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 #ifndef CHROME_RENDERER_GPU_CHANNEL_HOST_H_ | 5 #ifndef CHROME_RENDERER_GPU_CHANNEL_HOST_H_ |
6 #define CHROME_RENDERER_GPU_CHANNEL_HOST_H_ | 6 #define CHROME_RENDERER_GPU_CHANNEL_HOST_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/hash_tables.h" | 10 #include "base/hash_tables.h" |
11 #include "chrome/common/message_router.h" | 11 #include "chrome/common/message_router.h" |
| 12 #include "gfx/native_widget_types.h" |
| 13 #include "gfx/size.h" |
12 #include "ipc/ipc_channel.h" | 14 #include "ipc/ipc_channel.h" |
13 #include "ipc/ipc_message.h" | 15 #include "ipc/ipc_message.h" |
14 #include "ipc/ipc_sync_channel.h" | 16 #include "ipc/ipc_sync_channel.h" |
15 | 17 |
16 class CommandBufferProxy; | 18 class CommandBufferProxy; |
17 | 19 |
18 // Encapsulates an IPC channel between the renderer and one plugin process. | 20 // Encapsulates an IPC channel between the renderer and one plugin process. |
19 // On the plugin side there's a corresponding GpuChannel. | 21 // On the plugin side there's a corresponding GpuChannel. |
20 class GpuChannelHost : public IPC::Channel::Listener, | 22 class GpuChannelHost : public IPC::Channel::Listener, |
21 public IPC::Message::Sender, | 23 public IPC::Message::Sender, |
(...skipping 23 matching lines...) Expand all Loading... |
45 | 47 |
46 // IPC::Channel::Listener implementation: | 48 // IPC::Channel::Listener implementation: |
47 virtual void OnMessageReceived(const IPC::Message& msg); | 49 virtual void OnMessageReceived(const IPC::Message& msg); |
48 virtual void OnChannelConnected(int32 peer_pid); | 50 virtual void OnChannelConnected(int32 peer_pid); |
49 virtual void OnChannelError(); | 51 virtual void OnChannelError(); |
50 | 52 |
51 // IPC::Message::Sender implementation: | 53 // IPC::Message::Sender implementation: |
52 virtual bool Send(IPC::Message* msg); | 54 virtual bool Send(IPC::Message* msg); |
53 | 55 |
54 // Create and connect to a command buffer in the GPU process. | 56 // Create and connect to a command buffer in the GPU process. |
55 CommandBufferProxy* CreateCommandBuffer(); | 57 CommandBufferProxy* CreateViewCommandBuffer(gfx::NativeViewId view); |
| 58 |
| 59 // Create and connect to a command buffer in the GPU process. |
| 60 CommandBufferProxy* CreateOffscreenCommandBuffer(CommandBufferProxy* parent, |
| 61 const gfx::Size& size, |
| 62 uint32 parent_texture_id); |
| 63 |
56 | 64 |
57 // Destroy a command buffer created by this channel. | 65 // Destroy a command buffer created by this channel. |
58 void DestroyCommandBuffer(CommandBufferProxy* command_buffer); | 66 void DestroyCommandBuffer(CommandBufferProxy* command_buffer); |
59 | 67 |
60 private: | 68 private: |
61 State state_; | 69 State state_; |
62 | 70 |
63 scoped_ptr<IPC::SyncChannel> channel_; | 71 scoped_ptr<IPC::SyncChannel> channel_; |
64 | 72 |
65 // Used to implement message routing functionality to CommandBufferProxy | 73 // Used to implement message routing functionality to CommandBufferProxy |
66 // objects | 74 // objects |
67 MessageRouter router_; | 75 MessageRouter router_; |
68 | 76 |
69 // Keep track of all the registered CommandBufferProxies to | 77 // Keep track of all the registered CommandBufferProxies to |
70 // inform about OnChannelError | 78 // inform about OnChannelError |
71 typedef base::hash_map<int, IPC::Channel::Listener*> ProxyMap; | 79 typedef base::hash_map<int, IPC::Channel::Listener*> ProxyMap; |
72 ProxyMap proxies_; | 80 ProxyMap proxies_; |
73 | 81 |
74 DISALLOW_COPY_AND_ASSIGN(GpuChannelHost); | 82 DISALLOW_COPY_AND_ASSIGN(GpuChannelHost); |
75 }; | 83 }; |
76 | 84 |
77 #endif // CHROME_RENDERER_GPU_CHANNEL_HOST_H_ | 85 #endif // CHROME_RENDERER_GPU_CHANNEL_HOST_H_ |
OLD | NEW |