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

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

Issue 10543125: gpu: Add support for GLX_EXT_texture_from_pixmap extension. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move CreateGLImage below virtual methods. Created 8 years, 2 months 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/command_line.h" 8 #include "base/command_line.h"
9 #include "content/common/child_thread.h" 9 #include "content/common/child_thread.h"
10 #include "content/common/gpu/gpu_channel.h" 10 #include "content/common/gpu/gpu_channel.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 } 88 }
89 89
90 bool GpuChannelManager::OnMessageReceived(const IPC::Message& msg) { 90 bool GpuChannelManager::OnMessageReceived(const IPC::Message& msg) {
91 bool msg_is_ok = true; 91 bool msg_is_ok = true;
92 bool handled = true; 92 bool handled = true;
93 IPC_BEGIN_MESSAGE_MAP_EX(GpuChannelManager, msg, msg_is_ok) 93 IPC_BEGIN_MESSAGE_MAP_EX(GpuChannelManager, msg, msg_is_ok)
94 IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, OnEstablishChannel) 94 IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, OnEstablishChannel)
95 IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel) 95 IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel)
96 IPC_MESSAGE_HANDLER(GpuMsg_CreateViewCommandBuffer, 96 IPC_MESSAGE_HANDLER(GpuMsg_CreateViewCommandBuffer,
97 OnCreateViewCommandBuffer) 97 OnCreateViewCommandBuffer)
98 IPC_MESSAGE_HANDLER(GpuMsg_CreateImage, OnCreateImage)
99 IPC_MESSAGE_HANDLER(GpuMsg_DeleteImage, OnDeleteImage)
98 IPC_MESSAGE_UNHANDLED(handled = false) 100 IPC_MESSAGE_UNHANDLED(handled = false)
99 IPC_END_MESSAGE_MAP_EX() 101 IPC_END_MESSAGE_MAP_EX()
100 return handled; 102 return handled;
101 } 103 }
102 104
103 bool GpuChannelManager::Send(IPC::Message* msg) { 105 bool GpuChannelManager::Send(IPC::Message* msg) {
104 return gpu_child_thread_->Send(msg); 106 return gpu_child_thread_->Send(msg);
105 } 107 }
106 108
107 void GpuChannelManager::OnEstablishChannel(int client_id, bool share_context) { 109 void GpuChannelManager::OnEstablishChannel(int client_id, bool share_context) {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 164
163 GpuChannelMap::const_iterator iter = gpu_channels_.find(client_id); 165 GpuChannelMap::const_iterator iter = gpu_channels_.find(client_id);
164 if (iter != gpu_channels_.end()) { 166 if (iter != gpu_channels_.end()) {
165 iter->second->CreateViewCommandBuffer( 167 iter->second->CreateViewCommandBuffer(
166 window, surface_id, init_params, &route_id); 168 window, surface_id, init_params, &route_id);
167 } 169 }
168 170
169 Send(new GpuHostMsg_CommandBufferCreated(route_id)); 171 Send(new GpuHostMsg_CommandBufferCreated(route_id));
170 } 172 }
171 173
174 void GpuChannelManager::OnCreateImage(
175 gfx::PluginWindowHandle window,
176 int32 client_id,
177 int32 image_id) {
178 DCHECK(image_id);
179 gfx::Size size;
180
181 GpuChannelMap::const_iterator iter = gpu_channels_.find(client_id);
182 if (iter != gpu_channels_.end()) {
183 iter->second->CreateImage(window, image_id, &size);
184 }
185
186 Send(new GpuHostMsg_ImageCreated(size));
187 }
188
189 void GpuChannelManager::OnDeleteImage(
190 int32 client_id,
191 int32 image_id) {
192 DCHECK(image_id);
193
194 GpuChannelMap::const_iterator iter = gpu_channels_.find(client_id);
195 if (iter != gpu_channels_.end()) {
196 iter->second->DeleteImage(image_id);
197 }
198 }
199
172 void GpuChannelManager::LoseAllContexts() { 200 void GpuChannelManager::LoseAllContexts() {
173 MessageLoop::current()->PostTask( 201 MessageLoop::current()->PostTask(
174 FROM_HERE, 202 FROM_HERE,
175 base::Bind(&GpuChannelManager::OnLoseAllContexts, 203 base::Bind(&GpuChannelManager::OnLoseAllContexts,
176 weak_factory_.GetWeakPtr())); 204 weak_factory_.GetWeakPtr()));
177 } 205 }
178 206
179 void GpuChannelManager::OnLoseAllContexts() { 207 void GpuChannelManager::OnLoseAllContexts() {
180 gpu_channels_.clear(); 208 gpu_channels_.clear();
181 } 209 }
182 210
183 gfx::GLSurface* GpuChannelManager::GetDefaultOffscreenSurface() { 211 gfx::GLSurface* GpuChannelManager::GetDefaultOffscreenSurface() {
184 if (!default_offscreen_surface_.get()) { 212 if (!default_offscreen_surface_.get()) {
185 default_offscreen_surface_ = gfx::GLSurface::CreateOffscreenGLSurface( 213 default_offscreen_surface_ = gfx::GLSurface::CreateOffscreenGLSurface(
186 false, gfx::Size(1, 1)); 214 false, gfx::Size(1, 1));
187 } 215 }
188 return default_offscreen_surface_.get(); 216 return default_offscreen_surface_.get();
189 } 217 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698