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

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 bool DoCreateCompletionPort(HANDLE handle, HANDLE completion_port);
232 virtual bool CreateCompletionPort(HANDLE completion_port);
232 233
233 void Close(); 234 void Close();
234 virtual void DoClose(); 235 virtual void DoClose();
235 virtual bool IsClosed() = 0; 236 virtual bool IsClosed() = 0;
236 237
237 bool IsHandleClosed() const { return handle_ == INVALID_HANDLE_VALUE; } 238 bool IsHandleClosed() const { return handle_ == INVALID_HANDLE_VALUE; }
238 239
239 void SetPortAndMask(Dart_Port port, intptr_t mask) { 240 void SetPortAndMask(Dart_Port port, intptr_t mask) {
240 port_ = port; 241 port_ = port;
241 mask_ = mask; 242 mask_ = mask;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 void Stop(); 355 void Stop();
355 356
356 private: 357 private:
357 int events_; 358 int events_;
358 bool recursive_; 359 bool recursive_;
359 }; 360 };
360 361
361 362
362 class SocketHandle : public Handle { 363 class SocketHandle : public Handle {
363 public: 364 public:
364 SOCKET socket() { return reinterpret_cast<SOCKET>(handle_); } 365 SOCKET socket() const { return socket_; }
366
367 bool CreateCompletionPort(HANDLE completion_port);
kasperl 2014/06/04 14:09:19 Maybe also mark this virtual? (like it's done with
Anders Johnsen 2014/06/04 14:16:32 Done.
365 368
366 protected: 369 protected:
367 explicit SocketHandle(SOCKET s) : Handle(reinterpret_cast<HANDLE>(s)) {} 370 explicit SocketHandle(SOCKET s)
371 : Handle(INVALID_HANDLE_VALUE),
372 socket_(s) {}
368 SocketHandle(SOCKET s, Dart_Port port) 373 SocketHandle(SOCKET s, Dart_Port port)
369 : Handle(reinterpret_cast<HANDLE>(s), port) {} 374 : Handle(INVALID_HANDLE_VALUE, port),
375 socket_(s) {}
370 376
371 virtual void HandleIssueError(); 377 virtual void HandleIssueError();
378
379 private:
380 const SOCKET socket_;
372 }; 381 };
373 382
374 383
375 // Information on listen sockets. 384 // Information on listen sockets.
376 class ListenSocket : public SocketHandle { 385 class ListenSocket : public SocketHandle {
377 public: 386 public:
378 explicit ListenSocket(SOCKET s) : SocketHandle(s), 387 explicit ListenSocket(SOCKET s) : SocketHandle(s),
379 AcceptEx_(NULL), 388 AcceptEx_(NULL),
380 pending_accept_count_(0), 389 pending_accept_count_(0),
381 accepted_head_(NULL), 390 accepted_head_(NULL),
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 542
534 TimeoutQueue timeout_queue_; // Time for next timeout. 543 TimeoutQueue timeout_queue_; // Time for next timeout.
535 bool shutdown_; 544 bool shutdown_;
536 HANDLE completion_port_; 545 HANDLE completion_port_;
537 }; 546 };
538 547
539 } // namespace bin 548 } // namespace bin
540 } // namespace dart 549 } // namespace dart
541 550
542 #endif // BIN_EVENTHANDLER_WIN_H_ 551 #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