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

Side by Side Diff: third_party/WebKit/Source/wtf/SpinLock.h

Issue 1436153002: Apply clang-format with Chromium-style without column limit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 28 matching lines...) Expand all
39 // should be using a real lock. 39 // should be using a real lock.
40 40
41 #include "wtf/Atomics.h" 41 #include "wtf/Atomics.h"
42 42
43 namespace WTF { 43 namespace WTF {
44 44
45 // This is called if the initial attempt to acquire the lock fails. It's a bit 45 // This is called if the initial attempt to acquire the lock fails. It's a bit
46 // slower, but has a much better scheduling and power consumption behavior. 46 // slower, but has a much better scheduling and power consumption behavior.
47 WTF_EXPORT void slowSpinLockLock(int volatile* lock); 47 WTF_EXPORT void slowSpinLockLock(int volatile* lock);
48 48
49 ALWAYS_INLINE void spinLockLock(int volatile* lock) 49 ALWAYS_INLINE void spinLockLock(int volatile* lock) {
50 { 50 if (LIKELY(!atomicTestAndSetToOne(lock)))
51 if (LIKELY(!atomicTestAndSetToOne(lock))) 51 return;
52 return; 52 slowSpinLockLock(lock);
53 slowSpinLockLock(lock);
54 } 53 }
55 54
56 ALWAYS_INLINE void spinLockUnlock(int volatile* lock) 55 ALWAYS_INLINE void spinLockUnlock(int volatile* lock) {
57 { 56 atomicSetOneToZero(lock);
58 atomicSetOneToZero(lock);
59 } 57 }
60 58
61 } // namespace WTF 59 } // namespace WTF
62 60
63 using WTF::spinLockLock; 61 using WTF::spinLockLock;
64 using WTF::spinLockUnlock; 62 using WTF::spinLockUnlock;
65 63
66 #endif // WTF_SpinLock_h 64 #endif // WTF_SpinLock_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/SizeLimits.cpp ('k') | third_party/WebKit/Source/wtf/SpinLock.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698