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

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

Issue 11614028: Revert "Fixes to eventhandler and HTTP" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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_win.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_WIN_H_ 5 #ifndef BIN_EVENTHANDLER_WIN_H_
6 #define BIN_EVENTHANDLER_WIN_H_ 6 #define BIN_EVENTHANDLER_WIN_H_
7 7
8 #if !defined(BIN_EVENTHANDLER_H_) 8 #if !defined(BIN_EVENTHANDLER_H_)
9 #error Do not include eventhandler_win.h directly; use eventhandler.h instead. 9 #error Do not include eventhandler_win.h directly; use eventhandler.h instead.
10 #endif 10 #endif
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 virtual bool IssueRead(); 152 virtual bool IssueRead();
153 virtual bool IssueWrite(); 153 virtual bool IssueWrite();
154 bool HasPendingRead(); 154 bool HasPendingRead();
155 bool HasPendingWrite(); 155 bool HasPendingWrite();
156 void ReadComplete(IOBuffer* buffer); 156 void ReadComplete(IOBuffer* buffer);
157 void WriteComplete(IOBuffer* buffer); 157 void WriteComplete(IOBuffer* buffer);
158 158
159 bool IsClosing() { return (flags_ & (1 << kClosing)) != 0; } 159 bool IsClosing() { return (flags_ & (1 << kClosing)) != 0; }
160 bool IsClosedRead() { return (flags_ & (1 << kCloseRead)) != 0; } 160 bool IsClosedRead() { return (flags_ & (1 << kCloseRead)) != 0; }
161 bool IsClosedWrite() { return (flags_ & (1 << kCloseWrite)) != 0; } 161 bool IsClosedWrite() { return (flags_ & (1 << kCloseWrite)) != 0; }
162 bool IsError() { return (flags_ & (1 << kError)) != 0; }
163 void MarkClosing() { flags_ |= (1 << kClosing); } 162 void MarkClosing() { flags_ |= (1 << kClosing); }
164 void MarkClosedRead() { flags_ |= (1 << kCloseRead); } 163 void MarkClosedRead() { flags_ |= (1 << kCloseRead); }
165 void MarkClosedWrite() { flags_ |= (1 << kCloseWrite); } 164 void MarkClosedWrite() { flags_ |= (1 << kCloseWrite); }
166 void MarkError() { flags_ |= (1 << kError); }
167 165
168 virtual void EnsureInitialized( 166 virtual void EnsureInitialized(
169 EventHandlerImplementation* event_handler) = 0; 167 EventHandlerImplementation* event_handler) = 0;
170 168
171 HANDLE handle() { return handle_; } 169 HANDLE handle() { return handle_; }
172 Dart_Port port() { return port_; } 170 Dart_Port port() { return port_; }
173 EventHandlerImplementation* event_handler() { return event_handler_; } 171 EventHandlerImplementation* event_handler() { return event_handler_; }
174 172
175 void Lock(); 173 void Lock();
176 void Unlock(); 174 void Unlock();
177 175
178 bool CreateCompletionPort(HANDLE completion_port); 176 bool CreateCompletionPort(HANDLE completion_port);
179 177
180 void close(); 178 void close();
181 virtual bool IsClosed() = 0; 179 virtual bool IsClosed() = 0;
182 180
183 void SetPortAndMask(Dart_Port port, intptr_t mask) { 181 void SetPortAndMask(Dart_Port port, intptr_t mask) {
184 port_ = port; 182 port_ = port;
185 mask_ = mask; 183 mask_ = mask;
186 } 184 }
187 Type type() { return type_; } 185 Type type() { return type_; }
188 bool is_file() { return type_ == kFile; } 186 bool is_file() { return type_ == kFile; }
189 bool is_socket() { return type_ == kListenSocket || type_ == kClientSocket; } 187 bool is_socket() { return type_ == kListenSocket || type_ == kClientSocket; }
190 bool is_listen_socket() { return type_ == kListenSocket; } 188 bool is_listen_socket() { return type_ == kListenSocket; }
191 bool is_client_socket() { return type_ == kClientSocket; } 189 bool is_client_socket() { return type_ == kClientSocket; }
192 void set_mask(intptr_t mask) { mask_ = mask; }
193 intptr_t mask() { return mask_; } 190 intptr_t mask() { return mask_; }
194 191
195 void MarkDoesNotSupportOverlappedIO() { 192 void MarkDoesNotSupportOverlappedIO() {
196 flags_ |= (1 << kDoesNotSupportOverlappedIO); 193 flags_ |= (1 << kDoesNotSupportOverlappedIO);
197 } 194 }
198 bool SupportsOverlappedIO() { 195 bool SupportsOverlappedIO() {
199 return (flags_ & (1 << kDoesNotSupportOverlappedIO)) == 0; 196 return (flags_ & (1 << kDoesNotSupportOverlappedIO)) == 0;
200 } 197 }
201 198
202 void ReadSyncCompleteAsync(); 199 void ReadSyncCompleteAsync();
203 200
204 DWORD last_error() { return last_error_; } 201 DWORD last_error() { return last_error_; }
205 void set_last_error(DWORD last_error) { last_error_ = last_error; } 202 void set_last_error(DWORD last_error) { last_error_ = last_error; }
206 203
207 protected: 204 protected:
208 enum Flags { 205 enum Flags {
209 kClosing = 0, 206 kClosing = 0,
210 kCloseRead = 1, 207 kCloseRead = 1,
211 kCloseWrite = 2, 208 kCloseWrite = 2,
212 kDoesNotSupportOverlappedIO = 3, 209 kDoesNotSupportOverlappedIO = 3
213 kError = 4
214 }; 210 };
215 211
216 explicit Handle(HANDLE handle); 212 explicit Handle(HANDLE handle);
217 Handle(HANDLE handle, Dart_Port port); 213 Handle(HANDLE handle, Dart_Port port);
218 214
219 virtual void AfterClose() = 0; 215 virtual void AfterClose() = 0;
220 216
221 Type type_; 217 Type type_;
222 HANDLE handle_; 218 HANDLE handle_;
223 Dart_Port port_; // Dart port to communicate events for this socket. 219 Dart_Port port_; // Dart port to communicate events for this socket.
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 ClientSocket* client_sockets_head_; 369 ClientSocket* client_sockets_head_;
374 370
375 int64_t timeout_; // Time for next timeout. 371 int64_t timeout_; // Time for next timeout.
376 Dart_Port timeout_port_; 372 Dart_Port timeout_port_;
377 bool shutdown_; 373 bool shutdown_;
378 HANDLE completion_port_; 374 HANDLE completion_port_;
379 }; 375 };
380 376
381 377
382 #endif // BIN_EVENTHANDLER_WIN_H_ 378 #endif // BIN_EVENTHANDLER_WIN_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/eventhandler_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698