1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
media / base / memory_dump_provider_proxy.cc [blame]
// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/base/memory_dump_provider_proxy.h"
#include <utility>
#include "base/task/sequenced_task_runner.h"
#include "base/trace_event/memory_dump_manager.h"
namespace media {
MemoryDumpProviderProxy::MemoryDumpProviderProxy(
const char* name,
scoped_refptr<base::SequencedTaskRunner> task_runner,
MemoryDumpCB dump_cb)
: dump_cb_(std::move(dump_cb)) {
base::trace_event::MemoryDumpManager::GetInstance()
->RegisterDumpProviderWithSequencedTaskRunner(
this, name, std::move(task_runner), MemoryDumpProvider::Options());
}
MemoryDumpProviderProxy::~MemoryDumpProviderProxy() {
base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider(
this);
}
bool MemoryDumpProviderProxy::OnMemoryDump(
const base::trace_event::MemoryDumpArgs& args,
base::trace_event::ProcessMemoryDump* pmd) {
dump_cb_.Run(args, pmd);
return true;
}
} // namespace media