| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/renderer/media/renderer_gpu_video_accelerator_factories.h" | 5 #include "content/renderer/media/renderer_gpu_video_accelerator_factories.h" |
| 6 | 6 |
| 7 #include <GLES2/gl2.h> | 7 #include <GLES2/gl2.h> |
| 8 #include <GLES2/gl2ext.h> | 8 #include <GLES2/gl2ext.h> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 RendererGpuVideoAcceleratorFactories::RendererGpuVideoAcceleratorFactories() | 52 RendererGpuVideoAcceleratorFactories::RendererGpuVideoAcceleratorFactories() |
| 53 : aborted_waiter_(true, false), | 53 : aborted_waiter_(true, false), |
| 54 task_runner_async_waiter_(false, false) {} | 54 task_runner_async_waiter_(false, false) {} |
| 55 | 55 |
| 56 WebGraphicsContext3DCommandBufferImpl* | 56 WebGraphicsContext3DCommandBufferImpl* |
| 57 RendererGpuVideoAcceleratorFactories::GetContext3d() { | 57 RendererGpuVideoAcceleratorFactories::GetContext3d() { |
| 58 DCHECK(task_runner_->BelongsToCurrentThread()); | 58 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 59 if (!context_provider_) | 59 if (!context_provider_) |
| 60 return NULL; | 60 return NULL; |
| 61 WebGraphicsContext3DCommandBufferImpl* context = | 61 if (context_provider_->IsContextLost()) { |
| 62 context_provider_->Context3d(); | |
| 63 if (context->isContextLost()) { | |
| 64 context_provider_->VerifyContexts(); | 62 context_provider_->VerifyContexts(); |
| 65 context_provider_ = NULL; | 63 context_provider_ = NULL; |
| 66 return NULL; | 64 return NULL; |
| 67 } | 65 } |
| 68 return context; | 66 return context_provider_->WebContext3D(); |
| 69 } | 67 } |
| 70 | 68 |
| 71 void RendererGpuVideoAcceleratorFactories::AsyncBindContext() { | 69 void RendererGpuVideoAcceleratorFactories::AsyncBindContext() { |
| 72 DCHECK(task_runner_->BelongsToCurrentThread()); | 70 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 73 if (!context_provider_->BindToCurrentThread()) | 71 if (!context_provider_->BindToCurrentThread()) |
| 74 context_provider_ = NULL; | 72 context_provider_ = NULL; |
| 75 task_runner_async_waiter_.Signal(); | 73 task_runner_async_waiter_.Signal(); |
| 76 } | 74 } |
| 77 | 75 |
| 78 scoped_ptr<media::VideoDecodeAccelerator> | 76 scoped_ptr<media::VideoDecodeAccelerator> |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 } | 310 } |
| 313 | 311 |
| 314 void | 312 void |
| 315 RendererGpuVideoAcceleratorFactories::AsyncDestroyVideoDecodeAccelerator() { | 313 RendererGpuVideoAcceleratorFactories::AsyncDestroyVideoDecodeAccelerator() { |
| 316 // OK to release because Destroy() will delete the VDA instance. | 314 // OK to release because Destroy() will delete the VDA instance. |
| 317 if (vda_) | 315 if (vda_) |
| 318 vda_.release()->Destroy(); | 316 vda_.release()->Destroy(); |
| 319 } | 317 } |
| 320 | 318 |
| 321 } // namespace content | 319 } // namespace content |
| OLD | NEW |