Merge remote-tracking branch 'origin/chromium-upgrade/72'

This commit is contained in:
Samuel Attard 2019-01-22 12:01:18 -08:00
commit f3e30c7ae3
No known key found for this signature in database
GPG key ID: E89DDE5742D58C4E
178 changed files with 2102 additions and 1734 deletions

View file

@ -52,7 +52,7 @@ mate::Handle<NativeImage> NativeImage::CreateFromNamedImage(
png_data = bufferFromNSImage(
gfx::Image(gfx::ImageSkiaOperations::CreateHSLShiftedImage(
gfx_image.AsImageSkia(), shift))
.CopyNSImage());
.AsNSImage());
}
return CreateFromPNG(args->isolate(), (char*)[png_data bytes],

View file

@ -19,10 +19,10 @@
#include "atom/common/native_mate_converters/string16_converter.h"
#include "atom/common/promise_util.h"
#include "base/logging.h"
#include "base/process/process.h"
#include "base/process/process_handle.h"
#include "base/process/process_info.h"
#include "base/process/process_metrics_iocounters.h"
#include "base/sys_info.h"
#include "base/system/sys_info.h"
#include "base/threading/thread_restrictions.h"
#include "chrome/common/chrome_version.h"
#include "native_mate/dictionary.h"
@ -189,7 +189,7 @@ v8::Local<v8::Value> AtomBindings::GetHeapStatistics(v8::Isolate* isolate) {
// static
v8::Local<v8::Value> AtomBindings::GetCreationTime(v8::Isolate* isolate) {
auto timeValue = base::CurrentProcessInfo::CreationTime();
auto timeValue = base::Process::Current().CreationTime();
if (timeValue.is_null()) {
return v8::Null(isolate);
}

View file

@ -25,7 +25,7 @@ v8::Local<v8::Function> CreateConstructor(v8::Isolate* isolate,
isolate, base::Bind(&mate::internal::InvokeNew<Sig>, func));
templ->InstanceTemplate()->SetInternalFieldCount(1);
T::BuildPrototype(isolate, templ);
return templ->GetFunction();
return templ->GetFunction(isolate->GetCurrentContext()).ToLocalChecked();
}
} // namespace mate

View file

@ -9,13 +9,7 @@
// Generate constructors.
#include "ipc/struct_constructor_macros.h"
// must go after struct_contructor_macros
#include "atom/common/common_message_generator.h"
// Generate destructors.
#include "ipc/struct_destructor_macros.h"
// must go after struct_destructor_macros
// lint: must come after struct_constructor_macros.
#include "atom/common/common_message_generator.h"
// Generate param traits write methods.
@ -34,4 +28,4 @@ namespace IPC {
#include "ipc/param_traits_log_macros.h"
namespace IPC {
#include "atom/common/common_message_generator.h"
} // namespace IPC
} // namespace IPC

View file

@ -473,25 +473,26 @@ v8::Local<v8::Value> Converter<blink::WebCache::ResourceTypeStats>::ToV8(
}
// static
v8::Local<v8::Value> Converter<blink::WebReferrerPolicy>::ToV8(
v8::Local<v8::Value> Converter<network::mojom::ReferrerPolicy>::ToV8(
v8::Isolate* isolate,
const blink::WebReferrerPolicy& in) {
const network::mojom::ReferrerPolicy& in) {
switch (in) {
case blink::kWebReferrerPolicyDefault:
case network::mojom::ReferrerPolicy::kDefault:
return mate::StringToV8(isolate, "default");
case blink::kWebReferrerPolicyAlways:
case network::mojom::ReferrerPolicy::kAlways:
return mate::StringToV8(isolate, "unsafe-url");
case blink::kWebReferrerPolicyNoReferrerWhenDowngrade:
case network::mojom::ReferrerPolicy::kNoReferrerWhenDowngrade:
return mate::StringToV8(isolate, "no-referrer-when-downgrade");
case blink::kWebReferrerPolicyNever:
case network::mojom::ReferrerPolicy::kNever:
return mate::StringToV8(isolate, "no-referrer");
case blink::kWebReferrerPolicyOrigin:
case network::mojom::ReferrerPolicy::kOrigin:
return mate::StringToV8(isolate, "origin");
case blink::kWebReferrerPolicyNoReferrerWhenDowngradeOriginWhenCrossOrigin:
case network::mojom::ReferrerPolicy::
kNoReferrerWhenDowngradeOriginWhenCrossOrigin:
return mate::StringToV8(isolate, "strict-origin-when-cross-origin");
case blink::kWebReferrerPolicySameOrigin:
case network::mojom::ReferrerPolicy::kSameOrigin:
return mate::StringToV8(isolate, "same-origin");
case blink::kWebReferrerPolicyStrictOrigin:
case network::mojom::ReferrerPolicy::kStrictOrigin:
return mate::StringToV8(isolate, "strict-origin");
default:
return mate::StringToV8(isolate, "no-referrer");
@ -499,28 +500,28 @@ v8::Local<v8::Value> Converter<blink::WebReferrerPolicy>::ToV8(
}
// static
bool Converter<blink::WebReferrerPolicy>::FromV8(
bool Converter<network::mojom::ReferrerPolicy>::FromV8(
v8::Isolate* isolate,
v8::Handle<v8::Value> val,
blink::WebReferrerPolicy* out) {
network::mojom::ReferrerPolicy* out) {
std::string policy = base::ToLowerASCII(gin::V8ToString(isolate, val));
if (policy == "default")
*out = blink::kWebReferrerPolicyDefault;
*out = network::mojom::ReferrerPolicy::kDefault;
else if (policy == "unsafe-url")
*out = blink::kWebReferrerPolicyAlways;
*out = network::mojom::ReferrerPolicy::kAlways;
else if (policy == "no-referrer-when-downgrade")
*out = blink::kWebReferrerPolicyNoReferrerWhenDowngrade;
*out = network::mojom::ReferrerPolicy::kNoReferrerWhenDowngrade;
else if (policy == "no-referrer")
*out = blink::kWebReferrerPolicyNever;
*out = network::mojom::ReferrerPolicy::kNever;
else if (policy == "origin")
*out = blink::kWebReferrerPolicyOrigin;
*out = network::mojom::ReferrerPolicy::kOrigin;
else if (policy == "strict-origin-when-cross-origin")
*out =
blink::kWebReferrerPolicyNoReferrerWhenDowngradeOriginWhenCrossOrigin;
*out = network::mojom::ReferrerPolicy::
kNoReferrerWhenDowngradeOriginWhenCrossOrigin;
else if (policy == "same-origin")
*out = blink::kWebReferrerPolicySameOrigin;
*out = network::mojom::ReferrerPolicy::kSameOrigin;
else if (policy == "strict-origin")
*out = blink::kWebReferrerPolicyStrictOrigin;
*out = network::mojom::ReferrerPolicy::kStrictOrigin;
else
return false;
return true;

View file

@ -123,12 +123,12 @@ struct Converter<blink::WebCache::ResourceTypeStats> {
};
template <>
struct Converter<blink::WebReferrerPolicy> {
struct Converter<network::mojom::ReferrerPolicy> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const blink::WebReferrerPolicy& in);
const network::mojom::ReferrerPolicy& in);
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
blink::WebReferrerPolicy* out);
network::mojom::ReferrerPolicy* out);
};
v8::Local<v8::Value> EditFlagsToV8(v8::Isolate* isolate, int editFlags);

View file

@ -43,16 +43,19 @@ void CallTranslater(v8::Local<v8::External> external,
mate::Arguments* args) {
// Whether the callback should only be called for once.
v8::Isolate* isolate = args->isolate();
bool one_time = state->Has(mate::StringToSymbol(isolate, "oneTime"));
auto context = isolate->GetCurrentContext();
bool one_time =
state->Has(context, mate::StringToSymbol(isolate, "oneTime")).ToChecked();
// Check if the callback has already been called.
if (one_time) {
auto called_symbol = mate::StringToSymbol(isolate, "called");
if (state->Has(called_symbol)) {
if (state->Has(context, called_symbol).ToChecked()) {
args->ThrowError("callback can only be called for once");
return;
} else {
state->Set(called_symbol, v8::Boolean::New(isolate, true));
state->Set(context, called_symbol, v8::Boolean::New(isolate, true))
.ToChecked();
}
}
@ -130,9 +133,10 @@ v8::Local<v8::Value> CreateFunctionFromTranslater(v8::Isolate* isolate,
Dictionary state = mate::Dictionary::CreateEmpty(isolate);
if (one_time)
state.Set("oneTime", true);
return BindFunctionWith(isolate, isolate->GetCurrentContext(),
call_translater->GetFunction(),
holder->handle.Get(isolate), state.GetHandle());
auto context = isolate->GetCurrentContext();
return BindFunctionWith(
isolate, context, call_translater->GetFunction(context).ToLocalChecked(),
holder->handle.Get(isolate), state.GetHandle());
}
// func.bind(func, arg1).

View file

@ -55,8 +55,10 @@ struct V8FunctionInvoker<v8::Local<v8::Value>(ArgTypes...)> {
v8::Local<v8::Context> context = holder->CreationContext();
v8::Context::Scope context_scope(context);
std::vector<v8::Local<v8::Value>> args{ConvertToV8(isolate, raw)...};
v8::Local<v8::Value> ret(holder->Call(
holder, args.size(), args.empty() ? nullptr : &args.front()));
v8::Local<v8::Value> ret(holder
->Call(context, holder, args.size(),
args.empty() ? nullptr : &args.front())
.ToLocalChecked());
return handle_scope.Escape(ret);
}
};
@ -76,7 +78,10 @@ struct V8FunctionInvoker<void(ArgTypes...)> {
v8::Local<v8::Context> context = holder->CreationContext();
v8::Context::Scope context_scope(context);
std::vector<v8::Local<v8::Value>> args{ConvertToV8(isolate, raw)...};
holder->Call(holder, args.size(), args.empty() ? nullptr : &args.front());
holder
->Call(context, holder, args.size(),
args.empty() ? nullptr : &args.front())
.ToLocalChecked();
}
};

View file

@ -331,8 +331,9 @@ base::Value* V8ValueConverter::FromV8ValueImpl(FromV8ValueState* state,
v8::Local<v8::Value> toISOString =
date->Get(v8::String::NewFromUtf8(isolate, "toISOString"));
if (toISOString->IsFunction()) {
v8::Local<v8::Value> result =
toISOString.As<v8::Function>()->Call(val, 0, nullptr);
v8::Local<v8::Value> result = toISOString.As<v8::Function>()
->Call(context, val, 0, nullptr)
.ToLocalChecked();
if (!result.IsEmpty()) {
v8::String::Utf8Value utf8(isolate,
result->ToString(context).ToLocalChecked());

View file

@ -7,7 +7,7 @@
#include <windows.h>
#include "base/logging.h"
#include "base/sys_info.h"
#include "base/system/sys_info.h"
namespace atom {