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

Side by Side Diff: components/browser_watcher/watcher_metrics_provider_win.h

Issue 2372633002: Use the correct product/version for postmortem reports (Closed)
Patch Set: Direct access to GetExecutableVersionDetails via ChromePostmortemReportCollector Created 4 years, 2 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 (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 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 COMPONENTS_BROWSER_WATCHER_WATCHER_METRICS_PROVIDER_WIN_H_ 5 #ifndef COMPONENTS_BROWSER_WATCHER_WATCHER_METRICS_PROVIDER_WIN_H_
6 #define COMPONENTS_BROWSER_WATCHER_WATCHER_METRICS_PROVIDER_WIN_H_ 6 #define COMPONENTS_BROWSER_WATCHER_WATCHER_METRICS_PROVIDER_WIN_H_
7 7
8 #include <memory>
9
8 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
9 #include "base/macros.h" 11 #include "base/macros.h"
10 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
11 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
12 #include "base/task_runner.h" 14 #include "base/task_runner.h"
13 #include "base/threading/thread_checker.h" 15 #include "base/threading/thread_checker.h"
16 #include "components/browser_watcher/postmortem_report_collector.h"
14 #include "components/metrics/metrics_provider.h" 17 #include "components/metrics/metrics_provider.h"
15 18
16 namespace browser_watcher { 19 namespace browser_watcher {
17 20
18 // Provides stability data captured by the Chrome Watcher, namely the browser 21 // Provides stability data captured by the Chrome Watcher, namely the browser
19 // process exit codes. 22 // process exit codes.
20 class WatcherMetricsProviderWin : public metrics::MetricsProvider { 23 class WatcherMetricsProviderWin : public metrics::MetricsProvider {
21 public: 24 public:
22 static const char kBrowserExitCodeHistogramName[]; 25 static const char kBrowserExitCodeHistogramName[];
23 26
24 // Initializes the reporter. |io_task_runner| is used for collecting 27 // Initializes the reporter. |io_task_runner| is used for collecting
25 // postmortem reports and clearing leftover data in registry if metrics 28 // postmortem reports and clearing leftover data in registry if metrics
26 // reporting is disabled. 29 // reporting is disabled.
27 WatcherMetricsProviderWin(const base::string16& registry_path, 30 WatcherMetricsProviderWin(
28 const base::FilePath& user_data_dir, 31 const base::string16& registry_path,
29 const base::FilePath& crash_dir, 32 const base::FilePath& user_data_dir,
30 base::TaskRunner* io_task_runner); 33 const base::FilePath& crash_dir,
34 std::unique_ptr<PostmortemReportCollector> collector,
35 base::TaskRunner* io_task_runner);
31 ~WatcherMetricsProviderWin() override; 36 ~WatcherMetricsProviderWin() override;
32 37
33 // metrics::MetricsProvider implementation. 38 // metrics::MetricsProvider implementation.
34 void OnRecordingEnabled() override; 39 void OnRecordingEnabled() override;
35 void OnRecordingDisabled() override; 40 void OnRecordingDisabled() override;
36 // Note: this function collects metrics, some of which are related to the 41 // Note: this function collects metrics, some of which are related to the
37 // previous run's version and some to the current version. Doing the correct 42 // previous run's version and some to the current version. Doing the correct
38 // attribution on upgrade is difficult, and currently ignored. Metrics 43 // attribution on upgrade is difficult, and currently ignored. Metrics
39 // clearing is one mechanism to avoid misattribution, but is not used in this 44 // clearing is one mechanism to avoid misattribution, but is not used in this
40 // case (ClearSavedStabilityMetrics is not overridden) as version 45 // case (ClearSavedStabilityMetrics is not overridden) as version
(...skipping 12 matching lines...) Expand all
53 private: 58 private:
54 // TODO(manzagop): avoid collecting reports for clean exits from the fast exit 59 // TODO(manzagop): avoid collecting reports for clean exits from the fast exit
55 // path. 60 // path.
56 void CollectPostmortemReportsOnBlockingPool(); 61 void CollectPostmortemReportsOnBlockingPool();
57 62
58 bool recording_enabled_; 63 bool recording_enabled_;
59 bool cleanup_scheduled_; 64 bool cleanup_scheduled_;
60 const base::string16 registry_path_; 65 const base::string16 registry_path_;
61 const base::FilePath user_data_dir_; 66 const base::FilePath user_data_dir_;
62 const base::FilePath crash_dir_; 67 const base::FilePath crash_dir_;
68 std::unique_ptr<PostmortemReportCollector> collector_;
63 scoped_refptr<base::TaskRunner> io_task_runner_; 69 scoped_refptr<base::TaskRunner> io_task_runner_;
64 base::WeakPtrFactory<WatcherMetricsProviderWin> weak_ptr_factory_; 70 base::WeakPtrFactory<WatcherMetricsProviderWin> weak_ptr_factory_;
65 71
66 DISALLOW_COPY_AND_ASSIGN(WatcherMetricsProviderWin); 72 DISALLOW_COPY_AND_ASSIGN(WatcherMetricsProviderWin);
67 }; 73 };
68 74
69 } // namespace browser_watcher 75 } // namespace browser_watcher
70 76
71 #endif // COMPONENTS_BROWSER_WATCHER_WATCHER_METRICS_PROVIDER_WIN_H_ 77 #endif // COMPONENTS_BROWSER_WATCHER_WATCHER_METRICS_PROVIDER_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698