summaryrefslogtreecommitdiff
path: root/chromium/gin
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-02-13 15:05:36 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-02-14 10:33:47 +0000
commite684a3455bcc29a6e3e66a004e352dea4e1141e7 (patch)
treed55b4003bde34d7d05f558f02cfd82b2a66a7aac /chromium/gin
parent2b94bfe47ccb6c08047959d1c26e392919550e86 (diff)
downloadqtwebengine-chromium-e684a3455bcc29a6e3e66a004e352dea4e1141e7.tar.gz
BASELINE: Update Chromium to 72.0.3626.110 and Ninja to 1.9.0
Change-Id: Ic57220b00ecc929a893c91f5cc552f5d3e99e922 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/gin')
-rw-r--r--chromium/gin/arguments_unittest.cc3
-rw-r--r--chromium/gin/converter.cc19
-rw-r--r--chromium/gin/converter.h9
-rw-r--r--chromium/gin/converter_unittest.cc63
-rw-r--r--chromium/gin/debug_impl.cc11
-rw-r--r--chromium/gin/debug_impl.h1
-rw-r--r--chromium/gin/interceptor_unittest.cc3
-rw-r--r--chromium/gin/isolate_holder.cc3
-rw-r--r--chromium/gin/public/debug.h8
-rw-r--r--chromium/gin/public/gin_embedders.h1
-rw-r--r--chromium/gin/v8_foreground_task_runner.cc10
-rw-r--r--chromium/gin/v8_foreground_task_runner.h4
-rw-r--r--chromium/gin/v8_foreground_task_runner_with_locker.cc11
-rw-r--r--chromium/gin/v8_foreground_task_runner_with_locker.h4
-rw-r--r--chromium/gin/v8_initializer.cc2
-rw-r--r--chromium/gin/v8_platform.cc19
-rw-r--r--chromium/gin/wrappable_unittest.cc9
17 files changed, 123 insertions, 57 deletions
diff --git a/chromium/gin/arguments_unittest.cc b/chromium/gin/arguments_unittest.cc
index f1506ddba10..144e9af03cc 100644
--- a/chromium/gin/arguments_unittest.cc
+++ b/chromium/gin/arguments_unittest.cc
@@ -51,7 +51,8 @@ TEST_F(ArgumentsTest, TestArgumentsHolderCreationContext) {
ASSERT_TRUE(ConvertFromV8(isolate, script->Run(context).ToLocalChecked(),
&function));
v8::Local<v8::Value> args[] = {object};
- function->Call(v8::Undefined(isolate), arraysize(args), args);
+ function->Call(context, v8::Undefined(isolate), base::size(args), args)
+ .ToLocalChecked();
};
// Test calling in the creation context.
diff --git a/chromium/gin/converter.cc b/chromium/gin/converter.cc
index 975a5c8b9e5..ce40d590e8f 100644
--- a/chromium/gin/converter.cc
+++ b/chromium/gin/converter.cc
@@ -20,6 +20,7 @@ using v8::Maybe;
using v8::MaybeLocal;
using v8::Number;
using v8::Object;
+using v8::Promise;
using v8::String;
using v8::Uint32;
using v8::Value;
@@ -43,7 +44,9 @@ Local<Value> Converter<bool>::ToV8(Isolate* isolate, bool val) {
}
bool Converter<bool>::FromV8(Isolate* isolate, Local<Value> val, bool* out) {
- return FromMaybe(val->BooleanValue(isolate->GetCurrentContext()), out);
+ *out = val->BooleanValue(isolate);
+ // BooleanValue cannot throw.
+ return true;
}
Local<Value> Converter<int32_t>::ToV8(Isolate* isolate, int32_t val) {
@@ -171,6 +174,20 @@ bool Converter<Local<Object>>::FromV8(Isolate* isolate,
return true;
}
+Local<Value> Converter<Local<Promise>>::ToV8(Isolate* isolate,
+ Local<Promise> val) {
+ return val.As<Value>();
+}
+
+bool Converter<Local<Promise>>::FromV8(Isolate* isolate,
+ Local<Value> val,
+ Local<Promise>* out) {
+ if (!val->IsPromise())
+ return false;
+ *out = Local<Promise>::Cast(val);
+ return true;
+}
+
Local<Value> Converter<Local<ArrayBuffer>>::ToV8(Isolate* isolate,
Local<ArrayBuffer> val) {
return val.As<Value>();
diff --git a/chromium/gin/converter.h b/chromium/gin/converter.h
index a501714a5e8..e4ef0a3ecc1 100644
--- a/chromium/gin/converter.h
+++ b/chromium/gin/converter.h
@@ -135,6 +135,15 @@ struct GIN_EXPORT Converter<v8::Local<v8::Object> > {
v8::Local<v8::Object>* out);
};
+template <>
+struct GIN_EXPORT Converter<v8::Local<v8::Promise>> {
+ static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
+ v8::Local<v8::Promise> val);
+ static bool FromV8(v8::Isolate* isolate,
+ v8::Local<v8::Value> val,
+ v8::Local<v8::Promise>* out);
+};
+
template<>
struct GIN_EXPORT Converter<v8::Local<v8::ArrayBuffer> > {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
diff --git a/chromium/gin/converter_unittest.cc b/chromium/gin/converter_unittest.cc
index ee486206448..066cc57a89c 100644
--- a/chromium/gin/converter_unittest.cc
+++ b/chromium/gin/converter_unittest.cc
@@ -45,17 +45,24 @@ TEST_F(ConverterTest, Bool) {
Local<Value> input;
bool expected;
} test_data[] = {
- { Boolean::New(instance_->isolate(), false).As<Value>(), false },
- { Boolean::New(instance_->isolate(), true).As<Value>(), true },
- { Number::New(instance_->isolate(), 0).As<Value>(), false },
- { Number::New(instance_->isolate(), 1).As<Value>(), true },
- { Number::New(instance_->isolate(), -1).As<Value>(), true },
- { Number::New(instance_->isolate(), 0.1).As<Value>(), true },
- { String::NewFromUtf8(instance_->isolate(), "").As<Value>(), false },
- { String::NewFromUtf8(instance_->isolate(), "foo").As<Value>(), true },
- { Object::New(instance_->isolate()).As<Value>(), true },
- { Null(instance_->isolate()).As<Value>(), false },
- { Undefined(instance_->isolate()).As<Value>(), false },
+ {Boolean::New(instance_->isolate(), false).As<Value>(), false},
+ {Boolean::New(instance_->isolate(), true).As<Value>(), true},
+ {Number::New(instance_->isolate(), 0).As<Value>(), false},
+ {Number::New(instance_->isolate(), 1).As<Value>(), true},
+ {Number::New(instance_->isolate(), -1).As<Value>(), true},
+ {Number::New(instance_->isolate(), 0.1).As<Value>(), true},
+ {String::NewFromUtf8(instance_->isolate(), "", v8::NewStringType::kNormal)
+ .ToLocalChecked()
+ .As<Value>(),
+ false},
+ {String::NewFromUtf8(instance_->isolate(), "foo",
+ v8::NewStringType::kNormal)
+ .ToLocalChecked()
+ .As<Value>(),
+ true},
+ {Object::New(instance_->isolate()).As<Value>(), true},
+ {Null(instance_->isolate()).As<Value>(), false},
+ {Undefined(instance_->isolate()).As<Value>(), false},
};
for (size_t i = 0; i < arraysize(test_data); ++i) {
@@ -86,19 +93,27 @@ TEST_F(ConverterTest, Int32) {
bool expect_success;
int expected_result;
} test_data_from[] = {
- { Boolean::New(instance_->isolate(), false).As<Value>(), false, 0 },
- { Boolean::New(instance_->isolate(), true).As<Value>(), false, 0 },
- { Integer::New(instance_->isolate(), -1).As<Value>(), true, -1 },
- { Integer::New(instance_->isolate(), 0).As<Value>(), true, 0 },
- { Integer::New(instance_->isolate(), 1).As<Value>(), true, 1 },
- { Number::New(instance_->isolate(), -1).As<Value>(), true, -1 },
- { Number::New(instance_->isolate(), 1.1).As<Value>(), false, 0 },
- { String::NewFromUtf8(instance_->isolate(), "42").As<Value>(), false, 0 },
- { String::NewFromUtf8(instance_->isolate(), "foo").As<Value>(), false, 0 },
- { Object::New(instance_->isolate()).As<Value>(), false, 0 },
- { Array::New(instance_->isolate()).As<Value>(), false, 0 },
- { v8::Null(instance_->isolate()).As<Value>(), false, 0 },
- { v8::Undefined(instance_->isolate()).As<Value>(), false, 0 },
+ {Boolean::New(instance_->isolate(), false).As<Value>(), false, 0},
+ {Boolean::New(instance_->isolate(), true).As<Value>(), false, 0},
+ {Integer::New(instance_->isolate(), -1).As<Value>(), true, -1},
+ {Integer::New(instance_->isolate(), 0).As<Value>(), true, 0},
+ {Integer::New(instance_->isolate(), 1).As<Value>(), true, 1},
+ {Number::New(instance_->isolate(), -1).As<Value>(), true, -1},
+ {Number::New(instance_->isolate(), 1.1).As<Value>(), false, 0},
+ {String::NewFromUtf8(instance_->isolate(), "42",
+ v8::NewStringType::kNormal)
+ .ToLocalChecked()
+ .As<Value>(),
+ false, 0},
+ {String::NewFromUtf8(instance_->isolate(), "foo",
+ v8::NewStringType::kNormal)
+ .ToLocalChecked()
+ .As<Value>(),
+ false, 0},
+ {Object::New(instance_->isolate()).As<Value>(), false, 0},
+ {Array::New(instance_->isolate()).As<Value>(), false, 0},
+ {v8::Null(instance_->isolate()).As<Value>(), false, 0},
+ {v8::Undefined(instance_->isolate()).As<Value>(), false, 0},
};
for (size_t i = 0; i < arraysize(test_data_from); ++i) {
diff --git a/chromium/gin/debug_impl.cc b/chromium/gin/debug_impl.cc
index 5657ec38e9b..5c3b7ffc932 100644
--- a/chromium/gin/debug_impl.cc
+++ b/chromium/gin/debug_impl.cc
@@ -7,7 +7,6 @@
namespace gin {
namespace {
-v8::FunctionEntryHook g_entry_hook = NULL;
v8::JitCodeEventHandler g_jit_code_event_handler = NULL;
#if defined(OS_WIN)
Debug::CodeRangeCreatedCallback g_code_range_created_callback = NULL;
@@ -16,11 +15,6 @@ Debug::CodeRangeDeletedCallback g_code_range_deleted_callback = NULL;
} // namespace
// static
-void Debug::SetFunctionEntryHook(v8::FunctionEntryHook entry_hook) {
- g_entry_hook = entry_hook;
-}
-
-// static
void Debug::SetJitCodeEventHandler(v8::JitCodeEventHandler event_handler) {
g_jit_code_event_handler = event_handler;
}
@@ -38,11 +32,6 @@ void Debug::SetCodeRangeDeletedCallback(CodeRangeDeletedCallback callback) {
#endif
// static
-v8::FunctionEntryHook DebugImpl::GetFunctionEntryHook() {
- return g_entry_hook;
-}
-
-// static
v8::JitCodeEventHandler DebugImpl::GetJitCodeEventHandler() {
return g_jit_code_event_handler;
}
diff --git a/chromium/gin/debug_impl.h b/chromium/gin/debug_impl.h
index 96d48ad3ffb..b88c0b6c089 100644
--- a/chromium/gin/debug_impl.h
+++ b/chromium/gin/debug_impl.h
@@ -12,7 +12,6 @@ namespace gin {
class DebugImpl {
public:
- static v8::FunctionEntryHook GetFunctionEntryHook();
static v8::JitCodeEventHandler GetJitCodeEventHandler();
#if defined(OS_WIN)
static Debug::CodeRangeCreatedCallback GetCodeRangeCreatedCallback();
diff --git a/chromium/gin/interceptor_unittest.cc b/chromium/gin/interceptor_unittest.cc
index 58f209a6023..ffffaae4808 100644
--- a/chromium/gin/interceptor_unittest.cc
+++ b/chromium/gin/interceptor_unittest.cc
@@ -157,7 +157,8 @@ class InterceptorTest : public V8Test {
v8::Local<v8::Value> argv[] = {
ConvertToV8(isolate, obj.get()).ToLocalChecked(),
};
- func->Call(v8::Undefined(isolate), 1, argv);
+ func->Call(context_.Get(isolate), v8::Undefined(isolate), 1, argv)
+ .ToLocalChecked();
EXPECT_FALSE(try_catch.HasCaught());
EXPECT_EQ("", try_catch.GetStackTrace());
diff --git a/chromium/gin/isolate_holder.cc b/chromium/gin/isolate_holder.cc
index 4491b392412..5670a2e55ef 100644
--- a/chromium/gin/isolate_holder.cc
+++ b/chromium/gin/isolate_holder.cc
@@ -14,7 +14,7 @@
#include "base/logging.h"
#include "base/message_loop/message_loop_current.h"
#include "base/single_thread_task_runner.h"
-#include "base/sys_info.h"
+#include "base/system/sys_info.h"
#include "base/threading/thread_task_runner_handle.h"
#include "build/build_config.h"
#include "gin/debug_impl.h"
@@ -71,7 +71,6 @@ IsolateHolder::IsolateHolder(
DCHECK_EQ(isolate_, snapshot_creator_->GetIsolate());
} else {
v8::Isolate::CreateParams params;
- params.entry_hook = DebugImpl::GetFunctionEntryHook();
params.code_event_handler = DebugImpl::GetJitCodeEventHandler();
params.constraints.ConfigureDefaults(
base::SysInfo::AmountOfPhysicalMemory(),
diff --git a/chromium/gin/public/debug.h b/chromium/gin/public/debug.h
index 14e30170985..8c2eee341c3 100644
--- a/chromium/gin/public/debug.h
+++ b/chromium/gin/public/debug.h
@@ -15,14 +15,6 @@ namespace gin {
class GIN_EXPORT Debug {
public:
- /* Installs a callback that is invoked on entry to every V8-generated
- * function.
- *
- * This only affects IsolateHolder instances created after
- * SetFunctionEntryHook was invoked.
- */
- static void SetFunctionEntryHook(v8::FunctionEntryHook entry_hook);
-
/* Installs a callback that is invoked each time jit code is added, moved,
* or removed.
*
diff --git a/chromium/gin/public/gin_embedders.h b/chromium/gin/public/gin_embedders.h
index 613136f83d6..30f48a6c859 100644
--- a/chromium/gin/public/gin_embedders.h
+++ b/chromium/gin/public/gin_embedders.h
@@ -15,6 +15,7 @@ enum GinEmbedder {
kEmbedderNativeGin,
kEmbedderBlink,
kEmbedderPDFium,
+ kEmbedderFuchsia,
};
} // namespace gin
diff --git a/chromium/gin/v8_foreground_task_runner.cc b/chromium/gin/v8_foreground_task_runner.cc
index d53085cc567..f6d916cd05e 100644
--- a/chromium/gin/v8_foreground_task_runner.cc
+++ b/chromium/gin/v8_foreground_task_runner.cc
@@ -24,6 +24,12 @@ void V8ForegroundTaskRunner::PostTask(std::unique_ptr<v8::Task> task) {
base::BindOnce(&v8::Task::Run, std::move(task)));
}
+void V8ForegroundTaskRunner::PostNonNestableTask(
+ std::unique_ptr<v8::Task> task) {
+ task_runner_->PostNonNestableTask(
+ FROM_HERE, base::BindOnce(&v8::Task::Run, std::move(task)));
+}
+
void V8ForegroundTaskRunner::PostDelayedTask(std::unique_ptr<v8::Task> task,
double delay_in_seconds) {
task_runner_->PostDelayedTask(
@@ -36,4 +42,8 @@ void V8ForegroundTaskRunner::PostIdleTask(std::unique_ptr<v8::IdleTask> task) {
idle_task_runner()->PostIdleTask(std::move(task));
}
+bool V8ForegroundTaskRunner::NonNestableTasksEnabled() const {
+ return true;
+}
+
} // namespace gin
diff --git a/chromium/gin/v8_foreground_task_runner.h b/chromium/gin/v8_foreground_task_runner.h
index b9da5f1bf40..62e4f3ad450 100644
--- a/chromium/gin/v8_foreground_task_runner.h
+++ b/chromium/gin/v8_foreground_task_runner.h
@@ -24,11 +24,15 @@ class V8ForegroundTaskRunner : public V8ForegroundTaskRunnerBase {
// v8::Platform implementation.
void PostTask(std::unique_ptr<v8::Task> task) override;
+ void PostNonNestableTask(std::unique_ptr<v8::Task> task) override;
+
void PostDelayedTask(std::unique_ptr<v8::Task> task,
double delay_in_seconds) override;
void PostIdleTask(std::unique_ptr<v8::IdleTask> task) override;
+ bool NonNestableTasksEnabled() const override;
+
private:
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
};
diff --git a/chromium/gin/v8_foreground_task_runner_with_locker.cc b/chromium/gin/v8_foreground_task_runner_with_locker.cc
index 032cf906e99..73425e218b9 100644
--- a/chromium/gin/v8_foreground_task_runner_with_locker.cc
+++ b/chromium/gin/v8_foreground_task_runner_with_locker.cc
@@ -57,6 +57,13 @@ void V8ForegroundTaskRunnerWithLocker::PostTask(
std::move(task)));
}
+void V8ForegroundTaskRunnerWithLocker::PostNonNestableTask(
+ std::unique_ptr<v8::Task> task) {
+ task_runner_->PostNonNestableTask(
+ FROM_HERE, base::BindOnce(RunWithLocker, base::Unretained(isolate_),
+ std::move(task)));
+}
+
void V8ForegroundTaskRunnerWithLocker::PostDelayedTask(
std::unique_ptr<v8::Task> task,
double delay_in_seconds) {
@@ -74,4 +81,8 @@ void V8ForegroundTaskRunnerWithLocker::PostIdleTask(
std::make_unique<IdleTaskWithLocker>(isolate_, std::move(task)));
}
+bool V8ForegroundTaskRunnerWithLocker::NonNestableTasksEnabled() const {
+ return true;
+}
+
} // namespace gin
diff --git a/chromium/gin/v8_foreground_task_runner_with_locker.h b/chromium/gin/v8_foreground_task_runner_with_locker.h
index 68c716f2446..22bc10d67bf 100644
--- a/chromium/gin/v8_foreground_task_runner_with_locker.h
+++ b/chromium/gin/v8_foreground_task_runner_with_locker.h
@@ -25,11 +25,15 @@ class V8ForegroundTaskRunnerWithLocker : public V8ForegroundTaskRunnerBase {
// v8::Platform implementation.
void PostTask(std::unique_ptr<v8::Task> task) override;
+ void PostNonNestableTask(std::unique_ptr<v8::Task> task) override;
+
void PostDelayedTask(std::unique_ptr<v8::Task> task,
double delay_in_seconds) override;
void PostIdleTask(std::unique_ptr<v8::IdleTask> task) override;
+ bool NonNestableTasksEnabled() const override;
+
private:
v8::Isolate* isolate_;
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
diff --git a/chromium/gin/v8_initializer.cc b/chromium/gin/v8_initializer.cc
index 48116401c0b..4b3ef5cfa06 100644
--- a/chromium/gin/v8_initializer.cc
+++ b/chromium/gin/v8_initializer.cc
@@ -21,7 +21,7 @@
#include "base/path_service.h"
#include "base/rand_util.h"
#include "base/strings/sys_string_conversions.h"
-#include "base/sys_info.h"
+#include "base/system/sys_info.h"
#include "base/threading/platform_thread.h"
#include "base/time/time.h"
#include "build/build_config.h"
diff --git a/chromium/gin/v8_platform.cc b/chromium/gin/v8_platform.cc
index 0f42722c2fc..e6eeb7b45e9 100644
--- a/chromium/gin/v8_platform.cc
+++ b/chromium/gin/v8_platform.cc
@@ -15,7 +15,7 @@
#include "base/location.h"
#include "base/logging.h"
#include "base/rand_util.h"
-#include "base/sys_info.h"
+#include "base/system/sys_info.h"
#include "base/task/post_task.h"
#include "base/task/task_scheduler/task_scheduler.h"
#include "base/task/task_traits.h"
@@ -114,7 +114,13 @@ base::LazyInstance<EnabledStateObserverImpl>::Leaky g_trace_state_dispatcher =
// TODO(skyostil): Deduplicate this with the clamper in Blink.
class TimeClamper {
public:
- static constexpr double kResolutionSeconds = 0.001;
+// As site isolation is enabled on desktop platforms, we can safely provide
+// more timing resolution. Jittering is still enabled everywhere.
+#if defined(OS_ANDROID)
+ static constexpr double kResolutionSeconds = 100e-6;
+#else
+ static constexpr double kResolutionSeconds = 5e-6;
+#endif
TimeClamper() : secret_(base::RandUint64()) {}
@@ -239,10 +245,15 @@ class PageAllocator : public v8::PageAllocator {
base::DecommitSystemPages(address, length);
return true;
} else {
- return base::SetSystemPagesAccess(address, length,
- GetPageConfig(permissions));
+ return base::TrySetSystemPagesAccess(address, length,
+ GetPageConfig(permissions));
}
}
+
+ bool DiscardSystemPages(void* address, size_t size) override {
+ base::DiscardSystemPages(address, size);
+ return true;
+ }
};
base::LazyInstance<PageAllocator>::Leaky g_page_allocator =
diff --git a/chromium/gin/wrappable_unittest.cc b/chromium/gin/wrappable_unittest.cc
index 701991b4483..74aa7e8dccb 100644
--- a/chromium/gin/wrappable_unittest.cc
+++ b/chromium/gin/wrappable_unittest.cc
@@ -167,7 +167,8 @@ TEST_F(WrappableTest, GetAndSetProperty) {
v8::Local<v8::Value> argv[] = {
ConvertToV8(isolate, obj.get()).ToLocalChecked(),
};
- func->Call(v8::Undefined(isolate), 1, argv);
+ func->Call(context_.Get(isolate), v8::Undefined(isolate), 1, argv)
+ .ToLocalChecked();
EXPECT_FALSE(try_catch.HasCaught());
EXPECT_EQ("", try_catch.GetStackTrace());
@@ -206,7 +207,8 @@ TEST_F(WrappableTest, MethodInvocationErrorsOnUnnamedObject) {
v8::Local<v8::Function> func;
EXPECT_TRUE(ConvertFromV8(isolate, val, &func));
v8::Local<v8::Value> argv[] = {function_to_run, context_object};
- func->Call(v8::Undefined(isolate), arraysize(argv), argv);
+ func->Call(context, v8::Undefined(isolate), base::size(argv), argv)
+ .FromMaybe(v8::Local<v8::Value>());
if (!try_catch.HasCaught())
return std::string();
return V8ToString(isolate, try_catch.Message()->Get());
@@ -261,7 +263,8 @@ TEST_F(WrappableTest, MethodInvocationErrorsOnNamedObject) {
v8::Local<v8::Function> func;
EXPECT_TRUE(ConvertFromV8(isolate, val, &func));
v8::Local<v8::Value> argv[] = {function_to_run, context_object};
- func->Call(v8::Undefined(isolate), arraysize(argv), argv);
+ func->Call(context, v8::Undefined(isolate), base::size(argv), argv)
+ .FromMaybe(v8::Local<v8::Value>());
if (!try_catch.HasCaught())
return std::string();
return V8ToString(isolate, try_catch.Message()->Get());