Commit 2f27427c authored by Siddhartha's avatar Siddhartha Committed by Commit Bot

Fix download controller memory dump provider

GetOrCreate dump is only used when the provider is not certain if the
dump should be created. Multiple dumps should have unique IDs.

BUG=791205

Change-Id: I46dec025517fb22f0b62a12d7e3ae64c45aa333a
Reviewed-on: https://chromium-review.googlesource.com/892488
Commit-Queue: Siddhartha S <ssid@chromium.org>
Reviewed-by: default avatarDavid Trainor <dtrainor@chromium.org>
Cr-Commit-Position: refs/heads/master@{#533591}
parent 04e20c3f
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include "components/download/internal/background_service/controller_impl.h" #include "components/download/internal/background_service/controller_impl.h"
#include <inttypes.h>
#include <string> #include <string>
#include <vector> #include <vector>
...@@ -11,6 +13,7 @@ ...@@ -11,6 +13,7 @@
#include "base/callback_helpers.h" #include "base/callback_helpers.h"
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "base/optional.h" #include "base/optional.h"
#include "base/strings/stringprintf.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "base/trace_event/memory_allocator_dump.h" #include "base/trace_event/memory_allocator_dump.h"
#include "base/trace_event/memory_dump_manager.h" #include "base/trace_event/memory_dump_manager.h"
...@@ -597,7 +600,9 @@ base::Optional<LogSource::EntryDetails> ControllerImpl::GetServiceDownload( ...@@ -597,7 +600,9 @@ base::Optional<LogSource::EntryDetails> ControllerImpl::GetServiceDownload(
bool ControllerImpl::OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, bool ControllerImpl::OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
base::trace_event::ProcessMemoryDump* pmd) { base::trace_event::ProcessMemoryDump* pmd) {
auto* dump = pmd->GetOrCreateAllocatorDump("components/download"); auto* dump = pmd->CreateAllocatorDump(
base::StringPrintf("components/download/controller_0x%" PRIXPTR,
reinterpret_cast<uintptr_t>(this)));
size_t memory_cost = size_t memory_cost =
base::trace_event::EstimateMemoryUsage(externally_active_downloads_); base::trace_event::EstimateMemoryUsage(externally_active_downloads_);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment