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

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

Issue 8060045: Use shared D3D9 texture to transport the compositor's backing buffer to the browser... (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 "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
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
67 IPC_MESSAGE_UNHANDLED(handled = false) 64 IPC_MESSAGE_UNHANDLED(handled = false)
68 IPC_END_MESSAGE_MAP_EX() 65 IPC_END_MESSAGE_MAP_EX()
69 return handled; 66 return handled;
70 } 67 }
71 68
72 bool GpuChannelManager::Send(IPC::Message* msg) { 69 bool GpuChannelManager::Send(IPC::Message* msg) {
73 return gpu_child_thread_->Send(msg); 70 return gpu_child_thread_->Send(msg);
74 } 71 }
75 72
76 void GpuChannelManager::OnEstablishChannel(int renderer_id) { 73 void GpuChannelManager::OnEstablishChannel(int renderer_id) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 void GpuChannelManager::OnVisibilityChanged( 116 void GpuChannelManager::OnVisibilityChanged(
120 int32 render_view_id, int32 renderer_id, bool visible) { 117 int32 render_view_id, int32 renderer_id, bool visible) {
121 // TODO(amarinichev): this will be used for context eviction 118 // TODO(amarinichev): this will be used for context eviction
122 } 119 }
123 120
124 void GpuChannelManager::OnCreateViewCommandBuffer( 121 void GpuChannelManager::OnCreateViewCommandBuffer(
125 gfx::PluginWindowHandle window, 122 gfx::PluginWindowHandle window,
126 int32 render_view_id, 123 int32 render_view_id,
127 int32 renderer_id, 124 int32 renderer_id,
128 const GPUCreateCommandBufferConfig& init_params) { 125 const GPUCreateCommandBufferConfig& init_params) {
126 CHECK(render_view_id);
jonathan.backer 2011/11/03 23:09:07 You sure you want to CHECK and not DCHECK? Not sur
129 int32 route_id = MSG_ROUTING_NONE; 127 int32 route_id = MSG_ROUTING_NONE;
130 128
131 GpuChannelMap::const_iterator iter = gpu_channels_.find(renderer_id); 129 GpuChannelMap::const_iterator iter = gpu_channels_.find(renderer_id);
132 if (iter != gpu_channels_.end()) { 130 if (iter != gpu_channels_.end()) {
133 iter->second->CreateViewCommandBuffer( 131 iter->second->CreateViewCommandBuffer(
134 window, render_view_id, init_params, &route_id); 132 window, render_view_id, init_params, &route_id);
135 } 133 }
136 134
137 Send(new GpuHostMsg_CommandBufferCreated(route_id)); 135 Send(new GpuHostMsg_CommandBufferCreated(route_id));
138 } 136 }
139 137
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
150 void GpuChannelManager::LoseAllContexts() { 138 void GpuChannelManager::LoseAllContexts() {
151 MessageLoop::current()->PostTask( 139 MessageLoop::current()->PostTask(
152 FROM_HERE, method_factory_.NewRunnableMethod( 140 FROM_HERE, method_factory_.NewRunnableMethod(
153 &GpuChannelManager::OnLoseAllContexts)); 141 &GpuChannelManager::OnLoseAllContexts));
154 } 142 }
155 143
156 void GpuChannelManager::OnLoseAllContexts() { 144 void GpuChannelManager::OnLoseAllContexts() {
157 gpu_channels_.clear(); 145 gpu_channels_.clear();
158 } 146 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698