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

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

Issue 8431027: Some Linux and Mac OS event handler refactoring (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments from ager£ Created 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/bin/eventhandler.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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 9
10 // The event handler delegation class is OS specific.
11 #if defined(TARGET_OS_LINUX)
12 #include "bin/eventhandler_linux.h"
13 #elif defined(TARGET_OS_MACOS)
14 #include "bin/eventhandler_macos.h"
15 #elif defined(TARGET_OS_WINDOWS)
16 #include "bin/eventhandler_win.h"
17 #else
18 #error Unknown target os.
19 #endif
20
21 // Flags used to provide information and actions to the eventhandler 10 // Flags used to provide information and actions to the eventhandler
22 // when sending a message about a file descriptor. These flags should 11 // when sending a message about a file descriptor. These flags should
23 // be kept in sync with the constants in socket_impl.dart. For more 12 // be kept in sync with the constants in socket_impl.dart. For more
24 // information see the comments in socket_impl.dart 13 // information see the comments in socket_impl.dart
25 enum MessageFlags { 14 enum MessageFlags {
26 kInEvent = 0, 15 kInEvent = 0,
27 kOutEvent = 1, 16 kOutEvent = 1,
28 kErrorEvent = 2, 17 kErrorEvent = 2,
29 kCloseEvent = 3, 18 kCloseEvent = 3,
30 kCloseCommand = 8, 19 kCloseCommand = 8,
31 kListeningSocket = 16, 20 kListeningSocket = 16,
32 }; 21 };
33 22
34 23
24 // The event handler delegation class is OS specific.
25 #if defined(TARGET_OS_LINUX)
26 #include "bin/eventhandler_linux.h"
27 #elif defined(TARGET_OS_MACOS)
28 #include "bin/eventhandler_macos.h"
29 #elif defined(TARGET_OS_WINDOWS)
30 #include "bin/eventhandler_win.h"
31 #else
32 #error Unknown target os.
33 #endif
34
35 class EventHandler { 35 class EventHandler {
36 public: 36 public:
37 void SendData(intptr_t id, Dart_Port dart_port, intptr_t data) { 37 void SendData(intptr_t id, Dart_Port dart_port, intptr_t data) {
38 delegate_.SendData(id, dart_port, data); 38 delegate_.SendData(id, dart_port, data);
39 } 39 }
40 40
41 static EventHandler* StartEventHandler() { 41 static EventHandler* StartEventHandler() {
42 EventHandler* handler = new EventHandler(); 42 EventHandler* handler = new EventHandler();
43 handler->delegate_.StartEventHandler(); 43 handler->delegate_.StartEventHandler();
44 return handler; 44 return handler;
45 } 45 }
46 46
47 private: 47 private:
48 EventHandlerImplementation delegate_; 48 EventHandlerImplementation delegate_;
49 }; 49 };
50 50
51 51
52 #endif // BIN_EVENTHANDLER_H_ 52 #endif // BIN_EVENTHANDLER_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/eventhandler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698