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

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

Issue 313083004: Don't use same value for socket() and handle(), as they are different concepts. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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/eventhandler_win.cc » ('j') | runtime/bin/eventhandler_win.cc » ('J')
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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 221
222 virtual void EnsureInitialized( 222 virtual void EnsureInitialized(
223 EventHandlerImplementation* event_handler) = 0; 223 EventHandlerImplementation* event_handler) = 0;
224 224
225 HANDLE handle() { return handle_; } 225 HANDLE handle() { return handle_; }
226 Dart_Port port() { return port_; } 226 Dart_Port port() { return port_; }
227 227
228 void Lock(); 228 void Lock();
229 void Unlock(); 229 void Unlock();
230 230
231 bool CreateCompletionPort(HANDLE completion_port); 231 virtual bool CreateCompletionPort(HANDLE completion_port);
232 232
233 void Close(); 233 void Close();
234 virtual void DoClose(); 234 virtual void DoClose();
235 virtual bool IsClosed() = 0; 235 virtual bool IsClosed() = 0;
236 236
237 bool IsHandleClosed() const { return handle_ == INVALID_HANDLE_VALUE; } 237 bool IsHandleClosed() const { return handle_ == INVALID_HANDLE_VALUE; }
238 238
239 void SetPortAndMask(Dart_Port port, intptr_t mask) { 239 void SetPortAndMask(Dart_Port port, intptr_t mask) {
240 port_ = port; 240 port_ = port;
241 mask_ = mask; 241 mask_ = mask;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 void Stop(); 354 void Stop();
355 355
356 private: 356 private:
357 int events_; 357 int events_;
358 bool recursive_; 358 bool recursive_;
359 }; 359 };
360 360
361 361
362 class SocketHandle : public Handle { 362 class SocketHandle : public Handle {
363 public: 363 public:
364 SOCKET socket() { return reinterpret_cast<SOCKET>(handle_); } 364 SOCKET socket() const { return socket_; }
365
366 bool CreateCompletionPort(HANDLE completion_port);
365 367
366 protected: 368 protected:
367 explicit SocketHandle(SOCKET s) : Handle(reinterpret_cast<HANDLE>(s)) {} 369 explicit SocketHandle(SOCKET s)
370 : Handle(INVALID_HANDLE_VALUE),
371 socket_(s) {}
368 SocketHandle(SOCKET s, Dart_Port port) 372 SocketHandle(SOCKET s, Dart_Port port)
369 : Handle(reinterpret_cast<HANDLE>(s), port) {} 373 : Handle(INVALID_HANDLE_VALUE, port),
374 socket_(s) {}
370 375
371 virtual void HandleIssueError(); 376 virtual void HandleIssueError();
377
378 private:
379 const SOCKET socket_;
372 }; 380 };
373 381
374 382
375 // Information on listen sockets. 383 // Information on listen sockets.
376 class ListenSocket : public SocketHandle { 384 class ListenSocket : public SocketHandle {
377 public: 385 public:
378 explicit ListenSocket(SOCKET s) : SocketHandle(s), 386 explicit ListenSocket(SOCKET s) : SocketHandle(s),
379 AcceptEx_(NULL), 387 AcceptEx_(NULL),
380 pending_accept_count_(0), 388 pending_accept_count_(0),
381 accepted_head_(NULL), 389 accepted_head_(NULL),
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 541
534 TimeoutQueue timeout_queue_; // Time for next timeout. 542 TimeoutQueue timeout_queue_; // Time for next timeout.
535 bool shutdown_; 543 bool shutdown_;
536 HANDLE completion_port_; 544 HANDLE completion_port_;
537 }; 545 };
538 546
539 } // namespace bin 547 } // namespace bin
540 } // namespace dart 548 } // namespace dart
541 549
542 #endif // BIN_EVENTHANDLER_WIN_H_ 550 #endif // BIN_EVENTHANDLER_WIN_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/eventhandler_win.cc » ('j') | runtime/bin/eventhandler_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698