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

Side by Side Diff: runtime/bin/lockers.h

Issue 2974233002: VM: Re-format to use at most one newline between functions (Closed)
Patch Set: Rebase and merge Created 3 years, 5 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 | « runtime/bin/loader.cc ('k') | runtime/bin/main.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef RUNTIME_BIN_LOCKERS_H_ 5 #ifndef RUNTIME_BIN_LOCKERS_H_
6 #define RUNTIME_BIN_LOCKERS_H_ 6 #define RUNTIME_BIN_LOCKERS_H_
7 7
8 #include "bin/thread.h" 8 #include "bin/thread.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 10
11 namespace dart { 11 namespace dart {
12 namespace bin { 12 namespace bin {
13 13
14 class MutexLocker { 14 class MutexLocker {
15 public: 15 public:
16 explicit MutexLocker(Mutex* mutex) : mutex_(mutex) { 16 explicit MutexLocker(Mutex* mutex) : mutex_(mutex) {
17 ASSERT(mutex != NULL); 17 ASSERT(mutex != NULL);
18 mutex_->Lock(); 18 mutex_->Lock();
19 } 19 }
20 20
21 virtual ~MutexLocker() { mutex_->Unlock(); } 21 virtual ~MutexLocker() { mutex_->Unlock(); }
22 22
23 private: 23 private:
24 Mutex* const mutex_; 24 Mutex* const mutex_;
25 25
26 DISALLOW_COPY_AND_ASSIGN(MutexLocker); 26 DISALLOW_COPY_AND_ASSIGN(MutexLocker);
27 }; 27 };
28 28
29
30 class MonitorLocker { 29 class MonitorLocker {
31 public: 30 public:
32 explicit MonitorLocker(Monitor* monitor) : monitor_(monitor) { 31 explicit MonitorLocker(Monitor* monitor) : monitor_(monitor) {
33 ASSERT(monitor != NULL); 32 ASSERT(monitor != NULL);
34 monitor_->Enter(); 33 monitor_->Enter();
35 } 34 }
36 35
37 virtual ~MonitorLocker() { monitor_->Exit(); } 36 virtual ~MonitorLocker() { monitor_->Exit(); }
38 37
39 Monitor::WaitResult Wait(int64_t millis = Monitor::kNoTimeout) { 38 Monitor::WaitResult Wait(int64_t millis = Monitor::kNoTimeout) {
40 return monitor_->Wait(millis); 39 return monitor_->Wait(millis);
41 } 40 }
42 41
43 void Notify() { monitor_->Notify(); } 42 void Notify() { monitor_->Notify(); }
44 43
45 void NotifyAll() { monitor_->NotifyAll(); } 44 void NotifyAll() { monitor_->NotifyAll(); }
46 45
47 private: 46 private:
48 Monitor* const monitor_; 47 Monitor* const monitor_;
49 48
50 DISALLOW_COPY_AND_ASSIGN(MonitorLocker); 49 DISALLOW_COPY_AND_ASSIGN(MonitorLocker);
51 }; 50 };
52 51
53 } // namespace bin 52 } // namespace bin
54 } // namespace dart 53 } // namespace dart
55 54
56 #endif // RUNTIME_BIN_LOCKERS_H_ 55 #endif // RUNTIME_BIN_LOCKERS_H_
OLDNEW
« no previous file with comments | « runtime/bin/loader.cc ('k') | runtime/bin/main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698