Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(428)

Side by Side Diff: content/common/gpu/gpu_channel_manager.cc

Issue 8622004: Reland 110355 - Use shared D3D9 texture to transport the compositor's backing buffer to the brows... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "content/common/child_thread.h" 8 #include "content/common/child_thread.h"
9 #include "content/common/gpu/gpu_channel.h" 9 #include "content/common/gpu/gpu_channel.h"
10 #include "content/common/gpu/gpu_messages.h" 10 #include "content/common/gpu/gpu_messages.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 bool GpuChannelManager::OnMessageReceived(const IPC::Message& msg) { 56 bool GpuChannelManager::OnMessageReceived(const IPC::Message& msg) {
57 bool msg_is_ok = true; 57 bool msg_is_ok = true;
58 bool handled = true; 58 bool handled = true;
59 IPC_BEGIN_MESSAGE_MAP_EX(GpuChannelManager, msg, msg_is_ok) 59 IPC_BEGIN_MESSAGE_MAP_EX(GpuChannelManager, msg, msg_is_ok)
60 IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, OnEstablishChannel) 60 IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, OnEstablishChannel)
61 IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel) 61 IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel)
62 IPC_MESSAGE_HANDLER(GpuMsg_CreateViewCommandBuffer, 62 IPC_MESSAGE_HANDLER(GpuMsg_CreateViewCommandBuffer,
63 OnCreateViewCommandBuffer) 63 OnCreateViewCommandBuffer)
64 IPC_MESSAGE_HANDLER(GpuMsg_VisibilityChanged, OnVisibilityChanged) 64 IPC_MESSAGE_HANDLER(GpuMsg_VisibilityChanged, OnVisibilityChanged)
65 #if defined(TOOLKIT_USES_GTK) && !defined(TOUCH_UI) || defined(OS_WIN)
66 IPC_MESSAGE_HANDLER(GpuMsg_ResizeViewACK, OnResizeViewACK);
67 #endif
68 IPC_MESSAGE_UNHANDLED(handled = false) 65 IPC_MESSAGE_UNHANDLED(handled = false)
69 IPC_END_MESSAGE_MAP_EX() 66 IPC_END_MESSAGE_MAP_EX()
70 return handled; 67 return handled;
71 } 68 }
72 69
73 bool GpuChannelManager::Send(IPC::Message* msg) { 70 bool GpuChannelManager::Send(IPC::Message* msg) {
74 return gpu_child_thread_->Send(msg); 71 return gpu_child_thread_->Send(msg);
75 } 72 }
76 73
77 void GpuChannelManager::OnEstablishChannel(int renderer_id) { 74 void GpuChannelManager::OnEstablishChannel(int renderer_id) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 void GpuChannelManager::OnVisibilityChanged( 117 void GpuChannelManager::OnVisibilityChanged(
121 int32 render_view_id, int32 renderer_id, bool visible) { 118 int32 render_view_id, int32 renderer_id, bool visible) {
122 // TODO(amarinichev): this will be used for context eviction 119 // TODO(amarinichev): this will be used for context eviction
123 } 120 }
124 121
125 void GpuChannelManager::OnCreateViewCommandBuffer( 122 void GpuChannelManager::OnCreateViewCommandBuffer(
126 gfx::PluginWindowHandle window, 123 gfx::PluginWindowHandle window,
127 int32 render_view_id, 124 int32 render_view_id,
128 int32 renderer_id, 125 int32 renderer_id,
129 const GPUCreateCommandBufferConfig& init_params) { 126 const GPUCreateCommandBufferConfig& init_params) {
127 DCHECK(render_view_id);
130 int32 route_id = MSG_ROUTING_NONE; 128 int32 route_id = MSG_ROUTING_NONE;
131 129
132 GpuChannelMap::const_iterator iter = gpu_channels_.find(renderer_id); 130 GpuChannelMap::const_iterator iter = gpu_channels_.find(renderer_id);
133 if (iter != gpu_channels_.end()) { 131 if (iter != gpu_channels_.end()) {
134 iter->second->CreateViewCommandBuffer( 132 iter->second->CreateViewCommandBuffer(
135 window, render_view_id, init_params, &route_id); 133 window, render_view_id, init_params, &route_id);
136 } 134 }
137 135
138 Send(new GpuHostMsg_CommandBufferCreated(route_id)); 136 Send(new GpuHostMsg_CommandBufferCreated(route_id));
139 } 137 }
140 138
141 void GpuChannelManager::OnResizeViewACK(int32 renderer_id,
142 int32 command_buffer_route_id) {
143 GpuChannelMap::const_iterator iter = gpu_channels_.find(renderer_id);
144 if (iter == gpu_channels_.end())
145 return;
146 scoped_refptr<GpuChannel> channel = iter->second;
147
148 channel->ViewResized(command_buffer_route_id);
149 }
150
151 void GpuChannelManager::LoseAllContexts() { 139 void GpuChannelManager::LoseAllContexts() {
152 MessageLoop::current()->PostTask( 140 MessageLoop::current()->PostTask(
153 FROM_HERE, 141 FROM_HERE,
154 base::Bind(&GpuChannelManager::OnLoseAllContexts, 142 base::Bind(&GpuChannelManager::OnLoseAllContexts,
155 weak_factory_.GetWeakPtr())); 143 weak_factory_.GetWeakPtr()));
156 } 144 }
157 145
158 void GpuChannelManager::OnLoseAllContexts() { 146 void GpuChannelManager::OnLoseAllContexts() {
159 gpu_channels_.clear(); 147 gpu_channels_.clear();
160 } 148 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698