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

Side by Side Diff: chrome/browser/metrics/subprocess_metrics_provider.cc

Issue 2658163002: Merge histograms from providers into StatisticsRecorder for display. (Closed)
Patch Set: rebased Created 3 years, 10 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/metrics/subprocess_metrics_provider.h" 5 #include "chrome/browser/metrics/subprocess_metrics_provider.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 12 matching lines...) Expand all
23 namespace { 23 namespace {
24 24
25 // This is used by tests that don't have an easy way to access the global 25 // This is used by tests that don't have an easy way to access the global
26 // instance of this class. 26 // instance of this class.
27 SubprocessMetricsProvider* g_subprocess_metrics_provider_for_testing; 27 SubprocessMetricsProvider* g_subprocess_metrics_provider_for_testing;
28 28
29 } // namespace 29 } // namespace
30 30
31 SubprocessMetricsProvider::SubprocessMetricsProvider() 31 SubprocessMetricsProvider::SubprocessMetricsProvider()
32 : scoped_observer_(this), weak_ptr_factory_(this) { 32 : scoped_observer_(this), weak_ptr_factory_(this) {
33 base::StatisticsRecorder::RegisterHistogramProvider(
34 weak_ptr_factory_.GetWeakPtr());
33 content::BrowserChildProcessObserver::Add(this); 35 content::BrowserChildProcessObserver::Add(this);
34 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CREATED, 36 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CREATED,
35 content::NotificationService::AllBrowserContextsAndSources()); 37 content::NotificationService::AllBrowserContextsAndSources());
36 g_subprocess_metrics_provider_for_testing = this; 38 g_subprocess_metrics_provider_for_testing = this;
37 } 39 }
38 40
39 SubprocessMetricsProvider::~SubprocessMetricsProvider() { 41 SubprocessMetricsProvider::~SubprocessMetricsProvider() {
40 // Safe even if this object has never been added as an observer. 42 // Safe even if this object has never been added as an observer.
41 content::BrowserChildProcessObserver::Remove(this); 43 content::BrowserChildProcessObserver::Remove(this);
42 g_subprocess_metrics_provider_for_testing = nullptr; 44 g_subprocess_metrics_provider_for_testing = nullptr;
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 return nullptr; 217 return nullptr;
216 218
217 std::unique_ptr<base::SharedPersistentMemoryAllocator> allocator = 219 std::unique_ptr<base::SharedPersistentMemoryAllocator> allocator =
218 host->TakeMetricsAllocator(); 220 host->TakeMetricsAllocator();
219 if (!allocator) 221 if (!allocator)
220 return nullptr; 222 return nullptr;
221 223
222 return base::MakeUnique<base::PersistentHistogramAllocator>( 224 return base::MakeUnique<base::PersistentHistogramAllocator>(
223 std::move(allocator)); 225 std::move(allocator));
224 } 226 }
OLDNEW
« no previous file with comments | « chrome/browser/metrics/subprocess_metrics_provider.h ('k') | components/metrics/file_metrics_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698