summaryrefslogtreecommitdiff
path: root/chromium/gin
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-05-09 14:22:11 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2016-05-09 15:11:45 +0000
commit2ddb2d3e14eef3de7dbd0cef553d669b9ac2361c (patch)
treee75f511546c5fd1a173e87c1f9fb11d7ac8d1af3 /chromium/gin
parenta4f3d46271c57e8155ba912df46a05559d14726e (diff)
downloadqtwebengine-chromium-2ddb2d3e14eef3de7dbd0cef553d669b9ac2361c.tar.gz
BASELINE: Update Chromium to 51.0.2704.41
Also adds in all smaller components by reversing logic for exclusion. Change-Id: Ibf90b506e7da088ea2f65dcf23f2b0992c504422 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'chromium/gin')
-rw-r--r--chromium/gin/BUILD.gn11
-rw-r--r--chromium/gin/OWNERS2
-rw-r--r--chromium/gin/converter_unittest.cc1
-rw-r--r--chromium/gin/dictionary.cc2
-rw-r--r--chromium/gin/dictionary.h1
-rw-r--r--chromium/gin/gin.gyp2
-rw-r--r--chromium/gin/gin_features.cc14
-rw-r--r--chromium/gin/isolate_holder.cc4
-rw-r--r--chromium/gin/modules/module_registry.cc13
-rw-r--r--chromium/gin/modules/module_registry.h9
-rw-r--r--chromium/gin/modules/module_registry_unittest.cc4
-rw-r--r--chromium/gin/modules/timer_unittest.cc5
-rw-r--r--chromium/gin/object_template_builder.cc3
-rw-r--r--chromium/gin/object_template_builder.h4
-rw-r--r--chromium/gin/per_isolate_data.cc2
-rw-r--r--chromium/gin/per_isolate_data.h6
-rw-r--r--chromium/gin/public/context_holder.h4
-rw-r--r--chromium/gin/public/gin_features.h20
-rw-r--r--chromium/gin/public/isolate_holder.h11
-rw-r--r--chromium/gin/public/v8_platform.h3
-rw-r--r--chromium/gin/run_microtasks_observer.cc2
-rw-r--r--chromium/gin/run_microtasks_observer.h2
-rw-r--r--chromium/gin/shell/gin_main.cc4
-rw-r--r--chromium/gin/shell_runner.h1
-rw-r--r--chromium/gin/v8_initializer.cc141
-rw-r--r--chromium/gin/v8_initializer.h13
-rw-r--r--chromium/gin/v8_isolate_memory_dump_provider_unittest.cc4
-rw-r--r--chromium/gin/v8_platform.cc21
-rw-r--r--chromium/gin/wrappable.h3
29 files changed, 226 insertions, 86 deletions
diff --git a/chromium/gin/BUILD.gn b/chromium/gin/BUILD.gn
index 4531cd1f637..a921890fdb3 100644
--- a/chromium/gin/BUILD.gn
+++ b/chromium/gin/BUILD.gn
@@ -21,6 +21,7 @@ component("gin") {
"function_template.cc",
"function_template.h",
"gin_export.h",
+ "gin_features.cc",
"handle.h",
"interceptor.cc",
"interceptor.h",
@@ -45,6 +46,7 @@ component("gin") {
"public/context_holder.h",
"public/debug.h",
"public/gin_embedders.h",
+ "public/gin_features.h",
"public/isolate_holder.h",
"public/v8_idle_task_runner.h",
"public/v8_platform.h",
@@ -202,12 +204,3 @@ test("gin_unittests") {
":gin_shell",
]
}
-
-# TODO(GYP): Delete this after we've converted everything to GN.
-# The _run targets exist only for compatibility w/ GYP.
-group("gin_unittests_run") {
- testonly = true
- deps = [
- ":gin_unittests",
- ]
-}
diff --git a/chromium/gin/OWNERS b/chromium/gin/OWNERS
index 35dde41b938..d691287b2d5 100644
--- a/chromium/gin/OWNERS
+++ b/chromium/gin/OWNERS
@@ -1,3 +1 @@
-aa@chromium.org
-abarth@chromium.org
jochen@chromium.org
diff --git a/chromium/gin/converter_unittest.cc b/chromium/gin/converter_unittest.cc
index ec543c253d9..a198f40c666 100644
--- a/chromium/gin/converter_unittest.cc
+++ b/chromium/gin/converter_unittest.cc
@@ -9,7 +9,6 @@
#include <stdint.h>
#include "base/compiler_specific.h"
-#include "base/memory/scoped_ptr.h"
#include "gin/public/isolate_holder.h"
#include "gin/test/v8_test.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/chromium/gin/dictionary.cc b/chromium/gin/dictionary.cc
index 018a82c66f3..54f1a4a5f52 100644
--- a/chromium/gin/dictionary.cc
+++ b/chromium/gin/dictionary.cc
@@ -16,6 +16,8 @@ Dictionary::Dictionary(v8::Isolate* isolate,
object_(object) {
}
+Dictionary::Dictionary(const Dictionary& other) = default;
+
Dictionary::~Dictionary() {
}
diff --git a/chromium/gin/dictionary.h b/chromium/gin/dictionary.h
index 64736b1d162..5a61cc7d4c9 100644
--- a/chromium/gin/dictionary.h
+++ b/chromium/gin/dictionary.h
@@ -26,6 +26,7 @@ class GIN_EXPORT Dictionary {
public:
explicit Dictionary(v8::Isolate* isolate);
Dictionary(v8::Isolate* isolate, v8::Local<v8::Object> object);
+ Dictionary(const Dictionary& other);
~Dictionary();
static Dictionary CreateEmpty(v8::Isolate* isolate);
diff --git a/chromium/gin/gin.gyp b/chromium/gin/gin.gyp
index 1b5a544b018..fa03c10fc41 100644
--- a/chromium/gin/gin.gyp
+++ b/chromium/gin/gin.gyp
@@ -38,6 +38,7 @@
'function_template.cc',
'function_template.h',
'gin_export.h',
+ 'gin_features.cc',
'handle.h',
'interceptor.cc',
'interceptor.h',
@@ -62,6 +63,7 @@
'public/context_holder.h',
'public/debug.h',
'public/gin_embedders.h',
+ 'public/gin_features.h',
'public/isolate_holder.h',
'public/v8_platform.h',
'public/wrapper_info.h',
diff --git a/chromium/gin/gin_features.cc b/chromium/gin/gin_features.cc
new file mode 100644
index 00000000000..9bb2130a015
--- /dev/null
+++ b/chromium/gin/gin_features.cc
@@ -0,0 +1,14 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "gin/public/gin_features.h"
+
+namespace features {
+
+// Enables or disables the experimental V8 Ignition interpreter.
+const base::Feature kV8Ignition {
+ "V8Ignition", base::FEATURE_DISABLED_BY_DEFAULT
+};
+
+} // namespace features
diff --git a/chromium/gin/isolate_holder.cc b/chromium/gin/isolate_holder.cc
index c05cd1e42db..5252400c13c 100644
--- a/chromium/gin/isolate_holder.cc
+++ b/chromium/gin/isolate_holder.cc
@@ -7,6 +7,8 @@
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
+
+#include <memory>
#include <utility>
#include "base/logging.h"
@@ -96,7 +98,7 @@ void IsolateHolder::RemoveRunMicrotasksObserver() {
}
void IsolateHolder::EnableIdleTasks(
- scoped_ptr<V8IdleTaskRunner> idle_task_runner) {
+ std::unique_ptr<V8IdleTaskRunner> idle_task_runner) {
DCHECK(isolate_data_.get());
isolate_data_->EnableIdleTasks(std::move(idle_task_runner));
}
diff --git a/chromium/gin/modules/module_registry.cc b/chromium/gin/modules/module_registry.cc
index deec1874b48..209eb06591d 100644
--- a/chromium/gin/modules/module_registry.cc
+++ b/chromium/gin/modules/module_registry.cc
@@ -56,7 +56,7 @@ namespace {
const char kModuleRegistryKey[] = "ModuleRegistry";
struct ModuleRegistryData : public base::SupportsUserData::Data {
- scoped_ptr<ModuleRegistry> registry;
+ std::unique_ptr<ModuleRegistry> registry;
};
void Define(const v8::FunctionCallbackInfo<Value>& info) {
@@ -76,7 +76,7 @@ void Define(const v8::FunctionCallbackInfo<Value>& info) {
if (!args.GetNext(&factory))
return args.ThrowError();
- scoped_ptr<PendingModule> pending(new PendingModule);
+ std::unique_ptr<PendingModule> pending(new PendingModule);
pending->id = id;
pending->dependencies = dependencies;
pending->factory.Reset(args.isolate(), factory);
@@ -158,7 +158,7 @@ void ModuleRegistry::AddBuiltinModule(Isolate* isolate, const std::string& id,
}
void ModuleRegistry::AddPendingModule(Isolate* isolate,
- scoped_ptr<PendingModule> pending) {
+ std::unique_ptr<PendingModule> pending) {
const std::string pending_id = pending->id;
const std::vector<std::string> pending_dependencies = pending->dependencies;
AttemptToLoad(isolate, std::move(pending));
@@ -227,7 +227,8 @@ bool ModuleRegistry::CheckDependencies(PendingModule* pending) {
return num_missing_dependencies == 0;
}
-bool ModuleRegistry::Load(Isolate* isolate, scoped_ptr<PendingModule> pending) {
+bool ModuleRegistry::Load(Isolate* isolate,
+ std::unique_ptr<PendingModule> pending) {
if (!pending->id.empty() && available_modules_.count(pending->id))
return true; // We've already loaded this module.
@@ -253,7 +254,7 @@ bool ModuleRegistry::Load(Isolate* isolate, scoped_ptr<PendingModule> pending) {
}
bool ModuleRegistry::AttemptToLoad(Isolate* isolate,
- scoped_ptr<PendingModule> pending) {
+ std::unique_ptr<PendingModule> pending) {
if (!CheckDependencies(pending.get())) {
pending_modules_.push_back(pending.release());
return false;
@@ -276,7 +277,7 @@ void ModuleRegistry::AttemptToLoadMoreModules(Isolate* isolate) {
PendingModuleVector pending_modules;
pending_modules.swap(pending_modules_);
for (size_t i = 0; i < pending_modules.size(); ++i) {
- scoped_ptr<PendingModule> pending(pending_modules[i]);
+ std::unique_ptr<PendingModule> pending(pending_modules[i]);
pending_modules[i] = NULL;
if (AttemptToLoad(isolate, std::move(pending)))
keep_trying = true;
diff --git a/chromium/gin/modules/module_registry.h b/chromium/gin/modules/module_registry.h
index 0f67137abb3..9bbfd6e0b92 100644
--- a/chromium/gin/modules/module_registry.h
+++ b/chromium/gin/modules/module_registry.h
@@ -7,13 +7,13 @@
#include <list>
#include <map>
+#include <memory>
#include <set>
#include <string>
#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
#include "base/observer_list.h"
#include "gin/gin_export.h"
@@ -59,7 +59,7 @@ class GIN_EXPORT ModuleRegistry {
// The caller must have already entered our context.
void AddPendingModule(v8::Isolate* isolate,
- scoped_ptr<PendingModule> pending);
+ std::unique_ptr<PendingModule> pending);
void LoadModule(v8::Isolate* isolate,
const std::string& id,
@@ -82,13 +82,14 @@ class GIN_EXPORT ModuleRegistry {
explicit ModuleRegistry(v8::Isolate* isolate);
- bool Load(v8::Isolate* isolate, scoped_ptr<PendingModule> pending);
+ bool Load(v8::Isolate* isolate, std::unique_ptr<PendingModule> pending);
bool RegisterModule(v8::Isolate* isolate,
const std::string& id,
v8::Local<v8::Value> module);
bool CheckDependencies(PendingModule* pending);
- bool AttemptToLoad(v8::Isolate* isolate, scoped_ptr<PendingModule> pending);
+ bool AttemptToLoad(v8::Isolate* isolate,
+ std::unique_ptr<PendingModule> pending);
v8::Local<v8::Value> GetModule(v8::Isolate* isolate, const std::string& id);
diff --git a/chromium/gin/modules/module_registry_unittest.cc b/chromium/gin/modules/module_registry_unittest.cc
index e337c2d9b4b..3921539016d 100644
--- a/chromium/gin/modules/module_registry_unittest.cc
+++ b/chromium/gin/modules/module_registry_unittest.cc
@@ -6,6 +6,8 @@
#include <stdint.h>
+#include <memory>
+
#include "base/bind.h"
#include "base/macros.h"
#include "gin/modules/module_registry_observer.h"
@@ -28,7 +30,7 @@ struct TestHelper {
}
ModuleRunnerDelegate delegate;
- scoped_ptr<ShellRunner> runner;
+ std::unique_ptr<ShellRunner> runner;
Runner::Scope scope;
};
diff --git a/chromium/gin/modules/timer_unittest.cc b/chromium/gin/modules/timer_unittest.cc
index 612275e4729..1739e5765df 100644
--- a/chromium/gin/modules/timer_unittest.cc
+++ b/chromium/gin/modules/timer_unittest.cc
@@ -4,7 +4,8 @@
#include "gin/modules/timer.h"
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
#include "base/message_loop/message_loop.h"
#include "gin/handle.h"
#include "gin/object_template_builder.h"
@@ -71,7 +72,7 @@ struct TestHelper {
}
ShellRunnerDelegate delegate;
- scoped_ptr<ShellRunner> runner;
+ std::unique_ptr<ShellRunner> runner;
Runner::Scope scope;
Handle<TimerModule> timer_module;
Handle<Result> result;
diff --git a/chromium/gin/object_template_builder.cc b/chromium/gin/object_template_builder.cc
index 158131f206c..a40df6037f3 100644
--- a/chromium/gin/object_template_builder.cc
+++ b/chromium/gin/object_template_builder.cc
@@ -145,6 +145,9 @@ ObjectTemplateBuilder::ObjectTemplateBuilder(v8::Isolate* isolate)
template_->SetInternalFieldCount(kNumberOfInternalFields);
}
+ObjectTemplateBuilder::ObjectTemplateBuilder(
+ const ObjectTemplateBuilder& other) = default;
+
ObjectTemplateBuilder::~ObjectTemplateBuilder() {
}
diff --git a/chromium/gin/object_template_builder.h b/chromium/gin/object_template_builder.h
index 3cfd4a394b9..bf0ece1e723 100644
--- a/chromium/gin/object_template_builder.h
+++ b/chromium/gin/object_template_builder.h
@@ -10,7 +10,6 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/strings/string_piece.h"
-#include "base/template_util.h"
#include "gin/converter.h"
#include "gin/function_template.h"
#include "gin/gin_export.h"
@@ -57,7 +56,7 @@ struct CallbackTraits<base::Callback<T> > {
template <typename T>
struct CallbackTraits<
T,
- typename std::enable_if<base::is_member_function_pointer<T>::value>::type> {
+ typename std::enable_if<std::is_member_function_pointer<T>::value>::type> {
static v8::Local<v8::FunctionTemplate> CreateTemplate(v8::Isolate* isolate,
T callback) {
return CreateFunctionTemplate(isolate, base::Bind(callback),
@@ -89,6 +88,7 @@ struct CallbackTraits<v8::Local<v8::FunctionTemplate> > {
class GIN_EXPORT ObjectTemplateBuilder {
public:
explicit ObjectTemplateBuilder(v8::Isolate* isolate);
+ ObjectTemplateBuilder(const ObjectTemplateBuilder& other);
~ObjectTemplateBuilder();
// It's against Google C++ style to return a non-const ref, but we take some
diff --git a/chromium/gin/per_isolate_data.cc b/chromium/gin/per_isolate_data.cc
index a6101582fa3..4ae408572dc 100644
--- a/chromium/gin/per_isolate_data.cc
+++ b/chromium/gin/per_isolate_data.cc
@@ -114,7 +114,7 @@ NamedPropertyInterceptor* PerIsolateData::GetNamedPropertyInterceptor(
}
void PerIsolateData::EnableIdleTasks(
- scoped_ptr<V8IdleTaskRunner> idle_task_runner) {
+ std::unique_ptr<V8IdleTaskRunner> idle_task_runner) {
idle_task_runner_ = std::move(idle_task_runner);
}
diff --git a/chromium/gin/per_isolate_data.h b/chromium/gin/per_isolate_data.h
index a1ef4747aa9..9b804aa4ba5 100644
--- a/chromium/gin/per_isolate_data.h
+++ b/chromium/gin/per_isolate_data.h
@@ -6,10 +6,10 @@
#define GIN_PER_ISOLATE_DATA_H_
#include <map>
+#include <memory>
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "gin/gin_export.h"
#include "gin/public/v8_idle_task_runner.h"
#include "gin/public/wrapper_info.h"
@@ -65,7 +65,7 @@ class GIN_EXPORT PerIsolateData {
WrappableBase* base);
NamedPropertyInterceptor* GetNamedPropertyInterceptor(WrappableBase* base);
- void EnableIdleTasks(scoped_ptr<V8IdleTaskRunner> idle_task_runner);
+ void EnableIdleTasks(std::unique_ptr<V8IdleTaskRunner> idle_task_runner);
v8::Isolate* isolate() { return isolate_; }
v8::ArrayBuffer::Allocator* allocator() { return allocator_; }
@@ -93,7 +93,7 @@ class GIN_EXPORT PerIsolateData {
IndexedPropertyInterceptorMap indexed_interceptors_;
NamedPropertyInterceptorMap named_interceptors_;
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
- scoped_ptr<V8IdleTaskRunner> idle_task_runner_;
+ std::unique_ptr<V8IdleTaskRunner> idle_task_runner_;
DISALLOW_COPY_AND_ASSIGN(PerIsolateData);
};
diff --git a/chromium/gin/public/context_holder.h b/chromium/gin/public/context_holder.h
index 176af1754fe..f0efc9b6473 100644
--- a/chromium/gin/public/context_holder.h
+++ b/chromium/gin/public/context_holder.h
@@ -6,9 +6,9 @@
#define GIN_PUBLIC_CONTEXT_HOLDER_H_
#include <list>
+#include <memory>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "gin/gin_export.h"
#include "v8/include/v8.h"
@@ -42,7 +42,7 @@ class GIN_EXPORT ContextHolder {
private:
v8::Isolate* isolate_;
v8::UniquePersistent<v8::Context> context_;
- scoped_ptr<PerContextData> data_;
+ std::unique_ptr<PerContextData> data_;
DISALLOW_COPY_AND_ASSIGN(ContextHolder);
};
diff --git a/chromium/gin/public/gin_features.h b/chromium/gin/public/gin_features.h
new file mode 100644
index 00000000000..6a6c6b924c9
--- /dev/null
+++ b/chromium/gin/public/gin_features.h
@@ -0,0 +1,20 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This file defines all the public base::FeatureList features for the gin
+// module.
+
+#ifndef GIN_PUBLIC_GIN_FEATURES_H_
+#define GIN_PUBLIC_GIN_FEATURES_H_
+
+#include "base/feature_list.h"
+#include "gin/gin_export.h"
+
+namespace features {
+
+GIN_EXPORT extern const base::Feature kV8Ignition;
+
+} // namespace features
+
+#endif // GIN_PUBLIC_GIN_FEATURES_H_
diff --git a/chromium/gin/public/isolate_holder.h b/chromium/gin/public/isolate_holder.h
index cb51c2f0844..7cf3d94ac89 100644
--- a/chromium/gin/public/isolate_holder.h
+++ b/chromium/gin/public/isolate_holder.h
@@ -5,8 +5,9 @@
#ifndef GIN_PUBLIC_ISOLATE_HOLDER_H_
#define GIN_PUBLIC_ISOLATE_HOLDER_H_
+#include <memory>
+
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "gin/gin_export.h"
#include "gin/public/v8_idle_task_runner.h"
#include "v8/include/v8.h"
@@ -74,7 +75,7 @@ class GIN_EXPORT IsolateHolder {
// This method returns if v8::Locker is needed to access isolate.
AccessMode access_mode() const { return access_mode_; }
- void EnableIdleTasks(scoped_ptr<V8IdleTaskRunner> idle_task_runner);
+ void EnableIdleTasks(std::unique_ptr<V8IdleTaskRunner> idle_task_runner);
// This method returns V8IsolateMemoryDumpProvider of this isolate, used for
// testing.
@@ -85,9 +86,9 @@ class GIN_EXPORT IsolateHolder {
private:
v8::Isolate* isolate_;
- scoped_ptr<PerIsolateData> isolate_data_;
- scoped_ptr<RunMicrotasksObserver> task_observer_;
- scoped_ptr<V8IsolateMemoryDumpProvider> isolate_memory_dump_provider_;
+ std::unique_ptr<PerIsolateData> isolate_data_;
+ std::unique_ptr<RunMicrotasksObserver> task_observer_;
+ std::unique_ptr<V8IsolateMemoryDumpProvider> isolate_memory_dump_provider_;
AccessMode access_mode_;
DISALLOW_COPY_AND_ASSIGN(IsolateHolder);
diff --git a/chromium/gin/public/v8_platform.h b/chromium/gin/public/v8_platform.h
index 31e812e05b7..ad37a5c4ceb 100644
--- a/chromium/gin/public/v8_platform.h
+++ b/chromium/gin/public/v8_platform.h
@@ -8,7 +8,6 @@
#include "base/compiler_specific.h"
#include "base/lazy_instance.h"
#include "base/macros.h"
-#include "base/trace_event/trace_event.h"
#include "gin/gin_export.h"
#include "v8/include/v8-platform.h"
@@ -20,6 +19,7 @@ class GIN_EXPORT V8Platform : public NON_EXPORTED_BASE(v8::Platform) {
static V8Platform* Get();
// v8::Platform implementation.
+ size_t NumberOfAvailableBackgroundThreads() override;
void CallOnBackgroundThread(
v8::Task* task,
v8::Platform::ExpectedRuntime expected_runtime) override;
@@ -37,6 +37,7 @@ class GIN_EXPORT V8Platform : public NON_EXPORTED_BASE(v8::Platform) {
uint64_t AddTraceEvent(char phase,
const uint8_t* category_enabled_flag,
const char* name,
+ const char* scope,
uint64_t id,
uint64_t bind_id,
int32_t num_args,
diff --git a/chromium/gin/run_microtasks_observer.cc b/chromium/gin/run_microtasks_observer.cc
index f453a66a1eb..0ca00787050 100644
--- a/chromium/gin/run_microtasks_observer.cc
+++ b/chromium/gin/run_microtasks_observer.cc
@@ -15,7 +15,7 @@ void RunMicrotasksObserver::WillProcessTask(const base::PendingTask& task) {
void RunMicrotasksObserver::DidProcessTask(const base::PendingTask& task) {
v8::Isolate::Scope scope(isolate_);
- isolate_->RunMicrotasks();
+ v8::MicrotasksScope::PerformCheckpoint(isolate_);
}
} // namespace gin
diff --git a/chromium/gin/run_microtasks_observer.h b/chromium/gin/run_microtasks_observer.h
index 7f1431fb2ec..ca160bed609 100644
--- a/chromium/gin/run_microtasks_observer.h
+++ b/chromium/gin/run_microtasks_observer.h
@@ -12,7 +12,7 @@ namespace gin {
// Runs any pending v8 Microtasks each time a task is completed.
// TODO(hansmuller); At some point perhaps this can be replaced with
-// the (currently experimental) Isolate::SetAutorunMicrotasks() method.
+// the (currently experimental) v8::MicrotasksPolicy::kAuto method.
class RunMicrotasksObserver : public base::MessageLoop::TaskObserver {
public:
diff --git a/chromium/gin/shell/gin_main.cc b/chromium/gin/shell/gin_main.cc
index 1fff9f5e5a0..b45afefe567 100644
--- a/chromium/gin/shell/gin_main.cc
+++ b/chromium/gin/shell/gin_main.cc
@@ -5,6 +5,7 @@
#include "base/at_exit.h"
#include "base/bind.h"
#include "base/command_line.h"
+#include "base/feature_list.h"
#include "base/files/file_util.h"
#include "base/i18n/icu_util.h"
#include "base/macros.h"
@@ -68,6 +69,9 @@ int main(int argc, char** argv) {
base::MessageLoop message_loop;
+ // Initialize the base::FeatureList since IsolateHolder can depend on it.
+ base::FeatureList::SetInstance(make_scoped_ptr(new base::FeatureList));
+
gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode,
gin::IsolateHolder::kStableV8Extras,
gin::ArrayBufferAllocator::SharedInstance());
diff --git a/chromium/gin/shell_runner.h b/chromium/gin/shell_runner.h
index 2d1cc4902b5..71f00fd2bcf 100644
--- a/chromium/gin/shell_runner.h
+++ b/chromium/gin/shell_runner.h
@@ -6,6 +6,7 @@
#define GIN_SHELL_RUNNER_H_
#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
#include "gin/runner.h"
namespace gin {
diff --git a/chromium/gin/v8_initializer.cc b/chromium/gin/v8_initializer.cc
index cfb3630ebcf..41e34e86567 100644
--- a/chromium/gin/v8_initializer.cc
+++ b/chromium/gin/v8_initializer.cc
@@ -7,18 +7,22 @@
#include <stddef.h>
#include <stdint.h>
+#include <memory>
+
#include "base/debug/alias.h"
+#include "base/feature_list.h"
#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/files/memory_mapped_file.h"
+#include "base/lazy_instance.h"
#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
#include "base/metrics/histogram.h"
#include "base/rand_util.h"
#include "base/strings/sys_string_conversions.h"
#include "base/threading/platform_thread.h"
#include "base/time/time.h"
#include "crypto/sha2.h"
+#include "gin/public/gin_features.h"
#if defined(V8_USE_EXTERNAL_STARTUP_DATA)
#if defined(OS_ANDROID)
@@ -50,19 +54,34 @@ const base::PlatformFile kInvalidPlatformFile =
// File handles intentionally never closed. Not using File here because its
// Windows implementation guards against two instances owning the same
// PlatformFile (which we allow since we know it is never freed).
-base::PlatformFile g_natives_pf = kInvalidPlatformFile;
-base::PlatformFile g_snapshot_pf = kInvalidPlatformFile;
-base::MemoryMappedFile::Region g_natives_region;
-base::MemoryMappedFile::Region g_snapshot_region;
+typedef std::map<const char*,
+ std::pair<base::PlatformFile, base::MemoryMappedFile::Region>>
+ OpenedFileMap;
+static base::LazyInstance<OpenedFileMap>::Leaky g_opened_files =
+ LAZY_INSTANCE_INITIALIZER;
+
+OpenedFileMap::mapped_type& GetOpenedFile(const char* file) {
+ OpenedFileMap& opened_files(g_opened_files.Get());
+ if (opened_files.find(file) == opened_files.end()) {
+ opened_files[file] =
+ std::make_pair(kInvalidPlatformFile, base::MemoryMappedFile::Region());
+ }
+ return opened_files[file];
+}
#if defined(OS_ANDROID)
-#ifdef __LP64__
-const char kNativesFileName[] = "natives_blob_64.bin";
-const char kSnapshotFileName[] = "snapshot_blob_64.bin";
+const char kNativesFileName64[] = "natives_blob_64.bin";
+const char kSnapshotFileName64[] = "snapshot_blob_64.bin";
+const char kNativesFileName32[] = "natives_blob_32.bin";
+const char kSnapshotFileName32[] = "snapshot_blob_32.bin";
+
+#if defined(__LP64__)
+#define kNativesFileName kNativesFileName64
+#define kSnapshotFileName kSnapshotFileName64
#else
-const char kNativesFileName[] = "natives_blob_32.bin";
-const char kSnapshotFileName[] = "snapshot_blob_32.bin";
-#endif // __LP64__
+#define kNativesFileName kNativesFileName32
+#define kSnapshotFileName kSnapshotFileName32
+#endif
#else // defined(OS_ANDROID)
const char kNativesFileName[] = "natives_blob.bin";
@@ -95,7 +114,8 @@ static bool MapV8File(base::PlatformFile platform_file,
base::MemoryMappedFile::Region region,
base::MemoryMappedFile** mmapped_file_out) {
DCHECK(*mmapped_file_out == NULL);
- scoped_ptr<base::MemoryMappedFile> mmapped_file(new base::MemoryMappedFile());
+ std::unique_ptr<base::MemoryMappedFile> mmapped_file(
+ new base::MemoryMappedFile());
if (mmapped_file->Initialize(base::File(platform_file), region)) {
*mmapped_file_out = mmapped_file.release();
return true;
@@ -170,16 +190,13 @@ base::PlatformFile OpenV8File(const char* file_name,
return file.TakePlatformFile();
}
-void OpenNativesFileIfNecessary() {
- if (g_natives_pf == kInvalidPlatformFile) {
- g_natives_pf = OpenV8File(kNativesFileName, &g_natives_region);
- }
-}
-
-void OpenSnapshotFileIfNecessary() {
- if (g_snapshot_pf == kInvalidPlatformFile) {
- g_snapshot_pf = OpenV8File(kSnapshotFileName, &g_snapshot_region);
+static const OpenedFileMap::mapped_type OpenFileIfNecessary(
+ const char* file_name) {
+ OpenedFileMap::mapped_type& opened = GetOpenedFile(file_name);
+ if (opened.first == kInvalidPlatformFile) {
+ opened.first = OpenV8File(file_name, &opened.second);
}
+ return opened;
}
#if defined(V8_VERIFY_EXTERNAL_STARTUP_DATA)
@@ -236,15 +253,14 @@ enum LoadV8FileResult {
V8_LOAD_MAX_VALUE
};
-static LoadV8FileResult MapVerify(base::PlatformFile platform_file,
- const base::MemoryMappedFile::Region& region,
+static LoadV8FileResult MapVerify(const OpenedFileMap::mapped_type& file_region,
#if defined(V8_VERIFY_EXTERNAL_STARTUP_DATA)
const unsigned char* fingerprint,
#endif
base::MemoryMappedFile** mmapped_file_out) {
- if (platform_file == kInvalidPlatformFile)
+ if (file_region.first == kInvalidPlatformFile)
return V8_LOAD_FAILED_OPEN;
- if (!MapV8File(platform_file, region, mmapped_file_out))
+ if (!MapV8File(file_region.first, file_region.second, mmapped_file_out))
return V8_LOAD_FAILED_MAP;
#if defined(V8_VERIFY_EXTERNAL_STARTUP_DATA)
if (!VerifyV8StartupFile(mmapped_file_out, fingerprint))
@@ -258,8 +274,8 @@ void V8Initializer::LoadV8Snapshot() {
if (g_mapped_snapshot)
return;
- OpenSnapshotFileIfNecessary();
- LoadV8FileResult result = MapVerify(g_snapshot_pf, g_snapshot_region,
+ OpenFileIfNecessary(kSnapshotFileName);
+ LoadV8FileResult result = MapVerify(GetOpenedFile(kSnapshotFileName),
#if defined(V8_VERIFY_EXTERNAL_STARTUP_DATA)
g_snapshot_fingerprint,
#endif
@@ -274,8 +290,8 @@ void V8Initializer::LoadV8Natives() {
if (g_mapped_natives)
return;
- OpenNativesFileIfNecessary();
- LoadV8FileResult result = MapVerify(g_natives_pf, g_natives_region,
+ OpenFileIfNecessary(kNativesFileName);
+ LoadV8FileResult result = MapVerify(GetOpenedFile(kNativesFileName),
#if defined(V8_VERIFY_EXTERNAL_STARTUP_DATA)
g_natives_fingerprint,
#endif
@@ -311,8 +327,8 @@ void V8Initializer::LoadV8SnapshotFromFD(base::PlatformFile snapshot_pf,
result = V8_LOAD_FAILED_VERIFY;
#endif // V8_VERIFY_EXTERNAL_STARTUP_DATA
if (result == V8_LOAD_SUCCESS) {
- g_snapshot_pf = snapshot_pf;
- g_snapshot_region = snapshot_region;
+ g_opened_files.Get()[kSnapshotFileName] =
+ std::make_pair(snapshot_pf, snapshot_region);
}
UMA_HISTOGRAM_ENUMERATION("V8.Initializer.LoadV8Snapshot.Result", result,
V8_LOAD_MAX_VALUE);
@@ -342,25 +358,51 @@ void V8Initializer::LoadV8NativesFromFD(base::PlatformFile natives_pf,
LOG(FATAL) << "Couldn't verify contents of v8 natives data file";
}
#endif // V8_VERIFY_EXTERNAL_STARTUP_DATA
- g_natives_pf = natives_pf;
- g_natives_region = natives_region;
+ g_opened_files.Get()[kNativesFileName] =
+ std::make_pair(natives_pf, natives_region);
}
// static
base::PlatformFile V8Initializer::GetOpenNativesFileForChildProcesses(
base::MemoryMappedFile::Region* region_out) {
- OpenNativesFileIfNecessary();
- *region_out = g_natives_region;
- return g_natives_pf;
+ const OpenedFileMap::mapped_type& opened =
+ OpenFileIfNecessary(kNativesFileName);
+ *region_out = opened.second;
+ return opened.first;
}
// static
base::PlatformFile V8Initializer::GetOpenSnapshotFileForChildProcesses(
base::MemoryMappedFile::Region* region_out) {
- OpenSnapshotFileIfNecessary();
- *region_out = g_snapshot_region;
- return g_snapshot_pf;
+ const OpenedFileMap::mapped_type& opened =
+ OpenFileIfNecessary(kSnapshotFileName);
+ *region_out = opened.second;
+ return opened.first;
}
+
+#if defined(OS_ANDROID)
+// static
+base::PlatformFile V8Initializer::GetOpenNativesFileForChildProcesses(
+ base::MemoryMappedFile::Region* region_out,
+ bool abi_32_bit) {
+ const char* natives_file =
+ abi_32_bit ? kNativesFileName32 : kNativesFileName64;
+ const OpenedFileMap::mapped_type& opened = OpenFileIfNecessary(natives_file);
+ *region_out = opened.second;
+ return opened.first;
+}
+
+// static
+base::PlatformFile V8Initializer::GetOpenSnapshotFileForChildProcesses(
+ base::MemoryMappedFile::Region* region_out,
+ bool abi_32_bit) {
+ const char* snapshot_file =
+ abi_32_bit ? kSnapshotFileName32 : kSnapshotFileName64;
+ const OpenedFileMap::mapped_type& opened = OpenFileIfNecessary(snapshot_file);
+ *region_out = opened.second;
+ return opened.first;
+}
+#endif // defined(OS_ANDROID)
#endif // defined(V8_USE_EXTERNAL_STARTUP_DATA)
// static
@@ -381,6 +423,11 @@ void V8Initializer::Initialize(IsolateHolder::ScriptMode mode,
v8::V8::SetFlagsFromString(flag, sizeof(flag) - 1);
}
+ if (base::FeatureList::IsEnabled(features::kV8Ignition)) {
+ std::string flag("--ignition");
+ v8::V8::SetFlagsFromString(flag.c_str(), static_cast<int>(flag.size()));
+ }
+
#if defined(V8_USE_EXTERNAL_STARTUP_DATA)
v8::StartupData natives;
natives.data = reinterpret_cast<const char*>(g_mapped_natives->data());
@@ -423,4 +470,20 @@ void V8Initializer::GetV8ExternalSnapshotData(const char** natives_data_out,
}
}
+#if defined(OS_ANDROID)
+// static
+base::FilePath V8Initializer::GetNativesFilePath(bool abi_32_bit) {
+ base::FilePath path;
+ GetV8FilePath(abi_32_bit ? kNativesFileName32 : kNativesFileName64, &path);
+ return path;
+}
+
+// static
+base::FilePath V8Initializer::GetSnapshotFilePath(bool abi_32_bit) {
+ base::FilePath path;
+ GetV8FilePath(abi_32_bit ? kSnapshotFileName32 : kSnapshotFileName64, &path);
+ return path;
+}
+#endif // defined(OS_ANDROID)
+
} // namespace gin
diff --git a/chromium/gin/v8_initializer.h b/chromium/gin/v8_initializer.h
index dcb5329d074..4c034804812 100644
--- a/chromium/gin/v8_initializer.h
+++ b/chromium/gin/v8_initializer.h
@@ -65,6 +65,19 @@ class GIN_EXPORT V8Initializer {
// Will return -1 if the file does not exist.
static base::PlatformFile GetOpenSnapshotFileForChildProcesses(
base::MemoryMappedFile::Region* region_out);
+
+#if defined(OS_ANDROID)
+ static base::PlatformFile GetOpenNativesFileForChildProcesses(
+ base::MemoryMappedFile::Region* region_out,
+ bool abi_32_bit);
+ static base::PlatformFile GetOpenSnapshotFileForChildProcesses(
+ base::MemoryMappedFile::Region* region_out,
+ bool abi_32_bit);
+
+ static base::FilePath GetNativesFilePath(bool abi_32_bit);
+ static base::FilePath GetSnapshotFilePath(bool abi_32_bit);
+#endif
+
#endif // V8_USE_EXTERNAL_STARTUP_DATA
};
diff --git a/chromium/gin/v8_isolate_memory_dump_provider_unittest.cc b/chromium/gin/v8_isolate_memory_dump_provider_unittest.cc
index 3979a324fa3..a1b730ac884 100644
--- a/chromium/gin/v8_isolate_memory_dump_provider_unittest.cc
+++ b/chromium/gin/v8_isolate_memory_dump_provider_unittest.cc
@@ -4,6 +4,8 @@
#include "gin/v8_isolate_memory_dump_provider.h"
+#include <memory>
+
#include "base/trace_event/process_memory_dump.h"
#include "gin/public/isolate_holder.h"
#include "gin/test/v8_test.h"
@@ -21,7 +23,7 @@ TEST_F(V8MemoryDumpProviderTest, DumpStatistics) {
v8::V8::SetFlagsFromString(track_objects_flag,
static_cast<int>(strlen(track_objects_flag)));
- scoped_ptr<base::trace_event::ProcessMemoryDump> process_memory_dump(
+ std::unique_ptr<base::trace_event::ProcessMemoryDump> process_memory_dump(
new base::trace_event::ProcessMemoryDump(nullptr));
base::trace_event::MemoryDumpArgs dump_args = {
base::trace_event::MemoryDumpLevelOfDetail::DETAILED};
diff --git a/chromium/gin/v8_platform.cc b/chromium/gin/v8_platform.cc
index 75129ef7101..556f7fc5f24 100644
--- a/chromium/gin/v8_platform.cc
+++ b/chromium/gin/v8_platform.cc
@@ -6,7 +6,9 @@
#include "base/bind.h"
#include "base/location.h"
+#include "base/sys_info.h"
#include "base/threading/worker_pool.h"
+#include "base/trace_event/trace_event.h"
#include "gin/per_isolate_data.h"
namespace gin {
@@ -24,6 +26,19 @@ V8Platform::V8Platform() {}
V8Platform::~V8Platform() {}
+size_t V8Platform::NumberOfAvailableBackgroundThreads() {
+ // WorkerPool will currently always create additional threads for posted
+ // background tasks, unless there are threads sitting idle (on posix).
+ // Indicate that V8 should create no more than the number of cores available,
+ // reserving one core for the main thread.
+ const size_t available_cores =
+ static_cast<size_t>(base::SysInfo::NumberOfProcessors());
+ if (available_cores > 1) {
+ return available_cores - 1;
+ }
+ return 1;
+}
+
void V8Platform::CallOnBackgroundThread(
v8::Task* task,
v8::Platform::ExpectedRuntime expected_runtime) {
@@ -74,6 +89,7 @@ const char* V8Platform::GetCategoryGroupName(
uint64_t V8Platform::AddTraceEvent(char phase,
const uint8_t* category_enabled_flag,
const char* name,
+ const char* scope,
uint64_t id,
uint64_t bind_id,
int32_t num_args,
@@ -83,8 +99,9 @@ uint64_t V8Platform::AddTraceEvent(char phase,
unsigned int flags) {
base::trace_event::TraceEventHandle handle =
TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_BIND_ID(
- phase, category_enabled_flag, name, id, bind_id, num_args, arg_names,
- arg_types, (const long long unsigned int*)arg_values, NULL, flags);
+ phase, category_enabled_flag, name, scope, id, bind_id, num_args,
+ arg_names, arg_types, (const long long unsigned int*)arg_values, NULL,
+ flags);
uint64_t result;
memcpy(&result, &handle, sizeof(result));
return result;
diff --git a/chromium/gin/wrappable.h b/chromium/gin/wrappable.h
index f253fd9566e..73c089a3061 100644
--- a/chromium/gin/wrappable.h
+++ b/chromium/gin/wrappable.h
@@ -8,7 +8,6 @@
#include <type_traits>
#include "base/macros.h"
-#include "base/template_util.h"
#include "gin/converter.h"
#include "gin/gin_export.h"
#include "gin/public/wrapper_info.h"
@@ -107,7 +106,7 @@ class Wrappable : public WrappableBase {
template <typename T>
struct Converter<T*,
typename std::enable_if<
- base::is_convertible<T*, WrappableBase*>::value>::type> {
+ std::is_convertible<T*, WrappableBase*>::value>::type> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate, T* val) {
return val->GetWrapper(isolate);
}