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

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

Issue 9029001: Add close to input stream and cleanup socket and streams (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments by ager@ Created 8 years, 11 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/file.dart » ('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_LINUX_H_ 5 #ifndef BIN_EVENTHANDLER_LINUX_H_
6 #define BIN_EVENTHANDLER_LINUX_H_ 6 #define BIN_EVENTHANDLER_LINUX_H_
7 7
8 #include <unistd.h> 8 #include <unistd.h>
9 #include <sys/socket.h> 9 #include <sys/socket.h>
10 10
(...skipping 28 matching lines...) Expand all
39 39
40 void ShutdownWrite() { 40 void ShutdownWrite() {
41 shutdown(fd_, SHUT_WR); 41 shutdown(fd_, SHUT_WR);
42 MarkClosedWrite(); 42 MarkClosedWrite();
43 } 43 }
44 44
45 void Close() { 45 void Close() {
46 Unregister(); 46 Unregister();
47 flags_ = 0; 47 flags_ = 0;
48 close(fd_); 48 close(fd_);
49 fd_ = 0; 49 fd_ = -1;
50 } 50 }
51 51
52 bool IsListeningSocket() { return (mask_ & (1 << kListeningSocket)) != 0; } 52 bool IsListeningSocket() { return (mask_ & (1 << kListeningSocket)) != 0; }
53 bool IsPipe() { return (mask_ & (1 << kPipe)) != 0; } 53 bool IsPipe() { return (mask_ & (1 << kPipe)) != 0; }
54 bool IsClosedRead() { return (flags_ & (1 << kClosedRead)) != 0; } 54 bool IsClosedRead() { return (flags_ & (1 << kClosedRead)) != 0; }
55 bool IsClosedWrite() { return (flags_ & (1 << kClosedWrite)) != 0; } 55 bool IsClosedWrite() { return (flags_ & (1 << kClosedWrite)) != 0; }
56 56
57 void MarkClosedRead() { flags_ |= (1 << kClosedRead); } 57 void MarkClosedRead() { flags_ |= (1 << kClosedRead); }
58 void MarkClosedWrite() { flags_ |= (1 << kClosedWrite); } 58 void MarkClosedWrite() { flags_ |= (1 << kClosedWrite); }
59 59
60 bool HasPollEvents() { return mask_ != 0; } 60 bool HasPollEvents() { return mask_ != 0; }
61 61
62 void SetPortAndMask(Dart_Port port, intptr_t mask) { 62 void SetPortAndMask(Dart_Port port, intptr_t mask) {
63 ASSERT(fd_ != -1);
63 port_ = port; 64 port_ = port;
64 mask_ = mask; 65 mask_ = mask;
65 } 66 }
66 67
67 intptr_t fd() { return fd_; } 68 intptr_t fd() { return fd_; }
68 void set_fd(intptr_t fd) { fd_ = fd; } 69 void set_fd(intptr_t fd) { fd_ = fd; }
69 Dart_Port port() { return port_; } 70 Dart_Port port() { return port_; }
70 intptr_t mask() { return mask_; } 71 intptr_t mask() { return mask_; }
71 72
72 private: 73 private:
(...skipping 27 matching lines...) Expand all
100 101
101 SocketData* socket_map_; 102 SocketData* socket_map_;
102 intptr_t socket_map_size_; 103 intptr_t socket_map_size_;
103 int64_t timeout_; // Time for next timeout. 104 int64_t timeout_; // Time for next timeout.
104 Dart_Port timeout_port_; 105 Dart_Port timeout_port_;
105 int interrupt_fds_[2]; 106 int interrupt_fds_[2];
106 }; 107 };
107 108
108 109
109 #endif // BIN_EVENTHANDLER_LINUX_H_ 110 #endif // BIN_EVENTHANDLER_LINUX_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/file.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698