Update files for Chrome 54 API changes

This commit is contained in:
Cheng Zhao 2016-11-30 16:30:03 +09:00 committed by Birunthan Mohanathas
parent bdc334d797
commit 497f5a1199
52 changed files with 275 additions and 298 deletions

View file

@ -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);

View file

@ -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"
@ -99,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),
@ -210,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();
@ -242,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() {

View file

@ -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_;