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

Side by Side Diff: content/common/gpu/media/gpu_video_decode_accelerator.cc

Issue 195973002: Change DCHECK_IS_ON() to DCHECK_IS_ON (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Keep a comment Created 6 years, 9 months 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 | Annotate | Revision Log
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 "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/command_line.h" 10 #include "base/command_line.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 } 48 }
49 49
50 if (!stub->decoder()->MakeCurrent()) { 50 if (!stub->decoder()->MakeCurrent()) {
51 DLOG(ERROR) << "Failed to MakeCurrent()"; 51 DLOG(ERROR) << "Failed to MakeCurrent()";
52 return false; 52 return false;
53 } 53 }
54 54
55 return true; 55 return true;
56 } 56 }
57 57
58 // A helper class that works like AutoLock but only acquires the lock when 58 // DebugAutoLock works like AutoLock but only acquires the lock when
59 // DCHECK is on. 59 // DCHECK is on.
60 #if DCHECK_IS_ON
61 typedef base::AutoLock DebugAutoLock;
62 #else
60 class DebugAutoLock { 63 class DebugAutoLock {
61 public: 64 public:
62 explicit DebugAutoLock(base::Lock& lock) : lock_(lock) { 65 explicit DebugAutoLock(base::Lock&) {}
63 if (DCHECK_IS_ON())
64 lock_.Acquire();
65 }
66
67 ~DebugAutoLock() {
68 if (DCHECK_IS_ON()) {
69 lock_.AssertAcquired();
70 lock_.Release();
71 }
72 }
73
74 private:
75 base::Lock& lock_;
76 DISALLOW_COPY_AND_ASSIGN(DebugAutoLock);
77 }; 66 };
67 #endif
78 68
79 class GpuVideoDecodeAccelerator::MessageFilter 69 class GpuVideoDecodeAccelerator::MessageFilter
80 : public IPC::ChannelProxy::MessageFilter { 70 : public IPC::ChannelProxy::MessageFilter {
81 public: 71 public:
82 MessageFilter(GpuVideoDecodeAccelerator* owner, int32 host_route_id) 72 MessageFilter(GpuVideoDecodeAccelerator* owner, int32 host_route_id)
83 : owner_(owner), host_route_id_(host_route_id) {} 73 : owner_(owner), host_route_id_(host_route_id) {}
84 74
85 virtual void OnChannelError() OVERRIDE { channel_ = NULL; } 75 virtual void OnChannelError() OVERRIDE { channel_ = NULL; }
86 76
87 virtual void OnChannelClosing() OVERRIDE { channel_ = NULL; } 77 virtual void OnChannelClosing() OVERRIDE { channel_ = NULL; }
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 196
207 void GpuVideoDecodeAccelerator::PictureReady( 197 void GpuVideoDecodeAccelerator::PictureReady(
208 const media::Picture& picture) { 198 const media::Picture& picture) {
209 // VDA may call PictureReady on IO thread. SetTextureCleared should run on 199 // VDA may call PictureReady on IO thread. SetTextureCleared should run on
210 // the child thread. VDA is responsible to call PictureReady on the child 200 // the child thread. VDA is responsible to call PictureReady on the child
211 // thread when a picture buffer is delivered the first time. 201 // thread when a picture buffer is delivered the first time.
212 if (child_message_loop_->BelongsToCurrentThread()) { 202 if (child_message_loop_->BelongsToCurrentThread()) {
213 SetTextureCleared(picture); 203 SetTextureCleared(picture);
214 } else { 204 } else {
215 DCHECK(io_message_loop_->BelongsToCurrentThread()); 205 DCHECK(io_message_loop_->BelongsToCurrentThread());
216 if (DCHECK_IS_ON()) { 206 DebugAutoLock auto_lock(debug_uncleared_textures_lock_);
217 DebugAutoLock auto_lock(debug_uncleared_textures_lock_); 207 DCHECK_EQ(0u, uncleared_textures_.count(picture.picture_buffer_id()));
218 DCHECK_EQ(0u, uncleared_textures_.count(picture.picture_buffer_id()));
219 }
220 } 208 }
221 209
222 if (!Send(new AcceleratedVideoDecoderHostMsg_PictureReady( 210 if (!Send(new AcceleratedVideoDecoderHostMsg_PictureReady(
223 host_route_id_, 211 host_route_id_,
224 picture.picture_buffer_id(), 212 picture.picture_buffer_id(),
225 picture.bitstream_buffer_id()))) { 213 picture.bitstream_buffer_id()))) {
226 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_PictureReady) failed"; 214 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_PictureReady) failed";
227 } 215 }
228 } 216 }
229 217
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 scoped_refptr<gpu::gles2::TextureRef> texture_ref = it->second; 496 scoped_refptr<gpu::gles2::TextureRef> texture_ref = it->second;
509 GLenum target = texture_ref->texture()->target(); 497 GLenum target = texture_ref->texture()->target();
510 gpu::gles2::TextureManager* texture_manager = 498 gpu::gles2::TextureManager* texture_manager =
511 stub_->decoder()->GetContextGroup()->texture_manager(); 499 stub_->decoder()->GetContextGroup()->texture_manager();
512 DCHECK(!texture_ref->texture()->IsLevelCleared(target, 0)); 500 DCHECK(!texture_ref->texture()->IsLevelCleared(target, 0));
513 texture_manager->SetLevelCleared(texture_ref, target, 0, true); 501 texture_manager->SetLevelCleared(texture_ref, target, 0, true);
514 uncleared_textures_.erase(it); 502 uncleared_textures_.erase(it);
515 } 503 }
516 504
517 } // namespace content 505 } // namespace content
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/logging_native_handler.cc ('k') | content/renderer/media/webmediaplayer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698