chore: fix v8 deprecation warnings

This commit is contained in:
deepak1556 2018-11-29 07:25:03 +05:30
parent f8418554a3
commit e1336d8453
14 changed files with 86 additions and 65 deletions

View file

@ -20,6 +20,7 @@
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "gin/converter.h"
#include "native_mate/dictionary.h"
#include "ui/gl/gpu_switching_manager.h"
@ -311,7 +312,7 @@ void BrowserWindow::SetBrowserView(v8::Local<v8::Value> value) {
void BrowserWindow::SetVibrancy(v8::Isolate* isolate,
v8::Local<v8::Value> value) {
std::string type = mate::V8ToString(value);
std::string type = gin::V8ToString(isolate, value);
auto* render_view_host = web_contents()->GetRenderViewHost();
if (render_view_host) {

View file

@ -359,7 +359,7 @@ void DestroyGlobalHandle(v8::Isolate* isolate,
if (!global_handle.IsEmpty()) {
v8::Local<v8::Value> local_handle = global_handle.Get(isolate);
if (local_handle->IsObject()) {
v8::Local<v8::Object> object = local_handle->ToObject();
v8::Local<v8::Object> object = local_handle->ToObject(isolate);
void* ptr = object->GetAlignedPointerFromInternalField(0);
if (!ptr)
return;

View file

@ -20,6 +20,7 @@
#include "atom/common/native_mate_converters/value_converter.h"
#include "atom/common/options_switches.h"
#include "electron/buildflags/buildflags.h"
#include "gin/converter.h"
#include "native_mate/handle.h"
#include "native_mate/persistent_dictionary.h"
@ -643,7 +644,8 @@ void TopLevelWindow::SetFocusable(bool focusable) {
void TopLevelWindow::SetMenu(v8::Isolate* isolate, v8::Local<v8::Value> value) {
mate::Handle<Menu> menu;
if (value->IsObject() &&
mate::V8ToString(value->ToObject()->GetConstructorName()) == "Menu" &&
gin::V8ToString(
isolate, value->ToObject(isolate)->GetConstructorName()) == "Menu" &&
mate::ConvertFromV8(isolate, value, &menu) && !menu.IsEmpty()) {
menu_.Reset(isolate, menu.ToV8());
window_->SetMenu(menu->model());
@ -740,7 +742,7 @@ void TopLevelWindow::SetAutoHideCursor(bool auto_hide) {
void TopLevelWindow::SetVibrancy(v8::Isolate* isolate,
v8::Local<v8::Value> value) {
std::string type = mate::V8ToString(value);
std::string type = gin::V8ToString(isolate, value);
window_->SetVibrancy(type);
}

View file

@ -103,7 +103,8 @@ class EventEmitter : public Wrappable<T> {
v8::HandleScope handle_scope(isolate());
EmitEvent(isolate(), GetWrapper(), name, event, args...);
return event->Get(StringToV8(isolate(), "defaultPrevented"))
->BooleanValue();
->BooleanValue(isolate()->GetCurrentContext())
.ToChecked();
}
DISALLOW_COPY_AND_ASSIGN(EventEmitter);