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

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

Issue 10984004: Use a singleton 1x1 offscreen surface for all TextureImageTransportSurface instances. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add the 1x1 surface into GpuChannelManager. 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 void GpuChannelManager::LoseAllContexts() { 168 void GpuChannelManager::LoseAllContexts() {
169 MessageLoop::current()->PostTask( 169 MessageLoop::current()->PostTask(
170 FROM_HERE, 170 FROM_HERE,
171 base::Bind(&GpuChannelManager::OnLoseAllContexts, 171 base::Bind(&GpuChannelManager::OnLoseAllContexts,
172 weak_factory_.GetWeakPtr())); 172 weak_factory_.GetWeakPtr()));
173 } 173 }
174 174
175 void GpuChannelManager::OnLoseAllContexts() { 175 void GpuChannelManager::OnLoseAllContexts() {
176 gpu_channels_.clear(); 176 gpu_channels_.clear();
177 } 177 }
178
179 gfx::GLSurface* GpuChannelManager::AllocMakeCurrentSurface() {
180 if (make_current_surface_.get()) {
181 make_current_surface_->AddRef();
182 } else {
183 make_current_surface_ = gfx::GLSurface::CreateOffscreenGLSurface(
184 false, gfx::Size(1, 1));
185 }
186 return make_current_surface_.get();
187 }
188
189 void GpuChannelManager::ReleaseMakeCurrentSurface() {
190 if (make_current_surface_.get()) {
191 if (make_current_surface_->HasOneRef()) {
piman 2012/09/25 00:12:18 This is bogus, because you don't have a way to kno
hshi1 2012/09/25 00:26:34 Done.
192 make_current_surface_->Destroy();
193 make_current_surface_ = NULL;
194 } else {
195 make_current_surface_->Release();
196 }
197 }
198 }
199
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698