| 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 DCHECK(task_runner_->BelongsToCurrentThread()); | 190 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 191 if (CheckContextLost()) | 191 if (CheckContextLost()) |
| 192 return; | 192 return; |
| 193 | 193 |
| 194 cc::ContextProvider::ScopedContextLock lock(context_provider_); | 194 cc::ContextProvider::ScopedContextLock lock(context_provider_); |
| 195 gpu::gles2::GLES2Interface* gles2 = lock.ContextGL(); | 195 gpu::gles2::GLES2Interface* gles2 = lock.ContextGL(); |
| 196 gles2->DeleteTextures(1, &texture_id); | 196 gles2->DeleteTextures(1, &texture_id); |
| 197 DCHECK_EQ(gles2->GetError(), static_cast<GLenum>(GL_NO_ERROR)); | 197 DCHECK_EQ(gles2->GetError(), static_cast<GLenum>(GL_NO_ERROR)); |
| 198 } | 198 } |
| 199 | 199 |
| 200 gpu::SyncToken RendererGpuVideoAcceleratorFactories::CreateSyncToken() { |
| 201 cc::ContextProvider::ScopedContextLock lock(context_provider_); |
| 202 gpu::gles2::GLES2Interface* gl = lock.ContextGL(); |
| 203 gpu::SyncToken sync_token; |
| 204 const GLuint64 fence_sync = gl->InsertFenceSyncCHROMIUM(); |
| 205 gl->ShallowFlushCHROMIUM(); |
| 206 gl->GenSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); |
| 207 return sync_token; |
| 208 } |
| 209 |
| 200 void RendererGpuVideoAcceleratorFactories::WaitSyncToken( | 210 void RendererGpuVideoAcceleratorFactories::WaitSyncToken( |
| 201 const gpu::SyncToken& sync_token) { | 211 const gpu::SyncToken& sync_token) { |
| 202 DCHECK(task_runner_->BelongsToCurrentThread()); | 212 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 203 if (CheckContextLost()) | 213 if (CheckContextLost()) |
| 204 return; | 214 return; |
| 205 | 215 |
| 206 cc::ContextProvider::ScopedContextLock lock(context_provider_); | 216 cc::ContextProvider::ScopedContextLock lock(context_provider_); |
| 207 gpu::gles2::GLES2Interface* gles2 = lock.ContextGL(); | 217 gpu::gles2::GLES2Interface* gles2 = lock.ContextGL(); |
| 208 gles2->WaitSyncTokenCHROMIUM(sync_token.GetConstData()); | 218 gles2->WaitSyncTokenCHROMIUM(sync_token.GetConstData()); |
| 209 | 219 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 context_provider_refptr_ = nullptr; | 316 context_provider_refptr_ = nullptr; |
| 307 } | 317 } |
| 308 | 318 |
| 309 scoped_refptr<ContextProviderCommandBuffer> | 319 scoped_refptr<ContextProviderCommandBuffer> |
| 310 RendererGpuVideoAcceleratorFactories::ContextProviderMainThread() { | 320 RendererGpuVideoAcceleratorFactories::ContextProviderMainThread() { |
| 311 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); | 321 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); |
| 312 return context_provider_refptr_; | 322 return context_provider_refptr_; |
| 313 } | 323 } |
| 314 | 324 |
| 315 } // namespace content | 325 } // namespace content |
| OLD | NEW |