Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(228)

Side by Side Diff: media/gpu/ipc/service/gpu_video_decode_accelerator.cc

Issue 2495753002: Reenable idle suspension of media elements on Windows. (Closed)
Patch Set: add comment Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/gpu/gpu_video_decode_accelerator_factory.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "media/gpu/ipc/service/gpu_video_decode_accelerator.h" 5 #include "media/gpu/ipc/service/gpu_video_decode_accelerator.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 } 51 }
52 52
53 if (!stub->decoder()->MakeCurrent()) { 53 if (!stub->decoder()->MakeCurrent()) {
54 DLOG(ERROR) << "Failed to MakeCurrent()"; 54 DLOG(ERROR) << "Failed to MakeCurrent()";
55 return false; 55 return false;
56 } 56 }
57 57
58 return true; 58 return true;
59 } 59 }
60 60
61 #if (defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)) || defined(OS_MACOSX) 61 #if (defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)) || \
62 defined(OS_MACOSX) || defined(OS_WIN)
62 static bool BindImage(const base::WeakPtr<gpu::GpuCommandBufferStub>& stub, 63 static bool BindImage(const base::WeakPtr<gpu::GpuCommandBufferStub>& stub,
63 uint32_t client_texture_id, 64 uint32_t client_texture_id,
64 uint32_t texture_target, 65 uint32_t texture_target,
65 const scoped_refptr<gl::GLImage>& image, 66 const scoped_refptr<gl::GLImage>& image,
66 bool can_bind_to_sampler) { 67 bool can_bind_to_sampler) {
67 if (!stub) { 68 if (!stub) {
68 DLOG(ERROR) << "Stub is gone; won't BindImage()."; 69 DLOG(ERROR) << "Stub is gone; won't BindImage().";
69 return false; 70 return false;
70 } 71 }
71 72
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 filter_removed_(base::WaitableEvent::ResetPolicy::MANUAL, 165 filter_removed_(base::WaitableEvent::ResetPolicy::MANUAL,
165 base::WaitableEvent::InitialState::NOT_SIGNALED), 166 base::WaitableEvent::InitialState::NOT_SIGNALED),
166 child_task_runner_(base::ThreadTaskRunnerHandle::Get()), 167 child_task_runner_(base::ThreadTaskRunnerHandle::Get()),
167 io_task_runner_(io_task_runner), 168 io_task_runner_(io_task_runner),
168 weak_factory_for_io_(this) { 169 weak_factory_for_io_(this) {
169 DCHECK(stub_); 170 DCHECK(stub_);
170 stub_->AddDestructionObserver(this); 171 stub_->AddDestructionObserver(this);
171 get_gl_context_cb_ = base::Bind(&GetGLContext, stub_->AsWeakPtr()); 172 get_gl_context_cb_ = base::Bind(&GetGLContext, stub_->AsWeakPtr());
172 make_context_current_cb_ = 173 make_context_current_cb_ =
173 base::Bind(&MakeDecoderContextCurrent, stub_->AsWeakPtr()); 174 base::Bind(&MakeDecoderContextCurrent, stub_->AsWeakPtr());
174 #if (defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)) || defined(OS_MACOSX) 175 #if (defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)) || \
176 defined(OS_MACOSX) || defined(OS_WIN)
175 bind_image_cb_ = base::Bind(&BindImage, stub_->AsWeakPtr()); 177 bind_image_cb_ = base::Bind(&BindImage, stub_->AsWeakPtr());
176 #endif 178 #endif
177 get_gles2_decoder_cb_ = base::Bind(&GetGLES2Decoder, stub_->AsWeakPtr()); 179 get_gles2_decoder_cb_ = base::Bind(&GetGLES2Decoder, stub_->AsWeakPtr());
178 } 180 }
179 181
180 GpuVideoDecodeAccelerator::~GpuVideoDecodeAccelerator() { 182 GpuVideoDecodeAccelerator::~GpuVideoDecodeAccelerator() {
181 // This class can only be self-deleted from OnWillDestroyStub(), which means 183 // This class can only be self-deleted from OnWillDestroyStub(), which means
182 // the VDA has already been destroyed in there. 184 // the VDA has already been destroyed in there.
183 DCHECK(!video_decode_accelerator_); 185 DCHECK(!video_decode_accelerator_);
184 } 186 }
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 DCHECK(texture_ref->texture()->IsLevelCleared(target, 0)); 533 DCHECK(texture_ref->texture()->IsLevelCleared(target, 0));
532 } else { 534 } else {
533 DCHECK(!texture_ref->texture()->IsLevelCleared(target, 0)); 535 DCHECK(!texture_ref->texture()->IsLevelCleared(target, 0));
534 texture_manager->SetLevelCleared(texture_ref.get(), target, 0, true); 536 texture_manager->SetLevelCleared(texture_ref.get(), target, 0, true);
535 } 537 }
536 } 538 }
537 uncleared_textures_.erase(it); 539 uncleared_textures_.erase(it);
538 } 540 }
539 541
540 } // namespace media 542 } // namespace media
OLDNEW
« no previous file with comments | « media/gpu/gpu_video_decode_accelerator_factory.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698