2014-10-31 21:17:05 +03:00
|
|
|
// Copyright (c) 2013 GitHub, Inc.
|
2014-04-25 13:49:37 +04:00
|
|
|
// Use of this source code is governed by the MIT license that can be
|
2013-07-22 12:05:35 +04:00
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2014-03-16 04:30:26 +04:00
|
|
|
#include "atom/common/node_bindings_win.h"
|
2013-07-22 12:05:35 +04:00
|
|
|
|
2013-07-22 12:43:58 +04:00
|
|
|
#include <windows.h>
|
|
|
|
|
|
|
|
#include "base/logging.h"
|
2013-07-23 15:19:11 +04:00
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
#include "vendor/node/deps/uv/src/win/internal.h"
|
|
|
|
}
|
2013-07-22 12:05:35 +04:00
|
|
|
|
|
|
|
namespace atom {
|
|
|
|
|
|
|
|
NodeBindingsWin::NodeBindingsWin(bool is_browser)
|
|
|
|
: NodeBindings(is_browser) {
|
|
|
|
}
|
|
|
|
|
|
|
|
NodeBindingsWin::~NodeBindingsWin() {
|
|
|
|
}
|
|
|
|
|
|
|
|
void NodeBindingsWin::PollEvents() {
|
2015-08-21 04:59:58 +03:00
|
|
|
// If there are other kinds of events pending, uv_backend_timeout will
|
|
|
|
// instruct us not to wait.
|
|
|
|
DWORD bytes, timeout;
|
|
|
|
ULONG_PTR key;
|
|
|
|
OVERLAPPED* overlapped;
|
|
|
|
|
|
|
|
timeout = uv_backend_timeout(uv_loop_);
|
|
|
|
|
|
|
|
GetQueuedCompletionStatus(uv_loop_->iocp,
|
|
|
|
&bytes,
|
|
|
|
&key,
|
|
|
|
&overlapped,
|
|
|
|
timeout);
|
|
|
|
|
|
|
|
// Give the event back so libuv can deal with it.
|
|
|
|
if (overlapped != NULL)
|
|
|
|
PostQueuedCompletionStatus(uv_loop_->iocp,
|
|
|
|
bytes,
|
|
|
|
key,
|
|
|
|
overlapped);
|
2013-07-22 12:05:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
NodeBindings* NodeBindings::Create(bool is_browser) {
|
|
|
|
return new NodeBindingsWin(is_browser);
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace atom
|