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

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: if() -> #if 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 #if DCHECK_IS_ON
Nico 2014/03/12 21:16:42 keep this comment
Xianzhu 2014/03/12 21:39:13 Done.
59 // DCHECK is on. 59 typedef base::AutoLock DebugAutoLock;
60 #else
60 class DebugAutoLock { 61 class DebugAutoLock {
61 public: 62 public:
62 explicit DebugAutoLock(base::Lock& lock) : lock_(lock) { 63 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 }; 64 };
65 #endif
78 66
79 class GpuVideoDecodeAccelerator::MessageFilter 67 class GpuVideoDecodeAccelerator::MessageFilter
80 : public IPC::ChannelProxy::MessageFilter { 68 : public IPC::ChannelProxy::MessageFilter {
81 public: 69 public:
82 MessageFilter(GpuVideoDecodeAccelerator* owner, int32 host_route_id) 70 MessageFilter(GpuVideoDecodeAccelerator* owner, int32 host_route_id)
83 : owner_(owner), host_route_id_(host_route_id) {} 71 : owner_(owner), host_route_id_(host_route_id) {}
84 72
85 virtual void OnChannelError() OVERRIDE { channel_ = NULL; } 73 virtual void OnChannelError() OVERRIDE { channel_ = NULL; }
86 74
87 virtual void OnChannelClosing() OVERRIDE { channel_ = NULL; } 75 virtual void OnChannelClosing() OVERRIDE { channel_ = NULL; }
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 194
207 void GpuVideoDecodeAccelerator::PictureReady( 195 void GpuVideoDecodeAccelerator::PictureReady(
208 const media::Picture& picture) { 196 const media::Picture& picture) {
209 // VDA may call PictureReady on IO thread. SetTextureCleared should run on 197 // VDA may call PictureReady on IO thread. SetTextureCleared should run on
210 // the child thread. VDA is responsible to call PictureReady on the child 198 // the child thread. VDA is responsible to call PictureReady on the child
211 // thread when a picture buffer is delivered the first time. 199 // thread when a picture buffer is delivered the first time.
212 if (child_message_loop_->BelongsToCurrentThread()) { 200 if (child_message_loop_->BelongsToCurrentThread()) {
213 SetTextureCleared(picture); 201 SetTextureCleared(picture);
214 } else { 202 } else {
215 DCHECK(io_message_loop_->BelongsToCurrentThread()); 203 DCHECK(io_message_loop_->BelongsToCurrentThread());
216 if (DCHECK_IS_ON()) { 204 DebugAutoLock auto_lock(debug_uncleared_textures_lock_);
217 DebugAutoLock auto_lock(debug_uncleared_textures_lock_); 205 DCHECK_EQ(0u, uncleared_textures_.count(picture.picture_buffer_id()));
218 DCHECK_EQ(0u, uncleared_textures_.count(picture.picture_buffer_id()));
219 }
220 } 206 }
221 207
222 if (!Send(new AcceleratedVideoDecoderHostMsg_PictureReady( 208 if (!Send(new AcceleratedVideoDecoderHostMsg_PictureReady(
223 host_route_id_, 209 host_route_id_,
224 picture.picture_buffer_id(), 210 picture.picture_buffer_id(),
225 picture.bitstream_buffer_id()))) { 211 picture.bitstream_buffer_id()))) {
226 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_PictureReady) failed"; 212 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_PictureReady) failed";
227 } 213 }
228 } 214 }
229 215
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 scoped_refptr<gpu::gles2::TextureRef> texture_ref = it->second; 494 scoped_refptr<gpu::gles2::TextureRef> texture_ref = it->second;
509 GLenum target = texture_ref->texture()->target(); 495 GLenum target = texture_ref->texture()->target();
510 gpu::gles2::TextureManager* texture_manager = 496 gpu::gles2::TextureManager* texture_manager =
511 stub_->decoder()->GetContextGroup()->texture_manager(); 497 stub_->decoder()->GetContextGroup()->texture_manager();
512 DCHECK(!texture_ref->texture()->IsLevelCleared(target, 0)); 498 DCHECK(!texture_ref->texture()->IsLevelCleared(target, 0));
513 texture_manager->SetLevelCleared(texture_ref, target, 0, true); 499 texture_manager->SetLevelCleared(texture_ref, target, 0, true);
514 uncleared_textures_.erase(it); 500 uncleared_textures_.erase(it);
515 } 501 }
516 502
517 } // namespace content 503 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698