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

Side by Side Diff: src/vm/event_handler.h

Issue 1375373004: Use the event-handler for timers. (Closed) Base URL: git@github.com:dart-lang/fletch.git@master
Patch Set: Created 5 years, 2 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 | « src/shared/natives.h ('k') | src/vm/event_handler_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) 2015, the Fletch project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Fletch 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.md file. 3 // BSD-style license that can be found in the LICENSE.md file.
4 4
5 #ifndef SRC_VM_EVENT_HANDLER_H_ 5 #ifndef SRC_VM_EVENT_HANDLER_H_
6 #define SRC_VM_EVENT_HANDLER_H_ 6 #define SRC_VM_EVENT_HANDLER_H_
7 7
8 #include "src/shared/globals.h" 8 #include "src/shared/globals.h"
9 #include "src/vm/hash_map.h"
9 #include "src/vm/thread.h" 10 #include "src/vm/thread.h"
10 11
11 namespace fletch { 12 namespace fletch {
12 13
13 class Monitor; 14 class Monitor;
14 class Port; 15 class Port;
15 16
16 class EventHandler { 17 class EventHandler {
17 public: 18 public:
18 enum { 19 enum {
19 READ_EVENT = 1 << 0, 20 READ_EVENT = 1 << 0,
20 WRITE_EVENT = 1 << 1, 21 WRITE_EVENT = 1 << 1,
21 CLOSE_EVENT = 1 << 2, 22 CLOSE_EVENT = 1 << 2,
22 ERROR_EVENT = 1 << 3, 23 ERROR_EVENT = 1 << 3,
23 }; 24 };
24 25
25 EventHandler(); 26 EventHandler();
26 ~EventHandler(); 27 ~EventHandler();
27 28
28 int GetEventHandler(); 29 int GetEventHandler();
29 30
31 void ScheduleTimeout(int64 timeout, Port* port);
32
30 Monitor* monitor() const { return monitor_; } 33 Monitor* monitor() const { return monitor_; }
31 34
32 int Create(); 35 int Create();
33 void Run(); 36 void Run();
34 37
35 private: 38 private:
36 Monitor* monitor_; 39 Monitor* monitor_;
37 int fd_; 40 int fd_;
38 ThreadIdentifier thread_; 41 ThreadIdentifier thread_;
39 42
43 HashMap<Port*, int64> timeouts_;
44 int64 next_timeout_;
45
40 int read_fd_; 46 int read_fd_;
41 int write_fd_; 47 int write_fd_;
42 48
49 void HandleTimeouts();
50
43 void Send(Port* port, uword mask); 51 void Send(Port* port, uword mask);
44 }; 52 };
45 53
46 } // namespace fletch 54 } // namespace fletch
47 55
48 #endif // SRC_VM_EVENT_HANDLER_H_ 56 #endif // SRC_VM_EVENT_HANDLER_H_
OLDNEW
« no previous file with comments | « src/shared/natives.h ('k') | src/vm/event_handler_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698