| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "gpu/gles2_conform_support/egl/display.h" | 5 #include "gpu/gles2_conform_support/egl/display.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "gpu/command_buffer/client/gles2_lib.h" | 10 #include "gpu/command_buffer/client/gles2_lib.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 gfx::Size(), | 131 gfx::Size(), |
| 132 gpu::gles2::DisallowedFeatures(), | 132 gpu::gles2::DisallowedFeatures(), |
| 133 NULL, | 133 NULL, |
| 134 attribs)) { | 134 attribs)) { |
| 135 return EGL_NO_SURFACE; | 135 return EGL_NO_SURFACE; |
| 136 } | 136 } |
| 137 | 137 |
| 138 command_buffer_->SetPutOffsetChangeCallback( | 138 command_buffer_->SetPutOffsetChangeCallback( |
| 139 base::Bind(&gpu::GpuScheduler::PutChanged, | 139 base::Bind(&gpu::GpuScheduler::PutChanged, |
| 140 base::Unretained(gpu_scheduler_.get()))); | 140 base::Unretained(gpu_scheduler_.get()))); |
| 141 command_buffer_->SetGetBufferChangeCallback( |
| 142 base::Bind(&gpu::GpuScheduler::SetGetBuffer, |
| 143 base::Unretained(gpu_scheduler_.get()))); |
| 141 | 144 |
| 142 surface_.reset(new Surface(win)); | 145 surface_.reset(new Surface(win)); |
| 143 | 146 |
| 144 return surface_.get(); | 147 return surface_.get(); |
| 145 } | 148 } |
| 146 | 149 |
| 147 void Display::DestroySurface(EGLSurface surface) { | 150 void Display::DestroySurface(EGLSurface surface) { |
| 148 DCHECK(IsValidSurface(surface)); | 151 DCHECK(IsValidSurface(surface)); |
| 149 gpu_scheduler_.reset(); | 152 gpu_scheduler_.reset(); |
| 153 if (decoder_.get()) { |
| 154 decoder_->Destroy(); |
| 155 } |
| 150 decoder_.reset(); | 156 decoder_.reset(); |
| 151 gl_surface_ = NULL; | 157 gl_surface_ = NULL; |
| 152 gl_context_ = NULL; | 158 gl_context_ = NULL; |
| 153 surface_.reset(); | 159 surface_.reset(); |
| 154 } | 160 } |
| 155 | 161 |
| 156 void Display::SwapBuffers(EGLSurface surface) { | 162 void Display::SwapBuffers(EGLSurface surface) { |
| 157 DCHECK(IsValidSurface(surface)); | 163 DCHECK(IsValidSurface(surface)); |
| 158 context_->SwapBuffers(); | 164 context_->SwapBuffers(); |
| 159 } | 165 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 } else { | 206 } else { |
| 201 DCHECK(IsValidSurface(draw)); | 207 DCHECK(IsValidSurface(draw)); |
| 202 DCHECK(IsValidSurface(read)); | 208 DCHECK(IsValidSurface(read)); |
| 203 DCHECK(IsValidContext(ctx)); | 209 DCHECK(IsValidContext(ctx)); |
| 204 gles2::SetGLContext(context_.get()); | 210 gles2::SetGLContext(context_.get()); |
| 205 } | 211 } |
| 206 return true; | 212 return true; |
| 207 } | 213 } |
| 208 | 214 |
| 209 } // namespace egl | 215 } // namespace egl |
| OLD | NEW |