diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-08-28 15:28:34 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-08-28 13:54:51 +0000 |
commit | 2a19c63448c84c1805fb1a585c3651318bb86ca7 (patch) | |
tree | eb17888e8531aa6ee5e85721bd553b832a7e5156 /chromium/gin | |
parent | b014812705fc80bff0a5c120dfcef88f349816dc (diff) | |
download | qtwebengine-chromium-2a19c63448c84c1805fb1a585c3651318bb86ca7.tar.gz |
BASELINE: Update Chromium to 69.0.3497.70
Change-Id: I2b7b56e4e7a8b26656930def0d4575dc32b900a0
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/gin')
-rw-r--r-- | chromium/gin/BUILD.gn | 31 | ||||
-rw-r--r-- | chromium/gin/isolate_holder.cc | 15 | ||||
-rw-r--r-- | chromium/gin/public/isolate_holder.h | 14 | ||||
-rw-r--r-- | chromium/gin/public/v8_idle_task_runner.h | 3 | ||||
-rw-r--r-- | chromium/gin/run_microtasks_observer.cc | 21 | ||||
-rw-r--r-- | chromium/gin/run_microtasks_observer.h | 30 | ||||
-rw-r--r-- | chromium/gin/v8_foreground_task_runner.cc | 2 | ||||
-rw-r--r-- | chromium/gin/v8_foreground_task_runner_with_locker.cc | 2 | ||||
-rw-r--r-- | chromium/gin/v8_isolate_memory_dump_provider_unittest.cc | 65 | ||||
-rw-r--r-- | chromium/gin/v8_platform_unittest.cc | 34 |
10 files changed, 95 insertions, 122 deletions
diff --git a/chromium/gin/BUILD.gn b/chromium/gin/BUILD.gn index 89fe7a5e5bb..c0b70402974 100644 --- a/chromium/gin/BUILD.gn +++ b/chromium/gin/BUILD.gn @@ -5,6 +5,7 @@ import("//build/buildflag_header.gni") import("//build/config/allocator.gni") import("//testing/test.gni") +import("//tools/v8_context_snapshot/v8_context_snapshot.gni") import("//v8/gni/v8.gni") component("gin") { @@ -46,8 +47,6 @@ component("gin") { "public/v8_idle_task_runner.h", "public/v8_platform.h", "public/wrapper_info.h", - "run_microtasks_observer.cc", - "run_microtasks_observer.h", "runner.cc", "runner.h", "shell_runner.cc", @@ -103,7 +102,6 @@ executable("gin_shell") { ":gin", "//base", "//base:i18n", - "//build/config:exe_and_shlib_deps", "//build/win:default_exe_manifest", "//v8", ] @@ -138,7 +136,6 @@ test("gin_unittests") { "data_object_builder_unittest.cc", "interceptor_unittest.cc", "per_context_data_unittest.cc", - "shell/gin_shell_unittest.cc", "shell_runner_unittest.cc", "test/run_all_unittests.cc", "v8_isolate_memory_dump_provider_unittest.cc", @@ -147,7 +144,6 @@ test("gin_unittests") { ] deps = [ - ":gin_shell", ":gin_test", "//base/test:test_support", "//testing/gmock", @@ -160,12 +156,25 @@ test("gin_unittests") { "//v8:external_startup_data", ] - data = [ - "shell/hello_world.js", - "../OWNERS", - ] - data_deps = [ - ":gin_shell", + "//tools/v8_context_snapshot:v8_context_snapshot", ] + data = [] + + # gin_shell is not an Android app. + if (!is_android) { + sources += [ "shell/gin_shell_unittest.cc" ] + deps += [ ":gin_shell" ] + data_deps += [ ":gin_shell" ] + data += [ "shell/hello_world.js" ] + } + + # On Android, the APK must bundle the startup data. + if (is_android) { + if (use_v8_context_snapshot) { + deps += [ "//tools/v8_context_snapshot:v8_context_snapshot_assets" ] + } else { + deps += [ "//v8:v8_external_startup_data_assets" ] + } + } } diff --git a/chromium/gin/isolate_holder.cc b/chromium/gin/isolate_holder.cc index 076d137eb7c..e3a23cf30e4 100644 --- a/chromium/gin/isolate_holder.cc +++ b/chromium/gin/isolate_holder.cc @@ -20,7 +20,6 @@ #include "gin/debug_impl.h" #include "gin/function_template.h" #include "gin/per_isolate_data.h" -#include "gin/run_microtasks_observer.h" #include "gin/v8_initializer.h" #include "gin/v8_isolate_memory_dump_provider.h" @@ -96,8 +95,6 @@ IsolateHolder::IsolateHolder( } IsolateHolder::~IsolateHolder() { - if (task_observer_.get()) - base::MessageLoopCurrent::Get()->RemoveTaskObserver(task_observer_.get()); #if defined(OS_WIN) { void* code_range; @@ -126,18 +123,6 @@ void IsolateHolder::Initialize(ScriptMode mode, g_reference_table = reference_table; } -void IsolateHolder::AddRunMicrotasksObserver() { - DCHECK(!task_observer_.get()); - task_observer_.reset(new RunMicrotasksObserver(isolate_)); - base::MessageLoopCurrent::Get()->AddTaskObserver(task_observer_.get()); -} - -void IsolateHolder::RemoveRunMicrotasksObserver() { - DCHECK(task_observer_.get()); - base::MessageLoopCurrent::Get()->RemoveTaskObserver(task_observer_.get()); - task_observer_.reset(); -} - void IsolateHolder::EnableIdleTasks( std::unique_ptr<V8IdleTaskRunner> idle_task_runner) { DCHECK(isolate_data_.get()); diff --git a/chromium/gin/public/isolate_holder.h b/chromium/gin/public/isolate_holder.h index 2509aca609f..a70ad1ce51a 100644 --- a/chromium/gin/public/isolate_holder.h +++ b/chromium/gin/public/isolate_holder.h @@ -20,7 +20,6 @@ class SingleThreadTaskRunner; namespace gin { class PerIsolateData; -class RunMicrotasksObserver; class V8IsolateMemoryDumpProvider; // To embed Gin, first initialize gin using IsolateHolder::Initialize and then @@ -88,18 +87,6 @@ class GIN_EXPORT IsolateHolder { v8::Isolate* isolate() { return isolate_; } - // The implementations of Object.observe() and Promise enqueue v8 Microtasks - // that should be executed just before control is returned to the message - // loop. This method adds a MessageLoop TaskObserver which runs any pending - // Microtasks each time a Task is completed. This method should be called - // once, when a MessageLoop is created and it should be called on the - // MessageLoop's thread. - void AddRunMicrotasksObserver(); - - // This method should also only be called once, and on the MessageLoop's - // thread. - void RemoveRunMicrotasksObserver(); - // This method returns if v8::Locker is needed to access isolate. AccessMode access_mode() const { return access_mode_; } @@ -122,7 +109,6 @@ class GIN_EXPORT IsolateHolder { std::unique_ptr<v8::SnapshotCreator> snapshot_creator_; v8::Isolate* isolate_; std::unique_ptr<PerIsolateData> isolate_data_; - std::unique_ptr<RunMicrotasksObserver> task_observer_; std::unique_ptr<V8IsolateMemoryDumpProvider> isolate_memory_dump_provider_; AccessMode access_mode_; diff --git a/chromium/gin/public/v8_idle_task_runner.h b/chromium/gin/public/v8_idle_task_runner.h index a294166f9bc..3ace29298d4 100644 --- a/chromium/gin/public/v8_idle_task_runner.h +++ b/chromium/gin/public/v8_idle_task_runner.h @@ -5,6 +5,7 @@ #ifndef GIN_PUBLIC_V8_IDLE_TASK_RUNNER_H_ #define GIN_PUBLIC_V8_IDLE_TASK_RUNNER_H_ +#include <memory> #include "v8/include/v8-platform.h" namespace gin { @@ -15,7 +16,7 @@ namespace gin { // The idle task is expected to complete by this deadline. class GIN_EXPORT V8IdleTaskRunner { public: - virtual void PostIdleTask(v8::IdleTask* task) = 0; + virtual void PostIdleTask(std::unique_ptr<v8::IdleTask> task) = 0; virtual ~V8IdleTaskRunner() {} }; diff --git a/chromium/gin/run_microtasks_observer.cc b/chromium/gin/run_microtasks_observer.cc deleted file mode 100644 index 0ca00787050..00000000000 --- a/chromium/gin/run_microtasks_observer.cc +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2014 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/run_microtasks_observer.h" - -namespace gin { - -RunMicrotasksObserver::RunMicrotasksObserver(v8::Isolate* isolate) - : isolate_(isolate) { -} - -void RunMicrotasksObserver::WillProcessTask(const base::PendingTask& task) { -} - -void RunMicrotasksObserver::DidProcessTask(const base::PendingTask& task) { - v8::Isolate::Scope scope(isolate_); - v8::MicrotasksScope::PerformCheckpoint(isolate_); -} - -} // namespace gin diff --git a/chromium/gin/run_microtasks_observer.h b/chromium/gin/run_microtasks_observer.h deleted file mode 100644 index ca160bed609..00000000000 --- a/chromium/gin/run_microtasks_observer.h +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2014 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. - -#ifndef GIN_RUN_MICROTASKS_OBSERVER_H_ -#define GIN_RUN_MICROTASKS_OBSERVER_H_ - -#include "base/message_loop/message_loop.h" -#include "v8/include/v8.h" - -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) v8::MicrotasksPolicy::kAuto method. - -class RunMicrotasksObserver : public base::MessageLoop::TaskObserver { - public: - RunMicrotasksObserver(v8::Isolate* isolate); - - void WillProcessTask(const base::PendingTask& pending_task) override; - void DidProcessTask(const base::PendingTask& pending_task) override; - - private: - v8::Isolate* isolate_; -}; - -} // namespace gin - -#endif // GIN_RUN_MICROTASKS_OBSERVER_H_ diff --git a/chromium/gin/v8_foreground_task_runner.cc b/chromium/gin/v8_foreground_task_runner.cc index 9adb5032d53..d53085cc567 100644 --- a/chromium/gin/v8_foreground_task_runner.cc +++ b/chromium/gin/v8_foreground_task_runner.cc @@ -33,7 +33,7 @@ void V8ForegroundTaskRunner::PostDelayedTask(std::unique_ptr<v8::Task> task, void V8ForegroundTaskRunner::PostIdleTask(std::unique_ptr<v8::IdleTask> task) { DCHECK(IdleTasksEnabled()); - idle_task_runner()->PostIdleTask(task.release()); + idle_task_runner()->PostIdleTask(std::move(task)); } } // namespace gin diff --git a/chromium/gin/v8_foreground_task_runner_with_locker.cc b/chromium/gin/v8_foreground_task_runner_with_locker.cc index 13aead5e0b4..032cf906e99 100644 --- a/chromium/gin/v8_foreground_task_runner_with_locker.cc +++ b/chromium/gin/v8_foreground_task_runner_with_locker.cc @@ -71,7 +71,7 @@ void V8ForegroundTaskRunnerWithLocker::PostIdleTask( std::unique_ptr<v8::IdleTask> task) { DCHECK(IdleTasksEnabled()); idle_task_runner()->PostIdleTask( - new IdleTaskWithLocker(isolate_, std::move(task))); + std::make_unique<IdleTaskWithLocker>(isolate_, std::move(task))); } } // namespace gin diff --git a/chromium/gin/v8_isolate_memory_dump_provider_unittest.cc b/chromium/gin/v8_isolate_memory_dump_provider_unittest.cc index a2ed23c18b6..db9d1ebea26 100644 --- a/chromium/gin/v8_isolate_memory_dump_provider_unittest.cc +++ b/chromium/gin/v8_isolate_memory_dump_provider_unittest.cc @@ -7,6 +7,7 @@ #include <memory> #include "base/trace_event/process_memory_dump.h" +#include "base/trace_event/trace_event.h" #include "gin/public/isolate_holder.h" #include "gin/test/v8_test.h" @@ -26,7 +27,7 @@ TEST_F(V8MemoryDumpProviderTest, DumpStatistics) { base::trace_event::MemoryDumpArgs dump_args = { base::trace_event::MemoryDumpLevelOfDetail::DETAILED}; std::unique_ptr<base::trace_event::ProcessMemoryDump> process_memory_dump( - new base::trace_event::ProcessMemoryDump(nullptr, dump_args)); + new base::trace_event::ProcessMemoryDump(dump_args)); instance_->isolate_memory_dump_provider_for_testing()->OnMemoryDump( dump_args, process_memory_dump.get()); const base::trace_event::ProcessMemoryDump::AllocatorDumpsMap& @@ -35,14 +36,14 @@ TEST_F(V8MemoryDumpProviderTest, DumpStatistics) { bool did_dump_isolate_stats = false; bool did_dump_space_stats = false; bool did_dump_objects_stats = false; - for (const auto& it : allocator_dumps) { - const std::string& dump_name = it.first; - if (dump_name.find("v8/isolate") != std::string::npos) { + for (const auto& name_dump : allocator_dumps) { + const std::string& name = name_dump.first; + if (name.find("v8/isolate") != std::string::npos) { did_dump_isolate_stats = true; } - if (dump_name.find("heap_spaces") != std::string::npos) { + if (name.find("heap_spaces") != std::string::npos) { did_dump_space_stats = true; - } else if (dump_name.find("heap_objects") != std::string::npos) { + } else if (name.find("heap_objects") != std::string::npos) { did_dump_objects_stats = true; } } @@ -56,7 +57,7 @@ TEST_F(V8MemoryDumpProviderTest, DumpContextStatistics) { base::trace_event::MemoryDumpArgs dump_args = { base::trace_event::MemoryDumpLevelOfDetail::LIGHT}; std::unique_ptr<base::trace_event::ProcessMemoryDump> process_memory_dump( - new base::trace_event::ProcessMemoryDump(nullptr, dump_args)); + new base::trace_event::ProcessMemoryDump(dump_args)); instance_->isolate_memory_dump_provider_for_testing()->OnMemoryDump( dump_args, process_memory_dump.get()); const base::trace_event::ProcessMemoryDump::AllocatorDumpsMap& @@ -64,12 +65,12 @@ TEST_F(V8MemoryDumpProviderTest, DumpContextStatistics) { bool did_dump_detached_contexts = false; bool did_dump_native_contexts = false; - for (const auto& it : allocator_dumps) { - const std::string& dump_name = it.first; - if (dump_name.find("contexts/detached_context") != std::string::npos) { + for (const auto& name_dump : allocator_dumps) { + const std::string& name = name_dump.first; + if (name.find("contexts/detached_context") != std::string::npos) { did_dump_detached_contexts = true; } - if (dump_name.find("contexts/native_context") != std::string::npos) { + if (name.find("contexts/native_context") != std::string::npos) { did_dump_native_contexts = true; } } @@ -78,4 +79,46 @@ TEST_F(V8MemoryDumpProviderTest, DumpContextStatistics) { ASSERT_TRUE(did_dump_native_contexts); } +TEST_F(V8MemoryDumpProviderTest, DumpCodeStatistics) { + // Code stats are disabled unless this category is enabled. + base::trace_event::TraceLog::GetInstance()->SetEnabled( + base::trace_event::TraceConfig( + TRACE_DISABLED_BY_DEFAULT("memory-infra.v8.code_stats"), ""), + base::trace_event::TraceLog::RECORDING_MODE); + + base::trace_event::MemoryDumpArgs dump_args = { + base::trace_event::MemoryDumpLevelOfDetail::LIGHT}; + std::unique_ptr<base::trace_event::ProcessMemoryDump> process_memory_dump( + new base::trace_event::ProcessMemoryDump(dump_args)); + instance_->isolate_memory_dump_provider_for_testing()->OnMemoryDump( + dump_args, process_memory_dump.get()); + const base::trace_event::ProcessMemoryDump::AllocatorDumpsMap& + allocator_dumps = process_memory_dump->allocator_dumps(); + + bool did_dump_bytecode_size = false; + bool did_dump_code_size = false; + bool did_dump_external_scripts_size = false; + + for (const auto& name_dump : allocator_dumps) { + const std::string& name = name_dump.first; + if (name.find("heap_spaces") != std::string::npos) { + for (const base::trace_event::MemoryAllocatorDump::Entry& entry : + name_dump.second->entries()) { + if (entry.name == "bytecode_and_metadata_size") { + did_dump_bytecode_size = true; + } else if (entry.name == "code_and_metadata_size") { + did_dump_code_size = true; + } else if (entry.name == "external_script_source_size") { + did_dump_external_scripts_size = true; + } + } + } + } + base::trace_event::TraceLog::GetInstance()->SetDisabled(); + + ASSERT_TRUE(did_dump_bytecode_size); + ASSERT_TRUE(did_dump_code_size); + ASSERT_TRUE(did_dump_external_scripts_size); +} + } // namespace gin diff --git a/chromium/gin/v8_platform_unittest.cc b/chromium/gin/v8_platform_unittest.cc index fe12bac2870..5409e89f642 100644 --- a/chromium/gin/v8_platform_unittest.cc +++ b/chromium/gin/v8_platform_unittest.cc @@ -23,43 +23,43 @@ class TestTraceStateObserver namespace gin { TEST(V8PlatformTest, TraceStateObserverAPI) { - TestTraceStateObserver* test_observer = new TestTraceStateObserver(); - ASSERT_EQ(0, test_observer->Enabled()); - ASSERT_EQ(0, test_observer->Disabled()); + TestTraceStateObserver test_observer; + ASSERT_EQ(0, test_observer.Enabled()); + ASSERT_EQ(0, test_observer.Disabled()); V8Platform::Get()->GetTracingController()->AddTraceStateObserver( - test_observer); + &test_observer); base::trace_event::TraceLog::GetInstance()->SetEnabled( base::trace_event::TraceConfig("*", ""), base::trace_event::TraceLog::RECORDING_MODE); - ASSERT_EQ(1, test_observer->Enabled()); - ASSERT_EQ(0, test_observer->Disabled()); + ASSERT_EQ(1, test_observer.Enabled()); + ASSERT_EQ(0, test_observer.Disabled()); base::trace_event::TraceLog::GetInstance()->SetDisabled(); - ASSERT_EQ(1, test_observer->Enabled()); - ASSERT_EQ(1, test_observer->Disabled()); + ASSERT_EQ(1, test_observer.Enabled()); + ASSERT_EQ(1, test_observer.Disabled()); V8Platform::Get()->GetTracingController()->RemoveTraceStateObserver( - test_observer); + &test_observer); base::trace_event::TraceLog::GetInstance()->SetEnabled( base::trace_event::TraceConfig("*", ""), base::trace_event::TraceLog::RECORDING_MODE); base::trace_event::TraceLog::GetInstance()->SetDisabled(); - ASSERT_EQ(1, test_observer->Enabled()); - ASSERT_EQ(1, test_observer->Disabled()); + ASSERT_EQ(1, test_observer.Enabled()); + ASSERT_EQ(1, test_observer.Disabled()); } TEST(V8PlatformTest, TraceStateObserverFired) { - TestTraceStateObserver* test_observer = new TestTraceStateObserver(); - ASSERT_EQ(0, test_observer->Enabled()); - ASSERT_EQ(0, test_observer->Disabled()); + TestTraceStateObserver test_observer; + ASSERT_EQ(0, test_observer.Enabled()); + ASSERT_EQ(0, test_observer.Disabled()); base::trace_event::TraceLog::GetInstance()->SetEnabled( base::trace_event::TraceConfig("*", ""), base::trace_event::TraceLog::RECORDING_MODE); V8Platform::Get()->GetTracingController()->AddTraceStateObserver( - test_observer); - ASSERT_EQ(1, test_observer->Enabled()); - ASSERT_EQ(0, test_observer->Disabled()); + &test_observer); + ASSERT_EQ(1, test_observer.Enabled()); + ASSERT_EQ(0, test_observer.Disabled()); } } // namespace gin |