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

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: Minor polish - consistently use the get() accessor. 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
« no previous file with comments | « content/common/gpu/gpu_channel_manager.h ('k') | content/common/gpu/gpu_command_buffer_stub.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 20 matching lines...) Expand all
31 watchdog_(watchdog), 31 watchdog_(watchdog),
32 sync_point_manager_(new SyncPointManager), 32 sync_point_manager_(new SyncPointManager),
33 program_cache_(NULL) { 33 program_cache_(NULL) {
34 DCHECK(gpu_child_thread); 34 DCHECK(gpu_child_thread);
35 DCHECK(io_message_loop); 35 DCHECK(io_message_loop);
36 DCHECK(shutdown_event); 36 DCHECK(shutdown_event);
37 } 37 }
38 38
39 GpuChannelManager::~GpuChannelManager() { 39 GpuChannelManager::~GpuChannelManager() {
40 gpu_channels_.clear(); 40 gpu_channels_.clear();
41 if (default_offscreen_surface_.get()) {
42 default_offscreen_surface_->Destroy();
43 default_offscreen_surface_ = NULL;
44 }
41 } 45 }
42 46
43 gpu::gles2::ProgramCache* GpuChannelManager::program_cache() { 47 gpu::gles2::ProgramCache* GpuChannelManager::program_cache() {
44 if (!program_cache_.get() && 48 if (!program_cache_.get() &&
45 (gfx::g_ARB_get_program_binary || gfx::g_OES_get_program_binary) && 49 (gfx::g_ARB_get_program_binary || gfx::g_OES_get_program_binary) &&
46 !CommandLine::ForCurrentProcess()->HasSwitch( 50 !CommandLine::ForCurrentProcess()->HasSwitch(
47 switches::kDisableGpuProgramCache)) { 51 switches::kDisableGpuProgramCache)) {
48 program_cache_.reset(new gpu::gles2::MemoryProgramCache()); 52 program_cache_.reset(new gpu::gles2::MemoryProgramCache());
49 } 53 }
50 return program_cache_.get(); 54 return program_cache_.get();
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 void GpuChannelManager::LoseAllContexts() { 172 void GpuChannelManager::LoseAllContexts() {
169 MessageLoop::current()->PostTask( 173 MessageLoop::current()->PostTask(
170 FROM_HERE, 174 FROM_HERE,
171 base::Bind(&GpuChannelManager::OnLoseAllContexts, 175 base::Bind(&GpuChannelManager::OnLoseAllContexts,
172 weak_factory_.GetWeakPtr())); 176 weak_factory_.GetWeakPtr()));
173 } 177 }
174 178
175 void GpuChannelManager::OnLoseAllContexts() { 179 void GpuChannelManager::OnLoseAllContexts() {
176 gpu_channels_.clear(); 180 gpu_channels_.clear();
177 } 181 }
182
183 gfx::GLSurface* GpuChannelManager::GetDefaultOffscreenSurface() {
184 if (!default_offscreen_surface_.get()) {
185 default_offscreen_surface_ = gfx::GLSurface::CreateOffscreenGLSurface(
186 false, gfx::Size(1, 1));
187 }
188 return default_offscreen_surface_.get();
189 }
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_channel_manager.h ('k') | content/common/gpu/gpu_command_buffer_stub.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698