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

Side by Side Diff: base/synchronization/lock.h

Issue 292873002: make debug mode ~20% faster on linux (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: win fix Created 6 years, 7 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
« no previous file with comments | « no previous file | base/synchronization/lock.cc » ('j') | base/synchronization/lock.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef BASE_SYNCHRONIZATION_LOCK_H_ 5 #ifndef BASE_SYNCHRONIZATION_LOCK_H_
6 #define BASE_SYNCHRONIZATION_LOCK_H_ 6 #define BASE_SYNCHRONIZATION_LOCK_H_
7 7
8 #include "base/base_export.h" 8 #include "base/base_export.h"
9 #include "base/synchronization/lock_impl.h" 9 #include "base/synchronization/lock_impl.h"
10 #include "base/threading/platform_thread.h" 10 #include "base/threading/platform_thread.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 // Members and routines taking care of locks assertions. 73 // Members and routines taking care of locks assertions.
74 // Note that this checks for recursive locks and allows them 74 // Note that this checks for recursive locks and allows them
75 // if the variable is set. This is allowed by the underlying implementation 75 // if the variable is set. This is allowed by the underlying implementation
76 // on windows but not on Posix, so we're doing unneeded checks on Posix. 76 // on windows but not on Posix, so we're doing unneeded checks on Posix.
77 // It's worth it to share the code. 77 // It's worth it to share the code.
78 void CheckHeldAndUnmark(); 78 void CheckHeldAndUnmark();
79 void CheckUnheldAndMark(); 79 void CheckUnheldAndMark();
80 80
81 // All private data is implicitly protected by lock_. 81 // All private data is implicitly protected by lock_.
82 // Be VERY careful to only access members under that lock. 82 // Be VERY careful to only access members under that lock.
83 83 base::PlatformThreadRef owning_thread_ref_;
84 // Determines validity of owning_thread_id_. Needed as we don't have
85 // a null owning_thread_id_ value.
86 bool owned_by_thread_;
87 base::PlatformThreadId owning_thread_id_;
88 #endif // NDEBUG 84 #endif // NDEBUG
89 85
90 // Platform specific underlying lock implementation. 86 // Platform specific underlying lock implementation.
91 internal::LockImpl lock_; 87 internal::LockImpl lock_;
92 88
93 DISALLOW_COPY_AND_ASSIGN(Lock); 89 DISALLOW_COPY_AND_ASSIGN(Lock);
94 }; 90 };
95 91
96 // A helper class that acquires the given Lock while the AutoLock is in scope. 92 // A helper class that acquires the given Lock while the AutoLock is in scope.
97 class AutoLock { 93 class AutoLock {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 } 127 }
132 128
133 private: 129 private:
134 Lock& lock_; 130 Lock& lock_;
135 DISALLOW_COPY_AND_ASSIGN(AutoUnlock); 131 DISALLOW_COPY_AND_ASSIGN(AutoUnlock);
136 }; 132 };
137 133
138 } // namespace base 134 } // namespace base
139 135
140 #endif // BASE_SYNCHRONIZATION_LOCK_H_ 136 #endif // BASE_SYNCHRONIZATION_LOCK_H_
OLDNEW
« no previous file with comments | « no previous file | base/synchronization/lock.cc » ('j') | base/synchronization/lock.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698