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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 143 |
144 WebGraphicsContext3DCommandBufferImpl* context = GetContext3d(); | 144 WebGraphicsContext3DCommandBufferImpl* context = GetContext3d(); |
145 if (!context) | 145 if (!context) |
146 return; | 146 return; |
147 | 147 |
148 gpu::gles2::GLES2Implementation* gles2 = context->GetImplementation(); | 148 gpu::gles2::GLES2Implementation* gles2 = context->GetImplementation(); |
149 gles2->DeleteTextures(1, &texture_id); | 149 gles2->DeleteTextures(1, &texture_id); |
150 DCHECK_EQ(gles2->GetError(), static_cast<GLenum>(GL_NO_ERROR)); | 150 DCHECK_EQ(gles2->GetError(), static_cast<GLenum>(GL_NO_ERROR)); |
151 } | 151 } |
152 | 152 |
| 153 uint32 RendererGpuVideoAcceleratorFactories::InsertSyncPoint() { |
| 154 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 155 |
| 156 WebGraphicsContext3DCommandBufferImpl* context = GetContext3d(); |
| 157 if (!context) |
| 158 return 0; |
| 159 |
| 160 gpu::gles2::GLES2Implementation* gles2 = context->GetImplementation(); |
| 161 return gles2->InsertSyncPointCHROMIUM(); |
| 162 } |
| 163 |
153 void RendererGpuVideoAcceleratorFactories::WaitSyncPoint(uint32 sync_point) { | 164 void RendererGpuVideoAcceleratorFactories::WaitSyncPoint(uint32 sync_point) { |
154 DCHECK(task_runner_->BelongsToCurrentThread()); | 165 DCHECK(task_runner_->BelongsToCurrentThread()); |
155 | 166 |
156 WebGraphicsContext3DCommandBufferImpl* context = GetContext3d(); | 167 WebGraphicsContext3DCommandBufferImpl* context = GetContext3d(); |
157 if (!context) | 168 if (!context) |
158 return; | 169 return; |
159 | 170 |
160 gpu::gles2::GLES2Implementation* gles2 = context->GetImplementation(); | 171 gpu::gles2::GLES2Implementation* gles2 = context->GetImplementation(); |
161 gles2->WaitSyncPointCHROMIUM(sync_point); | 172 gles2->WaitSyncPointCHROMIUM(sync_point); |
162 | 173 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 #endif | 215 #endif |
205 gles2->ReadPixels(visible_rect.x(), | 216 gles2->ReadPixels(visible_rect.x(), |
206 visible_rect.y(), | 217 visible_rect.y(), |
207 visible_rect.width(), | 218 visible_rect.width(), |
208 visible_rect.height(), | 219 visible_rect.height(), |
209 skia_format, | 220 skia_format, |
210 GL_UNSIGNED_BYTE, | 221 GL_UNSIGNED_BYTE, |
211 pixels.pixelRef()->pixels()); | 222 pixels.pixelRef()->pixels()); |
212 gles2->DeleteFramebuffers(1, &fb); | 223 gles2->DeleteFramebuffers(1, &fb); |
213 gles2->DeleteTextures(1, &tmp_texture); | 224 gles2->DeleteTextures(1, &tmp_texture); |
| 225 gles2->Flush(); |
214 DCHECK_EQ(gles2->GetError(), static_cast<GLenum>(GL_NO_ERROR)); | 226 DCHECK_EQ(gles2->GetError(), static_cast<GLenum>(GL_NO_ERROR)); |
215 } | 227 } |
216 | 228 |
217 base::SharedMemory* RendererGpuVideoAcceleratorFactories::CreateSharedMemory( | 229 base::SharedMemory* RendererGpuVideoAcceleratorFactories::CreateSharedMemory( |
218 size_t size) { | 230 size_t size) { |
219 DCHECK(task_runner_->BelongsToCurrentThread()); | 231 DCHECK(task_runner_->BelongsToCurrentThread()); |
220 return ChildThread::AllocateSharedMemory(size, thread_safe_sender_.get()); | 232 return ChildThread::AllocateSharedMemory(size, thread_safe_sender_.get()); |
221 } | 233 } |
222 | 234 |
223 scoped_refptr<base::SingleThreadTaskRunner> | 235 scoped_refptr<base::SingleThreadTaskRunner> |
224 RendererGpuVideoAcceleratorFactories::GetTaskRunner() { | 236 RendererGpuVideoAcceleratorFactories::GetTaskRunner() { |
225 return task_runner_; | 237 return task_runner_; |
226 } | 238 } |
227 | 239 |
228 } // namespace content | 240 } // namespace content |
OLD | NEW |