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

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

Issue 11606020: Reapply "Fixes to eventhandler and HTTP"" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove invalid assert (fixes Windows test) 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; }
162 void MarkClosing() { flags_ |= (1 << kClosing); } 163 void MarkClosing() { flags_ |= (1 << kClosing); }
163 void MarkClosedRead() { flags_ |= (1 << kCloseRead); } 164 void MarkClosedRead() { flags_ |= (1 << kCloseRead); }
164 void MarkClosedWrite() { flags_ |= (1 << kCloseWrite); } 165 void MarkClosedWrite() { flags_ |= (1 << kCloseWrite); }
166 void MarkError() { flags_ |= (1 << kError); }
165 167
166 virtual void EnsureInitialized( 168 virtual void EnsureInitialized(
167 EventHandlerImplementation* event_handler) = 0; 169 EventHandlerImplementation* event_handler) = 0;
168 170
169 HANDLE handle() { return handle_; } 171 HANDLE handle() { return handle_; }
170 Dart_Port port() { return port_; } 172 Dart_Port port() { return port_; }
171 EventHandlerImplementation* event_handler() { return event_handler_; } 173 EventHandlerImplementation* event_handler() { return event_handler_; }
172 174
173 void Lock(); 175 void Lock();
174 void Unlock(); 176 void Unlock();
175 177
176 bool CreateCompletionPort(HANDLE completion_port); 178 bool CreateCompletionPort(HANDLE completion_port);
177 179
178 void close(); 180 void close();
179 virtual bool IsClosed() = 0; 181 virtual bool IsClosed() = 0;
180 182
181 void SetPortAndMask(Dart_Port port, intptr_t mask) { 183 void SetPortAndMask(Dart_Port port, intptr_t mask) {
182 port_ = port; 184 port_ = port;
183 mask_ = mask; 185 mask_ = mask;
184 } 186 }
185 Type type() { return type_; } 187 Type type() { return type_; }
186 bool is_file() { return type_ == kFile; } 188 bool is_file() { return type_ == kFile; }
187 bool is_socket() { return type_ == kListenSocket || type_ == kClientSocket; } 189 bool is_socket() { return type_ == kListenSocket || type_ == kClientSocket; }
188 bool is_listen_socket() { return type_ == kListenSocket; } 190 bool is_listen_socket() { return type_ == kListenSocket; }
189 bool is_client_socket() { return type_ == kClientSocket; } 191 bool is_client_socket() { return type_ == kClientSocket; }
192 void set_mask(intptr_t mask) { mask_ = mask; }
190 intptr_t mask() { return mask_; } 193 intptr_t mask() { return mask_; }
191 194
192 void MarkDoesNotSupportOverlappedIO() { 195 void MarkDoesNotSupportOverlappedIO() {
193 flags_ |= (1 << kDoesNotSupportOverlappedIO); 196 flags_ |= (1 << kDoesNotSupportOverlappedIO);
194 } 197 }
195 bool SupportsOverlappedIO() { 198 bool SupportsOverlappedIO() {
196 return (flags_ & (1 << kDoesNotSupportOverlappedIO)) == 0; 199 return (flags_ & (1 << kDoesNotSupportOverlappedIO)) == 0;
197 } 200 }
198 201
199 void ReadSyncCompleteAsync(); 202 void ReadSyncCompleteAsync();
200 203
201 DWORD last_error() { return last_error_; } 204 DWORD last_error() { return last_error_; }
202 void set_last_error(DWORD last_error) { last_error_ = last_error; } 205 void set_last_error(DWORD last_error) { last_error_ = last_error; }
203 206
204 protected: 207 protected:
205 enum Flags { 208 enum Flags {
206 kClosing = 0, 209 kClosing = 0,
207 kCloseRead = 1, 210 kCloseRead = 1,
208 kCloseWrite = 2, 211 kCloseWrite = 2,
209 kDoesNotSupportOverlappedIO = 3 212 kDoesNotSupportOverlappedIO = 3,
213 kError = 4
210 }; 214 };
211 215
212 explicit Handle(HANDLE handle); 216 explicit Handle(HANDLE handle);
213 Handle(HANDLE handle, Dart_Port port); 217 Handle(HANDLE handle, Dart_Port port);
214 218
215 virtual void AfterClose() = 0; 219 virtual void AfterClose() = 0;
216 220
217 Type type_; 221 Type type_;
218 HANDLE handle_; 222 HANDLE handle_;
219 Dart_Port port_; // Dart port to communicate events for this socket. 223 Dart_Port port_; // Dart port to communicate events for this socket.
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 ClientSocket* client_sockets_head_; 373 ClientSocket* client_sockets_head_;
370 374
371 int64_t timeout_; // Time for next timeout. 375 int64_t timeout_; // Time for next timeout.
372 Dart_Port timeout_port_; 376 Dart_Port timeout_port_;
373 bool shutdown_; 377 bool shutdown_;
374 HANDLE completion_port_; 378 HANDLE completion_port_;
375 }; 379 };
376 380
377 381
378 #endif // BIN_EVENTHANDLER_WIN_H_ 382 #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