Chromium Code Reviews

Side by Side Diff: base/lock_impl_win.cc

Issue 3176026: FBTF: Remove unneeded headers from base/ (part 7) (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | Annotate | Revision Log
« no previous file with comments | « base/file_version_info_mac.mm ('k') | base/message_pump_glib_unittest.cc » ('j') | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "base/lock_impl.h" 5 #include "base/lock_impl.h"
6 #include "base/logging.h"
7 6
8 LockImpl::LockImpl() { 7 LockImpl::LockImpl() {
9 // The second parameter is the spin count, for short-held locks it avoid the 8 // The second parameter is the spin count, for short-held locks it avoid the
10 // contending thread from going to sleep which helps performance greatly. 9 // contending thread from going to sleep which helps performance greatly.
11 ::InitializeCriticalSectionAndSpinCount(&os_lock_, 2000); 10 ::InitializeCriticalSectionAndSpinCount(&os_lock_, 2000);
12 } 11 }
13 12
14 LockImpl::~LockImpl() { 13 LockImpl::~LockImpl() {
15 ::DeleteCriticalSection(&os_lock_); 14 ::DeleteCriticalSection(&os_lock_);
16 } 15 }
17 16
18 bool LockImpl::Try() { 17 bool LockImpl::Try() {
19 if (::TryEnterCriticalSection(&os_lock_) != FALSE) { 18 if (::TryEnterCriticalSection(&os_lock_) != FALSE) {
20 return true; 19 return true;
21 } 20 }
22 return false; 21 return false;
23 } 22 }
24 23
25 void LockImpl::Lock() { 24 void LockImpl::Lock() {
26 ::EnterCriticalSection(&os_lock_); 25 ::EnterCriticalSection(&os_lock_);
27 } 26 }
28 27
29 void LockImpl::Unlock() { 28 void LockImpl::Unlock() {
30 ::LeaveCriticalSection(&os_lock_); 29 ::LeaveCriticalSection(&os_lock_);
31 } 30 }
32
OLDNEW
« no previous file with comments | « base/file_version_info_mac.mm ('k') | base/message_pump_glib_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine