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

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

Issue 174033002: Add missing mutex protection for timeout queue with mutex (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add a couple of ASSERTs Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/bin/eventhandler_linux.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 BIN_EVENTHANDLER_H_ 5 #ifndef BIN_EVENTHANDLER_H_
6 #define BIN_EVENTHANDLER_H_ 6 #define BIN_EVENTHANDLER_H_
7 7
8 #include "bin/builtin.h" 8 #include "bin/builtin.h"
9 #include "bin/isolate_data.h" 9 #include "bin/isolate_data.h"
10 10
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 public: 58 public:
59 TimeoutQueue() : next_timeout_(NULL), timeouts_(NULL) {} 59 TimeoutQueue() : next_timeout_(NULL), timeouts_(NULL) {}
60 60
61 ~TimeoutQueue() { 61 ~TimeoutQueue() {
62 while (HasTimeout()) RemoveCurrent(); 62 while (HasTimeout()) RemoveCurrent();
63 } 63 }
64 64
65 bool HasTimeout() const { return next_timeout_ != NULL; } 65 bool HasTimeout() const { return next_timeout_ != NULL; }
66 66
67 int64_t CurrentTimeout() const { 67 int64_t CurrentTimeout() const {
68 ASSERT(next_timeout_ != NULL);
68 return next_timeout_->timeout(); 69 return next_timeout_->timeout();
69 } 70 }
70 71
71 Dart_Port CurrentPort() const { 72 Dart_Port CurrentPort() const {
73 ASSERT(next_timeout_ != NULL);
72 return next_timeout_->port(); 74 return next_timeout_->port();
73 } 75 }
74 76
75 void RemoveCurrent() { 77 void RemoveCurrent() {
76 UpdateTimeout(CurrentPort(), -1); 78 UpdateTimeout(CurrentPort(), -1);
77 } 79 }
78 80
79 void UpdateTimeout(Dart_Port port, int64_t timeout); 81 void UpdateTimeout(Dart_Port port, int64_t timeout);
80 82
81 private: 83 private:
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 125
124 private: 126 private:
125 friend class EventHandlerImplementation; 127 friend class EventHandlerImplementation;
126 EventHandlerImplementation delegate_; 128 EventHandlerImplementation delegate_;
127 }; 129 };
128 130
129 } // namespace bin 131 } // namespace bin
130 } // namespace dart 132 } // namespace dart
131 133
132 #endif // BIN_EVENTHANDLER_H_ 134 #endif // BIN_EVENTHANDLER_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/eventhandler_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698