summaryrefslogtreecommitdiff
path: root/chromium/gin
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-03-11 11:32:04 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-03-18 13:40:17 +0000
commit31ccca0778db85c159634478b4ec7997f6704860 (patch)
tree3d33fc3afd9d5ec95541e1bbe074a9cf8da12a0e /chromium/gin
parent248b70b82a40964d5594eb04feca0fa36716185d (diff)
downloadqtwebengine-chromium-31ccca0778db85c159634478b4ec7997f6704860.tar.gz
BASELINE: Update Chromium to 80.0.3987.136
Change-Id: I98e1649aafae85ba3a83e67af00bb27ef301db7b Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
Diffstat (limited to 'chromium/gin')
-rw-r--r--chromium/gin/BUILD.gn4
-rw-r--r--chromium/gin/array_buffer.cc2
-rw-r--r--chromium/gin/gin_features.cc4
-rw-r--r--chromium/gin/gin_features.h1
-rw-r--r--chromium/gin/isolate_holder.cc5
-rw-r--r--chromium/gin/public/isolate_holder.h5
-rw-r--r--chromium/gin/public/v8_platform.h6
-rw-r--r--chromium/gin/shell/gin_main.cc1
-rw-r--r--chromium/gin/shell_runner_unittest.cc1
-rw-r--r--chromium/gin/v8_initializer.cc82
-rw-r--r--chromium/gin/v8_initializer.h17
-rw-r--r--chromium/gin/v8_platform.cc19
-rw-r--r--chromium/gin/v8_shared_memory_dump_provider.cc56
-rw-r--r--chromium/gin/v8_shared_memory_dump_provider.h37
-rw-r--r--chromium/gin/v8_shared_memory_dump_provider_unittest.cc45
15 files changed, 169 insertions, 116 deletions
diff --git a/chromium/gin/BUILD.gn b/chromium/gin/BUILD.gn
index e6ff98edda3..e49ca6c2448 100644
--- a/chromium/gin/BUILD.gn
+++ b/chromium/gin/BUILD.gn
@@ -63,6 +63,8 @@ component("gin") {
"v8_isolate_memory_dump_provider.cc",
"v8_isolate_memory_dump_provider.h",
"v8_platform.cc",
+ "v8_shared_memory_dump_provider.cc",
+ "v8_shared_memory_dump_provider.h",
"wrappable.cc",
"wrappable.h",
"wrapper_info.cc",
@@ -70,7 +72,6 @@ component("gin") {
if (v8_use_external_startup_data) {
data = [
- "$root_out_dir/natives_blob.bin",
"$root_out_dir/snapshot_blob.bin",
]
}
@@ -139,6 +140,7 @@ test("gin_unittests") {
"test/run_all_unittests.cc",
"v8_isolate_memory_dump_provider_unittest.cc",
"v8_platform_unittest.cc",
+ "v8_shared_memory_dump_provider_unittest.cc",
"wrappable_unittest.cc",
]
diff --git a/chromium/gin/array_buffer.cc b/chromium/gin/array_buffer.cc
index a02797e94f6..b94a71ef856 100644
--- a/chromium/gin/array_buffer.cc
+++ b/chromium/gin/array_buffer.cc
@@ -146,7 +146,7 @@ void ArrayBuffer::Private::FirstWeakCallback(
void ArrayBuffer::Private::SecondWeakCallback(
const v8::WeakCallbackInfo<Private>& data) {
Private* parameter = data.GetParameter();
- parameter->self_reference_ = NULL;
+ parameter->self_reference_.reset();
}
// ArrayBuffer ----------------------------------------------------------------
diff --git a/chromium/gin/gin_features.cc b/chromium/gin/gin_features.cc
index 18fbecbb0e5..2acd379b5e5 100644
--- a/chromium/gin/gin_features.cc
+++ b/chromium/gin/gin_features.cc
@@ -34,4 +34,8 @@ const base::Feature kV8GCBackgroundSchedule{"V8GCBackgroundSchedule",
const base::Feature kV8GCLessCompaction{"V8GCLessCompaction",
base::FEATURE_DISABLED_BY_DEFAULT};
+// Always promote young objects in Mark-Compact GC.
+const base::Feature kV8GCAlwaysPromoteYoungMC{
+ "V8GCAlwaysPromoteYoungMC", base::FEATURE_DISABLED_BY_DEFAULT};
+
} // namespace features
diff --git a/chromium/gin/gin_features.h b/chromium/gin/gin_features.h
index 2d5652f7008..810b4a60784 100644
--- a/chromium/gin/gin_features.h
+++ b/chromium/gin/gin_features.h
@@ -17,6 +17,7 @@ GIN_EXPORT extern const base::Feature kV8MemoryReducerForSmallHeaps;
GIN_EXPORT extern const base::Feature kV8HugeMaxOldGenerationSize;
GIN_EXPORT extern const base::Feature kV8GCBackgroundSchedule;
GIN_EXPORT extern const base::Feature kV8GCLessCompaction;
+GIN_EXPORT extern const base::Feature kV8GCAlwaysPromoteYoungMC;
} // namespace features
diff --git a/chromium/gin/isolate_holder.cc b/chromium/gin/isolate_holder.cc
index 5f8aea7105a..ee74e6ea92c 100644
--- a/chromium/gin/isolate_holder.cc
+++ b/chromium/gin/isolate_holder.cc
@@ -22,6 +22,7 @@
#include "gin/per_isolate_data.h"
#include "gin/v8_initializer.h"
#include "gin/v8_isolate_memory_dump_provider.h"
+#include "gin/v8_shared_memory_dump_provider.h"
namespace gin {
@@ -84,6 +85,10 @@ IsolateHolder::IsolateHolder(
v8::Isolate::Initialize(isolate_, params);
}
+ // This will attempt register the shared memory dump provider for every
+ // IsolateHolder, but only the first registration will have any effect.
+ gin::V8SharedMemoryDumpProvider::Register();
+
isolate_memory_dump_provider_.reset(
new V8IsolateMemoryDumpProvider(this, task_runner));
}
diff --git a/chromium/gin/public/isolate_holder.h b/chromium/gin/public/isolate_holder.h
index 413e6c5bcc7..f23af2d9738 100644
--- a/chromium/gin/public/isolate_holder.h
+++ b/chromium/gin/public/isolate_holder.h
@@ -80,10 +80,7 @@ class GIN_EXPORT IsolateHolder {
// Should be invoked once before creating IsolateHolder instances to
// initialize V8 and Gin. In case V8_USE_EXTERNAL_STARTUP_DATA is
- // defined, V8's initial natives should be loaded (by calling
- // V8Initializer::LoadV8NativesFromFD or
- // V8Initializer::LoadV8Natives) before calling this method. If the
- // snapshot file is available, it should also be loaded (by calling
+ // defined and the snapshot file is available, it should be loaded (by calling
// V8Initializer::LoadV8SnapshotFromFD or
// V8Initializer::LoadV8Snapshot) before calling this method.
// If the snapshot file contains customised contexts which have static
diff --git a/chromium/gin/public/v8_platform.h b/chromium/gin/public/v8_platform.h
index 218ead54787..8a3d30358e4 100644
--- a/chromium/gin/public/v8_platform.h
+++ b/chromium/gin/public/v8_platform.h
@@ -34,12 +34,6 @@ class GIN_EXPORT V8Platform : public v8::Platform {
std::unique_ptr<v8::Task> task) override;
void CallDelayedOnWorkerThread(std::unique_ptr<v8::Task> task,
double delay_in_seconds) override;
- void CallOnForegroundThread(v8::Isolate* isolate, v8::Task* task) override;
- void CallDelayedOnForegroundThread(v8::Isolate* isolate,
- v8::Task* task,
- double delay_in_seconds) override;
- void CallIdleOnForegroundThread(v8::Isolate* isolate,
- v8::IdleTask* task) override;
bool IdleTasksEnabled(v8::Isolate* isolate) override;
double MonotonicallyIncreasingTime() override;
double CurrentClockTimeMillis() override;
diff --git a/chromium/gin/shell/gin_main.cc b/chromium/gin/shell/gin_main.cc
index a447d3b0388..1b9e5aa8425 100644
--- a/chromium/gin/shell/gin_main.cc
+++ b/chromium/gin/shell/gin_main.cc
@@ -71,7 +71,6 @@ int main(int argc, char** argv) {
base::i18n::InitializeICU();
#ifdef V8_USE_EXTERNAL_STARTUP_DATA
gin::V8Initializer::LoadV8Snapshot();
- gin::V8Initializer::LoadV8Natives();
#endif
base::SingleThreadTaskExecutor main_thread_task_executor;
diff --git a/chromium/gin/shell_runner_unittest.cc b/chromium/gin/shell_runner_unittest.cc
index c97015f61bf..b4c8e1894fb 100644
--- a/chromium/gin/shell_runner_unittest.cc
+++ b/chromium/gin/shell_runner_unittest.cc
@@ -30,7 +30,6 @@ TEST(RunnerTest, Run) {
#ifdef V8_USE_EXTERNAL_STARTUP_DATA
gin::V8Initializer::LoadV8Snapshot();
- gin::V8Initializer::LoadV8Natives();
#endif
gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode,
diff --git a/chromium/gin/v8_initializer.cc b/chromium/gin/v8_initializer.cc
index 5a028d946cb..9298a9c7554 100644
--- a/chromium/gin/v8_initializer.cc
+++ b/chromium/gin/v8_initializer.cc
@@ -39,8 +39,7 @@ namespace gin {
namespace {
-// None of these globals are ever freed nor closed.
-base::MemoryMappedFile* g_mapped_natives = nullptr;
+// This global is never freed nor closed.
base::MemoryMappedFile* g_mapped_snapshot = nullptr;
bool GenerateEntropy(unsigned char* buffer, size_t amount) {
@@ -61,8 +60,6 @@ void GetMappedFileData(base::MemoryMappedFile* mapped_file,
#if defined(V8_USE_EXTERNAL_STARTUP_DATA)
-const char kNativesFileName[] = "natives_blob.bin";
-
#if defined(OS_ANDROID)
const char kV8ContextSnapshotFileName64[] = "v8_context_snapshot_64.bin";
const char kV8ContextSnapshotFileName32[] = "v8_context_snapshot_32.bin";
@@ -100,9 +97,9 @@ void GetV8FilePath(const char* file_name, base::FilePath* path_out) {
*path_out =
base::FilePath(FILE_PATH_LITERAL("assets")).AppendASCII(file_name);
#elif defined(OS_MACOSX)
- base::ScopedCFTypeRef<CFStringRef> natives_file_name(
+ base::ScopedCFTypeRef<CFStringRef> bundle_resource(
base::SysUTF8ToCFStringRef(file_name));
- *path_out = base::mac::PathForFrameworkBundleResource(natives_file_name);
+ *path_out = base::mac::PathForFrameworkBundleResource(bundle_resource);
#else
base::FilePath data_path;
bool r = base::PathService::Get(base::DIR_ASSETS, &data_path);
@@ -166,17 +163,6 @@ base::File OpenV8File(const char* file_name,
}
} else if (file.error_details() != base::File::FILE_ERROR_IN_USE) {
result = OpenV8FileResult::FAILED_OTHER;
-#ifdef OS_WIN
- // TODO(oth): temporary diagnostics for http://crbug.com/479537
- std::string narrow(kNativesFileName);
- base::FilePath::StringType nativesBlob(narrow.begin(), narrow.end());
- if (path.BaseName().value() == nativesBlob) {
- base::File::Error file_error = file.error_details();
- base::debug::Alias(&file_error);
- LOG(FATAL) << "Failed to open V8 file '" << path.value()
- << "' (reason: " << file.error_details() << ")";
- }
-#endif // OS_WIN
break;
} else if (kMaxOpenAttempts - 1 != attempt) {
base::PlatformThread::Sleep(
@@ -260,16 +246,20 @@ void V8Initializer::Initialize(IsolateHolder::ScriptMode mode) {
sizeof(gc_experiment_less_compaction) - 1);
}
+ if (base::FeatureList::IsEnabled(features::kV8GCAlwaysPromoteYoungMC)) {
+ static const char gc_experiment_always_promote_young_mc[] =
+ "--always_promote_young_mc";
+ v8::V8::SetFlagsFromString(
+ gc_experiment_always_promote_young_mc,
+ sizeof(gc_experiment_always_promote_young_mc) - 1);
+ }
+
if (IsolateHolder::kStrictMode == mode) {
static const char use_strict[] = "--use_strict";
v8::V8::SetFlagsFromString(use_strict, sizeof(use_strict) - 1);
}
#if defined(V8_USE_EXTERNAL_STARTUP_DATA)
- // TODO(v8:7624): Remove natives and all remaining infrastructure.
- v8::StartupData natives;
- GetMappedFileData(g_mapped_natives, &natives);
-
if (g_mapped_snapshot) {
v8::StartupData snapshot;
GetMappedFileData(g_mapped_snapshot, &snapshot);
@@ -284,22 +274,15 @@ void V8Initializer::Initialize(IsolateHolder::ScriptMode mode) {
}
// static
-void V8Initializer::GetV8ExternalSnapshotData(v8::StartupData* natives,
- v8::StartupData* snapshot) {
- GetMappedFileData(g_mapped_natives, natives);
+void V8Initializer::GetV8ExternalSnapshotData(v8::StartupData* snapshot) {
GetMappedFileData(g_mapped_snapshot, snapshot);
}
// static
-void V8Initializer::GetV8ExternalSnapshotData(const char** natives_data_out,
- int* natives_size_out,
- const char** snapshot_data_out,
+void V8Initializer::GetV8ExternalSnapshotData(const char** snapshot_data_out,
int* snapshot_size_out) {
- v8::StartupData natives;
v8::StartupData snapshot;
- GetV8ExternalSnapshotData(&natives, &snapshot);
- *natives_data_out = natives.data;
- *natives_size_out = natives.raw_size;
+ GetV8ExternalSnapshotData(&snapshot);
*snapshot_data_out = snapshot.data;
*snapshot_size_out = snapshot.raw_size;
}
@@ -321,16 +304,6 @@ void V8Initializer::LoadV8Snapshot(V8SnapshotFileType snapshot_file_type) {
}
// static
-void V8Initializer::LoadV8Natives() {
- if (g_mapped_natives)
- return;
-
- base::MemoryMappedFile::Region file_region;
- base::File file = OpenV8File(kNativesFileName, &file_region);
- LoadV8NativesFromFile(std::move(file), &file_region);
-}
-
-// static
void V8Initializer::LoadV8SnapshotFromFile(
base::File snapshot_file,
base::MemoryMappedFile::Region* snapshot_file_region,
@@ -357,35 +330,8 @@ void V8Initializer::LoadV8SnapshotFromFile(
V8_LOAD_MAX_VALUE);
}
-// static
-void V8Initializer::LoadV8NativesFromFile(
- base::File natives_file,
- base::MemoryMappedFile::Region* natives_file_region) {
- if (g_mapped_natives)
- return;
-
- CHECK(natives_file.IsValid());
-
- base::MemoryMappedFile::Region region =
- base::MemoryMappedFile::Region::kWholeFile;
- if (natives_file_region) {
- region = *natives_file_region;
- }
-
- if (!MapV8File(std::move(natives_file), region, &g_mapped_natives)) {
- LOG(FATAL) << "Couldn't mmap v8 natives data file";
- }
-}
-
#if defined(OS_ANDROID)
// static
-base::FilePath V8Initializer::GetNativesFilePath() {
- base::FilePath path;
- GetV8FilePath(kNativesFileName, &path);
- return path;
-}
-
-// static
base::FilePath V8Initializer::GetSnapshotFilePath(
bool abi_32_bit,
V8SnapshotFileType snapshot_file_type) {
diff --git a/chromium/gin/v8_initializer.h b/chromium/gin/v8_initializer.h
index aa3863abe0e..2918c623568 100644
--- a/chromium/gin/v8_initializer.h
+++ b/chromium/gin/v8_initializer.h
@@ -25,11 +25,8 @@ class GIN_EXPORT V8Initializer {
// Get address and size information for currently loaded snapshot.
// If no snapshot is loaded, the return values are null for addresses
// and 0 for sizes.
- static void GetV8ExternalSnapshotData(v8::StartupData* natives,
- v8::StartupData* snapshot);
- static void GetV8ExternalSnapshotData(const char** natives_data_out,
- int* natives_size_out,
- const char** snapshot_data_out,
+ static void GetV8ExternalSnapshotData(v8::StartupData* snapshot);
+ static void GetV8ExternalSnapshotData(const char** snapshot_data_out,
int* snapshot_size_out);
#if defined(V8_USE_EXTERNAL_STARTUP_DATA)
@@ -45,9 +42,6 @@ class GIN_EXPORT V8Initializer {
// Load V8 snapshot from default resources, if they are available.
static void LoadV8Snapshot(
V8SnapshotFileType snapshot_file_type = V8SnapshotFileType::kDefault);
- // Load V8 natives source from default resources. Contains asserts
- // so that it will not return if natives cannot be loaded.
- static void LoadV8Natives();
// Load V8 snapshot from user provided file.
// The region argument, if non-zero, specifies the portions
@@ -57,15 +51,8 @@ class GIN_EXPORT V8Initializer {
base::File snapshot_file,
base::MemoryMappedFile::Region* snapshot_file_region,
V8SnapshotFileType snapshot_file_type);
- // Similar to LoadV8SnapshotFromFile, but for the source of the natives.
- // Without the natives we cannot continue, so this function contains
- // release mode asserts and won't return if it fails.
- static void LoadV8NativesFromFile(
- base::File natives_file,
- base::MemoryMappedFile::Region* natives_file_region);
#if defined(OS_ANDROID)
- static base::FilePath GetNativesFilePath();
static base::FilePath GetSnapshotFilePath(
bool abi_32_bit,
V8SnapshotFileType snapshot_file_type);
diff --git a/chromium/gin/v8_platform.cc b/chromium/gin/v8_platform.cc
index 4725b6812eb..cbd61e81090 100644
--- a/chromium/gin/v8_platform.cc
+++ b/chromium/gin/v8_platform.cc
@@ -440,25 +440,6 @@ void V8Platform::CallDelayedOnWorkerThread(std::unique_ptr<v8::Task> task,
base::TimeDelta::FromSecondsD(delay_in_seconds));
}
-void V8Platform::CallOnForegroundThread(v8::Isolate* isolate, v8::Task* task) {
- PerIsolateData* data = PerIsolateData::From(isolate);
- data->task_runner()->PostTask(std::unique_ptr<v8::Task>(task));
-}
-
-void V8Platform::CallDelayedOnForegroundThread(v8::Isolate* isolate,
- v8::Task* task,
- double delay_in_seconds) {
- PerIsolateData* data = PerIsolateData::From(isolate);
- data->task_runner()->PostDelayedTask(std::unique_ptr<v8::Task>(task),
- delay_in_seconds);
-}
-
-void V8Platform::CallIdleOnForegroundThread(v8::Isolate* isolate,
- v8::IdleTask* task) {
- PerIsolateData* data = PerIsolateData::From(isolate);
- data->task_runner()->PostIdleTask(std::unique_ptr<v8::IdleTask>(task));
-}
-
bool V8Platform::IdleTasksEnabled(v8::Isolate* isolate) {
return PerIsolateData::From(isolate)->task_runner()->IdleTasksEnabled();
}
diff --git a/chromium/gin/v8_shared_memory_dump_provider.cc b/chromium/gin/v8_shared_memory_dump_provider.cc
new file mode 100644
index 00000000000..580a88cfb08
--- /dev/null
+++ b/chromium/gin/v8_shared_memory_dump_provider.cc
@@ -0,0 +1,56 @@
+// Copyright 2019 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/v8_shared_memory_dump_provider.h"
+
+#include <string>
+
+#include "base/memory/singleton.h"
+#include "base/trace_event/memory_dump_manager.h"
+#include "base/trace_event/process_memory_dump.h"
+#include "v8/include/v8.h"
+
+namespace gin {
+
+V8SharedMemoryDumpProvider::V8SharedMemoryDumpProvider() {
+ base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
+ this, "V8SharedMemory", nullptr);
+}
+
+// static
+void V8SharedMemoryDumpProvider::Register() {
+ // The provider is registered as part of the constructor, so all this does is
+ // access the singleton causing it to be constructed on the first access.
+ base::Singleton<
+ V8SharedMemoryDumpProvider,
+ base::LeakySingletonTraits<V8SharedMemoryDumpProvider>>::get();
+}
+
+// Called at trace dump point time. Creates a snapshot with the memory counters
+// for the current isolate.
+bool V8SharedMemoryDumpProvider::OnMemoryDump(
+ const base::trace_event::MemoryDumpArgs& args,
+ base::trace_event::ProcessMemoryDump* process_memory_dump) {
+ v8::SharedMemoryStatistics shared_memory_statistics;
+ v8::V8::GetSharedMemoryStatistics(&shared_memory_statistics);
+
+ std::string dump_base_name = "v8/shared";
+ auto* shared_memory_dump = process_memory_dump->CreateAllocatorDump(
+ dump_base_name + "/read_only_space");
+ shared_memory_dump->AddScalar(
+ base::trace_event::MemoryAllocatorDump::kNameSize,
+ base::trace_event::MemoryAllocatorDump::kUnitsBytes,
+ shared_memory_statistics.read_only_space_physical_size());
+ shared_memory_dump->AddScalar(
+ "allocated_objects_size",
+ base::trace_event::MemoryAllocatorDump::kUnitsBytes,
+ shared_memory_statistics.read_only_space_used_size());
+ shared_memory_dump->AddScalar(
+ "virtual_size", base::trace_event::MemoryAllocatorDump::kUnitsBytes,
+ shared_memory_statistics.read_only_space_size());
+
+ return true;
+}
+
+} // namespace gin
diff --git a/chromium/gin/v8_shared_memory_dump_provider.h b/chromium/gin/v8_shared_memory_dump_provider.h
new file mode 100644
index 00000000000..da6eaaa979c
--- /dev/null
+++ b/chromium/gin/v8_shared_memory_dump_provider.h
@@ -0,0 +1,37 @@
+// Copyright 2019 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_V8_SHARED_MEMORY_DUMP_PROVIDER_H_
+#define GIN_V8_SHARED_MEMORY_DUMP_PROVIDER_H_
+
+#include <string>
+
+#include "base/macros.h"
+#include "base/trace_event/memory_dump_provider.h"
+#include "gin/gin_export.h"
+
+namespace gin {
+
+// Memory dump provider for the chrome://tracing infrastructure. It dumps
+// summarized memory stats about V8 Memory shared between Isolates in the same
+// process.
+class GIN_EXPORT V8SharedMemoryDumpProvider
+ : public base::trace_event::MemoryDumpProvider {
+ public:
+ V8SharedMemoryDumpProvider();
+
+ // MemoryDumpProvider implementation.
+ bool OnMemoryDump(
+ const base::trace_event::MemoryDumpArgs& args,
+ base::trace_event::ProcessMemoryDump* process_memory_dump) override;
+
+ static void Register();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(V8SharedMemoryDumpProvider);
+};
+
+} // namespace gin
+
+#endif // GIN_V8_SHARED_MEMORY_DUMP_PROVIDER_H_
diff --git a/chromium/gin/v8_shared_memory_dump_provider_unittest.cc b/chromium/gin/v8_shared_memory_dump_provider_unittest.cc
new file mode 100644
index 00000000000..df0ff7e73e0
--- /dev/null
+++ b/chromium/gin/v8_shared_memory_dump_provider_unittest.cc
@@ -0,0 +1,45 @@
+// Copyright 2019 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/v8_shared_memory_dump_provider.h"
+
+#include <memory>
+
+#include "base/trace_event/process_memory_dump.h"
+#include "base/trace_event/trace_event.h"
+#include "gin/test/v8_test.h"
+
+namespace gin {
+
+typedef V8Test V8SharedMemoryDumpProviderTest;
+
+// Checks if the dump provider runs without crashing and dumps root objects.
+TEST_F(V8SharedMemoryDumpProviderTest, DumpStatistics) {
+ V8SharedMemoryDumpProvider provider;
+
+ 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(dump_args));
+ provider.OnMemoryDump(dump_args, process_memory_dump.get());
+ const base::trace_event::ProcessMemoryDump::AllocatorDumpsMap&
+ allocator_dumps = process_memory_dump->allocator_dumps();
+
+ bool did_dump_shared_memory_stats = false;
+ bool did_dump_read_only_space = false;
+ for (const auto& name_dump : allocator_dumps) {
+ const std::string& name = name_dump.first;
+ if (name.find("v8/shared") != std::string::npos) {
+ did_dump_shared_memory_stats = true;
+ }
+ if (name.find("v8/shared/read_only_space") != std::string::npos) {
+ did_dump_read_only_space = true;
+ }
+ }
+
+ ASSERT_TRUE(did_dump_shared_memory_stats);
+ ASSERT_TRUE(did_dump_read_only_space);
+}
+
+} // namespace gin