node_bindings_win.cc 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // Copyright (c) 2013 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #include "atom/common/node_bindings_win.h"
  5. #include <windows.h>
  6. #include "base/logging.h"
  7. extern "C" {
  8. #include "vendor/node/deps/uv/src/win/internal.h"
  9. }
  10. namespace atom {
  11. NodeBindingsWin::NodeBindingsWin(bool is_browser)
  12. : NodeBindings(is_browser) {
  13. }
  14. NodeBindingsWin::~NodeBindingsWin() {
  15. }
  16. void NodeBindingsWin::PollEvents() {
  17. // If there are other kinds of events pending, uv_backend_timeout will
  18. // instruct us not to wait.
  19. DWORD bytes, timeout;
  20. ULONG_PTR key;
  21. OVERLAPPED* overlapped;
  22. timeout = uv_backend_timeout(uv_loop_);
  23. GetQueuedCompletionStatus(uv_loop_->iocp,
  24. &bytes,
  25. &key,
  26. &overlapped,
  27. timeout);
  28. // Give the event back so libuv can deal with it.
  29. if (overlapped != NULL)
  30. PostQueuedCompletionStatus(uv_loop_->iocp,
  31. bytes,
  32. key,
  33. overlapped);
  34. }
  35. // static
  36. NodeBindings* NodeBindings::Create(bool is_browser) {
  37. return new NodeBindingsWin(is_browser);
  38. }
  39. } // namespace atom