Chromium Code Reviews| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 | |
| OLD | NEW |