node_bindings_win.cc 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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(BrowserEnvironment browser_env)
  12. : NodeBindings(browser_env) {}
  13. NodeBindingsWin::~NodeBindingsWin() {}
  14. void NodeBindingsWin::PollEvents() {
  15. // If there are other kinds of events pending, uv_backend_timeout will
  16. // instruct us not to wait.
  17. DWORD bytes, timeout;
  18. ULONG_PTR key;
  19. OVERLAPPED* overlapped;
  20. timeout = uv_backend_timeout(uv_loop_);
  21. GetQueuedCompletionStatus(uv_loop_->iocp, &bytes, &key, &overlapped, timeout);
  22. // Give the event back so libuv can deal with it.
  23. if (overlapped != NULL)
  24. PostQueuedCompletionStatus(uv_loop_->iocp, bytes, key, overlapped);
  25. }
  26. // static
  27. NodeBindings* NodeBindings::Create(BrowserEnvironment browser_env) {
  28. return new NodeBindingsWin(browser_env);
  29. }
  30. } // namespace atom