OLD | NEW |
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 watchdog_(watchdog), | 43 watchdog_(watchdog), |
44 sync_point_manager_(new SyncPointManager), | 44 sync_point_manager_(new SyncPointManager), |
45 program_cache_(NULL) { | 45 program_cache_(NULL) { |
46 DCHECK(gpu_child_thread); | 46 DCHECK(gpu_child_thread); |
47 DCHECK(io_message_loop); | 47 DCHECK(io_message_loop); |
48 DCHECK(shutdown_event); | 48 DCHECK(shutdown_event); |
49 } | 49 } |
50 | 50 |
51 GpuChannelManager::~GpuChannelManager() { | 51 GpuChannelManager::~GpuChannelManager() { |
52 gpu_channels_.clear(); | 52 gpu_channels_.clear(); |
53 if (default_offscreen_surface_.get()) { | 53 if (default_offscreen_surface_) { |
54 default_offscreen_surface_->Destroy(); | 54 default_offscreen_surface_->Destroy(); |
55 default_offscreen_surface_ = NULL; | 55 default_offscreen_surface_ = NULL; |
56 } | 56 } |
57 DCHECK(image_operations_.empty()); | 57 DCHECK(image_operations_.empty()); |
58 } | 58 } |
59 | 59 |
60 gpu::gles2::ProgramCache* GpuChannelManager::program_cache() { | 60 gpu::gles2::ProgramCache* GpuChannelManager::program_cache() { |
61 if (!program_cache_.get() && | 61 if (!program_cache_.get() && |
62 (gfx::g_driver_gl.ext.b_ARB_get_program_binary || | 62 (gfx::g_driver_gl.ext.b_ARB_get_program_binary || |
63 gfx::g_driver_gl.ext.b_OES_get_program_binary) && | 63 gfx::g_driver_gl.ext.b_OES_get_program_binary) && |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 FROM_HERE, | 283 FROM_HERE, |
284 base::Bind(&GpuChannelManager::OnLoseAllContexts, | 284 base::Bind(&GpuChannelManager::OnLoseAllContexts, |
285 weak_factory_.GetWeakPtr())); | 285 weak_factory_.GetWeakPtr())); |
286 } | 286 } |
287 | 287 |
288 void GpuChannelManager::OnLoseAllContexts() { | 288 void GpuChannelManager::OnLoseAllContexts() { |
289 gpu_channels_.clear(); | 289 gpu_channels_.clear(); |
290 } | 290 } |
291 | 291 |
292 gfx::GLSurface* GpuChannelManager::GetDefaultOffscreenSurface() { | 292 gfx::GLSurface* GpuChannelManager::GetDefaultOffscreenSurface() { |
293 if (!default_offscreen_surface_.get()) { | 293 if (!default_offscreen_surface_) { |
294 default_offscreen_surface_ = gfx::GLSurface::CreateOffscreenGLSurface( | 294 default_offscreen_surface_ = gfx::GLSurface::CreateOffscreenGLSurface( |
295 false, gfx::Size(1, 1)); | 295 false, gfx::Size(1, 1)); |
296 } | 296 } |
297 return default_offscreen_surface_.get(); | 297 return default_offscreen_surface_.get(); |
298 } | 298 } |
299 | 299 |
300 } // namespace content | 300 } // namespace content |
OLD | NEW |