OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/common/gpu/gpu_channel_manager.h" | 5 #include "content/common/gpu/gpu_channel_manager.h" |
6 | 6 |
7 #include "content/common/child_thread.h" | 7 #include "content/common/child_thread.h" |
8 #include "content/common/gpu/gpu_channel.h" | 8 #include "content/common/gpu/gpu_channel.h" |
9 #include "content/common/gpu/gpu_messages.h" | 9 #include "content/common/gpu/gpu_messages.h" |
10 | 10 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 bool GpuChannelManager::OnMessageReceived(const IPC::Message& msg) { | 55 bool GpuChannelManager::OnMessageReceived(const IPC::Message& msg) { |
56 bool msg_is_ok = true; | 56 bool msg_is_ok = true; |
57 bool handled = true; | 57 bool handled = true; |
58 IPC_BEGIN_MESSAGE_MAP_EX(GpuChannelManager, msg, msg_is_ok) | 58 IPC_BEGIN_MESSAGE_MAP_EX(GpuChannelManager, msg, msg_is_ok) |
59 IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, OnEstablishChannel) | 59 IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, OnEstablishChannel) |
60 IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel) | 60 IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel) |
61 IPC_MESSAGE_HANDLER(GpuMsg_CreateViewCommandBuffer, | 61 IPC_MESSAGE_HANDLER(GpuMsg_CreateViewCommandBuffer, |
62 OnCreateViewCommandBuffer) | 62 OnCreateViewCommandBuffer) |
63 IPC_MESSAGE_HANDLER(GpuMsg_VisibilityChanged, OnVisibilityChanged) | 63 IPC_MESSAGE_HANDLER(GpuMsg_VisibilityChanged, OnVisibilityChanged) |
| 64 #if defined(TOOLKIT_USES_GTK) && !defined(TOUCH_UI) || defined(OS_WIN) |
| 65 IPC_MESSAGE_HANDLER(GpuMsg_ResizeViewACK, OnResizeViewACK); |
| 66 #endif |
64 IPC_MESSAGE_UNHANDLED(handled = false) | 67 IPC_MESSAGE_UNHANDLED(handled = false) |
65 IPC_END_MESSAGE_MAP_EX() | 68 IPC_END_MESSAGE_MAP_EX() |
66 return handled; | 69 return handled; |
67 } | 70 } |
68 | 71 |
69 bool GpuChannelManager::Send(IPC::Message* msg) { | 72 bool GpuChannelManager::Send(IPC::Message* msg) { |
70 return gpu_child_thread_->Send(msg); | 73 return gpu_child_thread_->Send(msg); |
71 } | 74 } |
72 | 75 |
73 void GpuChannelManager::OnEstablishChannel(int renderer_id) { | 76 void GpuChannelManager::OnEstablishChannel(int renderer_id) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 void GpuChannelManager::OnVisibilityChanged( | 119 void GpuChannelManager::OnVisibilityChanged( |
117 int32 render_view_id, int32 renderer_id, bool visible) { | 120 int32 render_view_id, int32 renderer_id, bool visible) { |
118 // TODO(amarinichev): this will be used for context eviction | 121 // TODO(amarinichev): this will be used for context eviction |
119 } | 122 } |
120 | 123 |
121 void GpuChannelManager::OnCreateViewCommandBuffer( | 124 void GpuChannelManager::OnCreateViewCommandBuffer( |
122 gfx::PluginWindowHandle window, | 125 gfx::PluginWindowHandle window, |
123 int32 render_view_id, | 126 int32 render_view_id, |
124 int32 renderer_id, | 127 int32 renderer_id, |
125 const GPUCreateCommandBufferConfig& init_params) { | 128 const GPUCreateCommandBufferConfig& init_params) { |
126 DCHECK(render_view_id); | |
127 int32 route_id = MSG_ROUTING_NONE; | 129 int32 route_id = MSG_ROUTING_NONE; |
128 | 130 |
129 GpuChannelMap::const_iterator iter = gpu_channels_.find(renderer_id); | 131 GpuChannelMap::const_iterator iter = gpu_channels_.find(renderer_id); |
130 if (iter != gpu_channels_.end()) { | 132 if (iter != gpu_channels_.end()) { |
131 iter->second->CreateViewCommandBuffer( | 133 iter->second->CreateViewCommandBuffer( |
132 window, render_view_id, init_params, &route_id); | 134 window, render_view_id, init_params, &route_id); |
133 } | 135 } |
134 | 136 |
135 Send(new GpuHostMsg_CommandBufferCreated(route_id)); | 137 Send(new GpuHostMsg_CommandBufferCreated(route_id)); |
136 } | 138 } |
137 | 139 |
| 140 void GpuChannelManager::OnResizeViewACK(int32 renderer_id, |
| 141 int32 command_buffer_route_id) { |
| 142 GpuChannelMap::const_iterator iter = gpu_channels_.find(renderer_id); |
| 143 if (iter == gpu_channels_.end()) |
| 144 return; |
| 145 scoped_refptr<GpuChannel> channel = iter->second; |
| 146 |
| 147 channel->ViewResized(command_buffer_route_id); |
| 148 } |
| 149 |
138 void GpuChannelManager::LoseAllContexts() { | 150 void GpuChannelManager::LoseAllContexts() { |
139 MessageLoop::current()->PostTask( | 151 MessageLoop::current()->PostTask( |
140 FROM_HERE, method_factory_.NewRunnableMethod( | 152 FROM_HERE, method_factory_.NewRunnableMethod( |
141 &GpuChannelManager::OnLoseAllContexts)); | 153 &GpuChannelManager::OnLoseAllContexts)); |
142 } | 154 } |
143 | 155 |
144 void GpuChannelManager::OnLoseAllContexts() { | 156 void GpuChannelManager::OnLoseAllContexts() { |
145 gpu_channels_.clear(); | 157 gpu_channels_.clear(); |
146 } | 158 } |
OLD | NEW |