commit
22b21d04bd
79 changed files with 530 additions and 428 deletions
|
@ -132,12 +132,12 @@ void InitAsarSupport(v8::Isolate* isolate,
|
|||
v8::Local<v8::Value> require) {
|
||||
// Evaluate asar_init.coffee.
|
||||
const char* asar_init_native = reinterpret_cast<const char*>(
|
||||
static_cast<const unsigned char*>(node::asar_init_native));
|
||||
static_cast<const unsigned char*>(node::asar_init_data));
|
||||
v8::Local<v8::Script> asar_init = v8::Script::Compile(v8::String::NewFromUtf8(
|
||||
isolate,
|
||||
asar_init_native,
|
||||
v8::String::kNormalString,
|
||||
sizeof(node::asar_init_native) -1));
|
||||
sizeof(node::asar_init_data) -1));
|
||||
v8::Local<v8::Value> result = asar_init->Run();
|
||||
|
||||
// Initialize asar support.
|
||||
|
@ -146,10 +146,10 @@ void InitAsarSupport(v8::Isolate* isolate,
|
|||
std::string)> init;
|
||||
if (mate::ConvertFromV8(isolate, result, &init)) {
|
||||
const char* asar_native = reinterpret_cast<const char*>(
|
||||
static_cast<const unsigned char*>(node::asar_native));
|
||||
static_cast<const unsigned char*>(node::asar_data));
|
||||
init.Run(process,
|
||||
require,
|
||||
std::string(asar_native, sizeof(node::asar_native) - 1));
|
||||
std::string(asar_native, sizeof(node::asar_data) - 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#ifndef ATOM_COMMON_CHROME_VERSION_H_
|
||||
#define ATOM_COMMON_CHROME_VERSION_H_
|
||||
|
||||
#define CHROME_VERSION_STRING "53.0.2785.143"
|
||||
#define CHROME_VERSION_STRING "54.0.2840.101"
|
||||
#define CHROME_VERSION "v" CHROME_VERSION_STRING
|
||||
|
||||
#endif // ATOM_COMMON_CHROME_VERSION_H_
|
||||
|
|
|
@ -90,11 +90,11 @@ struct Converter<blink::WebMouseEvent::Button> {
|
|||
blink::WebMouseEvent::Button* out) {
|
||||
std::string button = base::ToLowerASCII(V8ToString(val));
|
||||
if (button == "left")
|
||||
*out = blink::WebMouseEvent::Button::ButtonLeft;
|
||||
*out = blink::WebMouseEvent::Button::Left;
|
||||
else if (button == "middle")
|
||||
*out = blink::WebMouseEvent::Button::ButtonMiddle;
|
||||
*out = blink::WebMouseEvent::Button::Middle;
|
||||
else if (button == "right")
|
||||
*out = blink::WebMouseEvent::Button::ButtonRight;
|
||||
*out = blink::WebMouseEvent::Button::Right;
|
||||
else
|
||||
return false;
|
||||
return true;
|
||||
|
@ -176,7 +176,6 @@ bool Converter<blink::WebKeyboardEvent>::FromV8(
|
|||
out->windowsKeyCode = keyCode;
|
||||
if (shifted)
|
||||
out->modifiers |= blink::WebInputEvent::ShiftKey;
|
||||
out->setKeyIdentifierFromWindowsKeyCode();
|
||||
|
||||
ui::DomCode domCode = ui::UsLayoutKeyboardCodeToDomCode(keyCode);
|
||||
out->domCode = static_cast<int>(domCode);
|
||||
|
@ -246,7 +245,7 @@ bool Converter<blink::WebMouseEvent>::FromV8(
|
|||
if (!dict.Get("x", &out->x) || !dict.Get("y", &out->y))
|
||||
return false;
|
||||
if (!dict.Get("button", &out->button))
|
||||
out->button = blink::WebMouseEvent::Button::ButtonLeft;
|
||||
out->button = blink::WebMouseEvent::Button::Left;
|
||||
dict.Get("globalX", &out->globalX);
|
||||
dict.Get("globalY", &out->globalY);
|
||||
dict.Get("movementX", &out->movementX);
|
||||
|
|
|
@ -15,8 +15,9 @@
|
|||
#include "base/command_line.h"
|
||||
#include "base/environment.h"
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "base/path_service.h"
|
||||
#include "base/run_loop.h"
|
||||
#include "base/threading/thread_task_runner_handle.h"
|
||||
#include "base/trace_event/trace_event.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/common/content_paths.h"
|
||||
|
@ -63,14 +64,6 @@ REFERENCE_MODULE(atom_renderer_ipc);
|
|||
REFERENCE_MODULE(atom_renderer_web_frame);
|
||||
#undef REFERENCE_MODULE
|
||||
|
||||
// The "v8::Function::kLineOffsetNotFound" is exported in node.dll, but the
|
||||
// linker can not find it, could be a bug of VS.
|
||||
#if defined(OS_WIN) && !defined(DEBUG)
|
||||
namespace v8 {
|
||||
const int Function::kLineOffsetNotFound = -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace atom {
|
||||
|
||||
namespace {
|
||||
|
@ -107,7 +100,6 @@ base::FilePath GetResourcesPath(bool is_browser) {
|
|||
|
||||
NodeBindings::NodeBindings(bool is_browser)
|
||||
: is_browser_(is_browser),
|
||||
message_loop_(nullptr),
|
||||
uv_loop_(uv_default_loop()),
|
||||
embed_closed_(false),
|
||||
uv_env_(nullptr),
|
||||
|
@ -168,7 +160,7 @@ node::Environment* NodeBindings::CreateEnvironment(
|
|||
|
||||
std::unique_ptr<const char*[]> c_argv = StringVectorToArgArray(args);
|
||||
node::Environment* env = node::CreateEnvironment(
|
||||
context->GetIsolate(), uv_default_loop(), context,
|
||||
new node::IsolateData(context->GetIsolate(), uv_default_loop()), context,
|
||||
args.size(), c_argv.get(), 0, nullptr);
|
||||
|
||||
// Node uses the deprecated SetAutorunMicrotasks(false) mode, we should switch
|
||||
|
@ -218,7 +210,7 @@ void NodeBindings::RunMessageLoop() {
|
|||
DCHECK(!is_browser_ || BrowserThread::CurrentlyOn(BrowserThread::UI));
|
||||
|
||||
// The MessageLoop should have been created, remember the one in main thread.
|
||||
message_loop_ = base::MessageLoop::current();
|
||||
task_runner_ = base::ThreadTaskRunnerHandle::Get();
|
||||
|
||||
// Run uv loop for once to give the uv__io_poll a chance to add all events.
|
||||
UvRunOnce();
|
||||
|
@ -250,16 +242,16 @@ void NodeBindings::UvRunOnce() {
|
|||
TRACE_EVENT_END0("devtools.timeline", "FunctionCall");
|
||||
|
||||
if (r == 0)
|
||||
message_loop_->QuitWhenIdle(); // Quit from uv.
|
||||
base::RunLoop().QuitWhenIdle(); // Quit from uv.
|
||||
|
||||
// Tell the worker thread to continue polling.
|
||||
uv_sem_post(&embed_sem_);
|
||||
}
|
||||
|
||||
void NodeBindings::WakeupMainThread() {
|
||||
DCHECK(message_loop_);
|
||||
message_loop_->PostTask(FROM_HERE, base::Bind(&NodeBindings::UvRunOnce,
|
||||
weak_factory_.GetWeakPtr()));
|
||||
DCHECK(task_runner_);
|
||||
task_runner_->PostTask(FROM_HERE, base::Bind(&NodeBindings::UvRunOnce,
|
||||
weak_factory_.GetWeakPtr()));
|
||||
}
|
||||
|
||||
void NodeBindings::WakeupEmbedThread() {
|
||||
|
|
|
@ -64,7 +64,7 @@ class NodeBindings {
|
|||
bool is_browser_;
|
||||
|
||||
// Main thread's MessageLoop.
|
||||
base::MessageLoop* message_loop_;
|
||||
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
|
||||
|
||||
// Main thread's libuv loop.
|
||||
uv_loop_t* uv_loop_;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue