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/media/gpu_video_decode_accelerator.h" | 5 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 } | 50 } |
51 | 51 |
52 if (!stub->decoder()->MakeCurrent()) { | 52 if (!stub->decoder()->MakeCurrent()) { |
53 DLOG(ERROR) << "Failed to MakeCurrent()"; | 53 DLOG(ERROR) << "Failed to MakeCurrent()"; |
54 return false; | 54 return false; |
55 } | 55 } |
56 | 56 |
57 return true; | 57 return true; |
58 } | 58 } |
59 | 59 |
60 #if (defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)) || defined(OS_MACOSX) | 60 #if ((defined(OS_CHROMEOS) || defined(OS_LINUX)) && defined(ARCH_CPU_X86_FAMILY)
) || defined(OS_MACOSX) |
61 static bool BindImage(const base::WeakPtr<gpu::GpuCommandBufferStub>& stub, | 61 static bool BindImage(const base::WeakPtr<gpu::GpuCommandBufferStub>& stub, |
62 uint32_t client_texture_id, | 62 uint32_t client_texture_id, |
63 uint32_t texture_target, | 63 uint32_t texture_target, |
64 const scoped_refptr<gl::GLImage>& image, | 64 const scoped_refptr<gl::GLImage>& image, |
65 bool can_bind_to_sampler) { | 65 bool can_bind_to_sampler) { |
66 if (!stub) { | 66 if (!stub) { |
67 DLOG(ERROR) << "Stub is gone; won't BindImage()."; | 67 DLOG(ERROR) << "Stub is gone; won't BindImage()."; |
68 return false; | 68 return false; |
69 } | 69 } |
70 | 70 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 textures_per_buffer_(0), | 162 textures_per_buffer_(0), |
163 filter_removed_(true, false), | 163 filter_removed_(true, false), |
164 child_task_runner_(base::ThreadTaskRunnerHandle::Get()), | 164 child_task_runner_(base::ThreadTaskRunnerHandle::Get()), |
165 io_task_runner_(io_task_runner), | 165 io_task_runner_(io_task_runner), |
166 weak_factory_for_io_(this) { | 166 weak_factory_for_io_(this) { |
167 DCHECK(stub_); | 167 DCHECK(stub_); |
168 stub_->AddDestructionObserver(this); | 168 stub_->AddDestructionObserver(this); |
169 get_gl_context_cb_ = base::Bind(&GetGLContext, stub_->AsWeakPtr()); | 169 get_gl_context_cb_ = base::Bind(&GetGLContext, stub_->AsWeakPtr()); |
170 make_context_current_cb_ = | 170 make_context_current_cb_ = |
171 base::Bind(&MakeDecoderContextCurrent, stub_->AsWeakPtr()); | 171 base::Bind(&MakeDecoderContextCurrent, stub_->AsWeakPtr()); |
172 #if (defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)) || defined(OS_MACOSX) | 172 #if ((defined(OS_CHROMEOS) || defined(OS_LINUX)) && defined(ARCH_CPU_X86_FAMILY)
) || defined(OS_MACOSX) |
173 bind_image_cb_ = base::Bind(&BindImage, stub_->AsWeakPtr()); | 173 bind_image_cb_ = base::Bind(&BindImage, stub_->AsWeakPtr()); |
174 #endif | 174 #endif |
175 get_gles2_decoder_cb_ = base::Bind(&GetGLES2Decoder, stub_->AsWeakPtr()); | 175 get_gles2_decoder_cb_ = base::Bind(&GetGLES2Decoder, stub_->AsWeakPtr()); |
176 } | 176 } |
177 | 177 |
178 GpuVideoDecodeAccelerator::~GpuVideoDecodeAccelerator() { | 178 GpuVideoDecodeAccelerator::~GpuVideoDecodeAccelerator() { |
179 // This class can only be self-deleted from OnWillDestroyStub(), which means | 179 // This class can only be self-deleted from OnWillDestroyStub(), which means |
180 // the VDA has already been destroyed in there. | 180 // the VDA has already been destroyed in there. |
181 DCHECK(!video_decode_accelerator_); | 181 DCHECK(!video_decode_accelerator_); |
182 } | 182 } |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 GLenum target = texture_ref->texture()->target(); | 515 GLenum target = texture_ref->texture()->target(); |
516 gpu::gles2::TextureManager* texture_manager = | 516 gpu::gles2::TextureManager* texture_manager = |
517 stub_->decoder()->GetContextGroup()->texture_manager(); | 517 stub_->decoder()->GetContextGroup()->texture_manager(); |
518 DCHECK(!texture_ref->texture()->IsLevelCleared(target, 0)); | 518 DCHECK(!texture_ref->texture()->IsLevelCleared(target, 0)); |
519 texture_manager->SetLevelCleared(texture_ref.get(), target, 0, true); | 519 texture_manager->SetLevelCleared(texture_ref.get(), target, 0, true); |
520 } | 520 } |
521 uncleared_textures_.erase(it); | 521 uncleared_textures_.erase(it); |
522 } | 522 } |
523 | 523 |
524 } // namespace content | 524 } // namespace content |
OLD | NEW |