2014-10-31 18:17:05 +00:00
|
|
|
// Copyright (c) 2013 GitHub, Inc.
|
2014-04-25 09:49:37 +00:00
|
|
|
// Use of this source code is governed by the MIT license that can be
|
2013-07-22 08:05:35 +00:00
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2014-03-16 00:30:26 +00:00
|
|
|
#include "atom/common/node_bindings_win.h"
|
2013-07-22 08:05:35 +00:00
|
|
|
|
2013-07-22 08:43:58 +00:00
|
|
|
#include <windows.h>
|
|
|
|
|
|
|
|
#include "base/logging.h"
|
2013-07-23 11:19:11 +00:00
|
|
|
|
2013-07-22 08:05:35 +00:00
|
|
|
namespace atom {
|
|
|
|
|
2017-03-08 08:33:44 +00:00
|
|
|
NodeBindingsWin::NodeBindingsWin(BrowserEnvironment browser_env)
|
2018-04-18 01:55:30 +00:00
|
|
|
: NodeBindings(browser_env) {}
|
2013-07-22 08:05:35 +00:00
|
|
|
|
2018-04-18 01:55:30 +00:00
|
|
|
NodeBindingsWin::~NodeBindingsWin() {}
|
2013-07-22 08:05:35 +00:00
|
|
|
|
|
|
|
void NodeBindingsWin::PollEvents() {
|
2015-08-21 01:59:58 +00: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_);
|
|
|
|
|
2018-04-18 01:55:30 +00:00
|
|
|
GetQueuedCompletionStatus(uv_loop_->iocp, &bytes, &key, &overlapped, timeout);
|
2015-08-21 01:59:58 +00:00
|
|
|
|
|
|
|
// Give the event back so libuv can deal with it.
|
|
|
|
if (overlapped != NULL)
|
2018-04-18 01:55:30 +00:00
|
|
|
PostQueuedCompletionStatus(uv_loop_->iocp, bytes, key, overlapped);
|
2013-07-22 08:05:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
2017-03-08 08:33:44 +00:00
|
|
|
NodeBindings* NodeBindings::Create(BrowserEnvironment browser_env) {
|
|
|
|
return new NodeBindingsWin(browser_env);
|
2013-07-22 08:05:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace atom
|