Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(455)

Side by Side Diff: content/browser/tracing/background_memory_tracing_observer.cc

Issue 2769963005: Add EnabledStateObserver to BackgroundTracingManager (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/browser/tracing/background_memory_tracing_observer.h"
6
7 #include "base/trace_event/memory_dump_manager.h"
8
9 namespace content {
10
11 // static
12 BackgroundMemoryTracingObserver*
13 BackgroundMemoryTracingObserver::GetInstance() {
14 static auto* instance = new BackgroundMemoryTracingObserver;
oystein (OOO til 10th of July) 2017/03/28 20:11:18 Why isn't this a global base::LazyInstance? I don'
ssid 2017/03/28 21:02:03 I think thread safe statics are the new way to use
oystein (OOO til 10th of July) 2017/03/28 21:06:47 Ah good to know, missed that. Thanks!
15 return instance;
16 }
17
18 BackgroundMemoryTracingObserver::BackgroundMemoryTracingObserver() {}
19 BackgroundMemoryTracingObserver::~BackgroundMemoryTracingObserver() {}
20
21 void BackgroundMemoryTracingObserver::OnScenarioActivated(
22 const BackgroundTracingConfigImpl& config) {}
23
24 void BackgroundMemoryTracingObserver::OnTracingEnabled(
25 BackgroundTracingConfigImpl::CategoryPreset preset) {
26 if (preset ==
27 BackgroundTracingConfigImpl::CategoryPreset::BENCHMARK_MEMORY_LIGHT) {
28 auto* dump_manager = base::trace_event::MemoryDumpManager::GetInstance();
29 dump_manager->RequestGlobalDump(
30 base::trace_event::MemoryDumpType::EXPLICITLY_TRIGGERED,
31 base::trace_event::MemoryDumpLevelOfDetail::BACKGROUND);
32 }
33 }
34
35 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698