| OLD | NEW |
| 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 #ifndef CHROME_BROWSER_METRICS_SUBPROCESS_METRICS_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_METRICS_SUBPROCESS_METRICS_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_METRICS_SUBPROCESS_METRICS_PROVIDER_H_ | 6 #define CHROME_BROWSER_METRICS_SUBPROCESS_METRICS_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| 11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
| 12 #include "base/id_map.h" | 12 #include "base/id_map.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/scoped_observer.h" | 14 #include "base/scoped_observer.h" |
| 15 #include "base/threading/thread_checker.h" | 15 #include "base/threading/thread_checker.h" |
| 16 #include "components/metrics/metrics_provider.h" | 16 #include "components/metrics/metrics_provider.h" |
| 17 #include "content/public/browser/browser_child_process_observer.h" | 17 #include "content/public/browser/browser_child_process_observer.h" |
| 18 #include "content/public/browser/notification_observer.h" | 18 #include "content/public/browser/notification_observer.h" |
| 19 #include "content/public/browser/notification_registrar.h" | 19 #include "content/public/browser/notification_registrar.h" |
| 20 #include "content/public/browser/render_process_host_observer.h" | 20 #include "content/public/browser/render_process_host_observer.h" |
| 21 | 21 |
| 22 namespace base { | 22 namespace base { |
| 23 class PersistentHistogramAllocator; | 23 class PersistentHistogramAllocator; |
| 24 class SharedPersistentMemoryAllocator; | |
| 25 } | 24 } |
| 26 | 25 |
| 27 // SubprocessMetricsProvider gathers and merges histograms stored in shared | 26 // SubprocessMetricsProvider gathers and merges histograms stored in shared |
| 28 // memory segments between processes. Merging occurs when a process exits, | 27 // memory segments between processes. Merging occurs when a process exits, |
| 29 // when metrics are being collected for upload, or when something else needs | 28 // when metrics are being collected for upload, or when something else needs |
| 30 // combined metrics (such as the chrome://histograms page). | 29 // combined metrics (such as the chrome://histograms page). |
| 31 class SubprocessMetricsProvider : public metrics::MetricsProvider, | 30 class SubprocessMetricsProvider : public metrics::MetricsProvider, |
| 32 public content::BrowserChildProcessObserver, | 31 public content::BrowserChildProcessObserver, |
| 33 public content::NotificationObserver, | 32 public content::NotificationObserver, |
| 34 public content::RenderProcessHostObserver { | 33 public content::RenderProcessHostObserver { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 // Track all observed render processes to un-observe them on exit. | 104 // Track all observed render processes to un-observe them on exit. |
| 106 ScopedObserver<content::RenderProcessHost, SubprocessMetricsProvider> | 105 ScopedObserver<content::RenderProcessHost, SubprocessMetricsProvider> |
| 107 scoped_observer_; | 106 scoped_observer_; |
| 108 | 107 |
| 109 base::WeakPtrFactory<SubprocessMetricsProvider> weak_ptr_factory_; | 108 base::WeakPtrFactory<SubprocessMetricsProvider> weak_ptr_factory_; |
| 110 | 109 |
| 111 DISALLOW_COPY_AND_ASSIGN(SubprocessMetricsProvider); | 110 DISALLOW_COPY_AND_ASSIGN(SubprocessMetricsProvider); |
| 112 }; | 111 }; |
| 113 | 112 |
| 114 #endif // CHROME_BROWSER_METRICS_SUBPROCESS_METRICS_PROVIDER_H_ | 113 #endif // CHROME_BROWSER_METRICS_SUBPROCESS_METRICS_PROVIDER_H_ |
| OLD | NEW |