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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: content/common/gpu/media/gpu_video_decode_accelerator.cc
diff --git a/content/common/gpu/media/gpu_video_decode_accelerator.cc b/content/common/gpu/media/gpu_video_decode_accelerator.cc
index 9ec813983645bef94c86d0470861d9c00ce2ecae..342cf6b1aff3c9980b3a7d52ce988975b3b84564 100644
--- a/content/common/gpu/media/gpu_video_decode_accelerator.cc
+++ b/content/common/gpu/media/gpu_video_decode_accelerator.cc
@@ -55,26 +55,14 @@ static bool MakeDecoderContextCurrent(
return true;
}
-// A helper class that works like AutoLock but only acquires the lock when
Nico 2014/03/12 21:16:42 keep this comment
Xianzhu 2014/03/12 21:39:13 Done.
-// DCHECK is on.
+#if DCHECK_IS_ON
+typedef base::AutoLock DebugAutoLock;
+#else
class DebugAutoLock {
public:
- explicit DebugAutoLock(base::Lock& lock) : lock_(lock) {
- if (DCHECK_IS_ON())
- lock_.Acquire();
- }
-
- ~DebugAutoLock() {
- if (DCHECK_IS_ON()) {
- lock_.AssertAcquired();
- lock_.Release();
- }
- }
-
- private:
- base::Lock& lock_;
- DISALLOW_COPY_AND_ASSIGN(DebugAutoLock);
+ explicit DebugAutoLock(base::Lock&) {}
};
+#endif
class GpuVideoDecodeAccelerator::MessageFilter
: public IPC::ChannelProxy::MessageFilter {
@@ -213,10 +201,8 @@ void GpuVideoDecodeAccelerator::PictureReady(
SetTextureCleared(picture);
} else {
DCHECK(io_message_loop_->BelongsToCurrentThread());
- if (DCHECK_IS_ON()) {
- DebugAutoLock auto_lock(debug_uncleared_textures_lock_);
- DCHECK_EQ(0u, uncleared_textures_.count(picture.picture_buffer_id()));
- }
+ DebugAutoLock auto_lock(debug_uncleared_textures_lock_);
+ DCHECK_EQ(0u, uncleared_textures_.count(picture.picture_buffer_id()));
}
if (!Send(new AcceleratedVideoDecoderHostMsg_PictureReady(

Powered by Google App Engine
This is Rietveld 408576698