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/components/heap_profiling | |
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/components/heap_profiling')
-rw-r--r-- | chromium/components/heap_profiling/supervisor.cc | 21 | ||||
-rw-r--r-- | chromium/components/heap_profiling/test_driver.cc | 41 |
2 files changed, 47 insertions, 15 deletions
diff --git a/chromium/components/heap_profiling/supervisor.cc b/chromium/components/heap_profiling/supervisor.cc index ed21ae9063f..64b1a9495db 100644 --- a/chromium/components/heap_profiling/supervisor.cc +++ b/chromium/components/heap_profiling/supervisor.cc @@ -151,16 +151,25 @@ void Supervisor::RequestTraceWithHeapDump(TraceFinishedCallback callback, }, std::move(callback)); - memory_instrumentation::MemoryInstrumentation::GetInstance() - ->RequestGlobalDumpAndAppendToTrace( - base::trace_event::MemoryDumpType::EXPLICITLY_TRIGGERED, - base::trace_event::MemoryDumpLevelOfDetail::BACKGROUND, - base::AdaptCallbackForRepeating(std::move(finished_dump_callback))); + auto trigger_memory_dump_callback = base::BindOnce( + [](base::OnceCallback<void(bool success, uint64_t dump_guid)> + finished_dump_callback) { + memory_instrumentation::MemoryInstrumentation::GetInstance() + ->RequestGlobalDumpAndAppendToTrace( + base::trace_event::MemoryDumpType::EXPLICITLY_TRIGGERED, + base::trace_event::MemoryDumpLevelOfDetail::BACKGROUND, + base::AdaptCallbackForRepeating( + std::move(finished_dump_callback))); + }, + std::move(finished_dump_callback)); // The only reason this should return false is if tracing is already enabled, // which we've already checked. + // Use AdaptCallbackForRepeating since the argument passed to StartTracing() + // is intended to be a OnceCallback, but the code has not yet been migrated. bool result = content::TracingController::GetInstance()->StartTracing( - GetBackgroundTracingConfig(anonymize), base::Closure()); + GetBackgroundTracingConfig(anonymize), + base::AdaptCallbackForRepeating(std::move(trigger_memory_dump_callback))); DCHECK(result); } diff --git a/chromium/components/heap_profiling/test_driver.cc b/chromium/components/heap_profiling/test_driver.cc index 7c841bc5fbf..cf978596747 100644 --- a/chromium/components/heap_profiling/test_driver.cc +++ b/chromium/components/heap_profiling/test_driver.cc @@ -8,9 +8,11 @@ #include "base/bind.h" #include "base/command_line.h" +#include "base/files/file_path.h" #include "base/json/json_reader.h" #include "base/process/process_handle.h" #include "base/run_loop.h" +#include "base/stl_util.h" #include "base/task_scheduler/post_task.h" #include "base/threading/platform_thread.h" #include "base/trace_event/heap_profiler_event_filter.h" @@ -76,8 +78,7 @@ bool RenderersAreBeingProfiled( base::kNullProcessHandle) continue; base::ProcessId pid = iter.GetCurrentValue()->GetProcess().Pid(); - if (std::find(profiled_pids.begin(), profiled_pids.end(), pid) != - profiled_pids.end()) { + if (base::ContainsValue(profiled_pids, pid)) { return true; } } @@ -518,17 +519,34 @@ bool ValidateProcessMmaps(base::Value* process_mmaps, bool should_have_contents) { base::Value* vm_regions = process_mmaps->FindKey("vm_regions"); size_t count = vm_regions->GetList().size(); - if (should_have_contents) { - if (count == 0) { - LOG(ERROR) << "vm_regions should have contents, but doesn't"; - return false; - } - } else { + if (!should_have_contents) { if (count != 0) { LOG(ERROR) << "vm_regions should be empty, but has contents"; return false; } + return true; + } + + if (count == 0) { + LOG(ERROR) << "vm_regions should have contents, but doesn't"; + return false; + } + + // File paths may contain PII. Make sure that "mf" entries only contain the + // basename, rather than a full path. + for (const base::Value& vm_region : vm_regions->GetList()) { + const base::Value* file_path_value = vm_region.FindKey("mf"); + if (file_path_value) { + std::string file_path = file_path_value->GetString(); + + base::FilePath::StringType path(file_path.begin(), file_path.end()); + if (base::FilePath(path).BaseName().AsUTF8Unsafe() != file_path) { + LOG(ERROR) << "vm_region should not contain file path: " << file_path; + return false; + } + } } + return true; } @@ -830,7 +848,7 @@ void TestDriver::CollectResults(bool synchronous) { Supervisor::GetInstance()->RequestTraceWithHeapDump( base::Bind(&TestDriver::TraceFinished, base::Unretained(this), std::move(finish_tracing_closure)), - false /* strip_path_from_mapped_files */); + /* anonymize= */ true); if (synchronous) run_loop->Run(); @@ -1029,6 +1047,11 @@ void TestDriver::WaitForProfilingToStartForAllRenderersUIThreadCallback( wait_for_ui_thread_.Signal(); return; } + + // Brief sleep to prevent spamming the task queue, since this code is called + // in a tight loop. + base::PlatformThread::Sleep(base::TimeDelta::FromMicroseconds(100)); + WaitForProfilingToStartForAllRenderersUIThreadAndSignal(); } |