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

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: Address clang errors 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 "base/callback.h"
8 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
9 #include "base/macros.h" 10 #include "base/macros.h"
10 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
11 #include "base/strings/string16.h" 12 #include "base/strings/string16.h"
12 #include "base/task_runner.h" 13 #include "base/task_runner.h"
13 #include "base/threading/thread_checker.h" 14 #include "base/threading/thread_checker.h"
14 #include "components/metrics/metrics_provider.h" 15 #include "components/metrics/metrics_provider.h"
15 16
16 namespace browser_watcher { 17 namespace browser_watcher {
17 18
18 // Provides stability data captured by the Chrome Watcher, namely the browser 19 // Provides stability data captured by the Chrome Watcher, namely the browser
19 // process exit codes. 20 // process exit codes.
20 class WatcherMetricsProviderWin : public metrics::MetricsProvider { 21 class WatcherMetricsProviderWin : public metrics::MetricsProvider {
21 public: 22 public:
23 // A callback that provides product name, version number and channel name.
24 using GetExecutableDetailsCallback =
25 base::Callback<void(base::string16*, base::string16*, base::string16*)>;
26
22 static const char kBrowserExitCodeHistogramName[]; 27 static const char kBrowserExitCodeHistogramName[];
23 28
24 // Initializes the reporter. |io_task_runner| is used for collecting 29 // Initializes the reporter. |io_task_runner| is used for collecting
25 // postmortem reports and clearing leftover data in registry if metrics 30 // postmortem reports and clearing leftover data in registry if metrics
26 // reporting is disabled. 31 // reporting is disabled.
27 WatcherMetricsProviderWin(const base::string16& registry_path, 32 WatcherMetricsProviderWin(const base::string16& registry_path,
28 const base::FilePath& user_data_dir, 33 const base::FilePath& user_data_dir,
29 const base::FilePath& crash_dir, 34 const base::FilePath& crash_dir,
35 const GetExecutableDetailsCallback& exe_details_cb,
30 base::TaskRunner* io_task_runner); 36 base::TaskRunner* io_task_runner);
31 ~WatcherMetricsProviderWin() override; 37 ~WatcherMetricsProviderWin() override;
32 38
33 // metrics::MetricsProvider implementation. 39 // metrics::MetricsProvider implementation.
34 void OnRecordingEnabled() override; 40 void OnRecordingEnabled() override;
35 void OnRecordingDisabled() override; 41 void OnRecordingDisabled() override;
36 // Note: this function collects metrics, some of which are related to the 42 // 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 43 // previous run's version and some to the current version. Doing the correct
38 // attribution on upgrade is difficult, and currently ignored. Metrics 44 // attribution on upgrade is difficult, and currently ignored. Metrics
39 // clearing is one mechanism to avoid misattribution, but is not used in this 45 // clearing is one mechanism to avoid misattribution, but is not used in this
(...skipping 13 matching lines...) Expand all
53 private: 59 private:
54 // TODO(manzagop): avoid collecting reports for clean exits from the fast exit 60 // TODO(manzagop): avoid collecting reports for clean exits from the fast exit
55 // path. 61 // path.
56 void CollectPostmortemReportsOnBlockingPool(); 62 void CollectPostmortemReportsOnBlockingPool();
57 63
58 bool recording_enabled_; 64 bool recording_enabled_;
59 bool cleanup_scheduled_; 65 bool cleanup_scheduled_;
60 const base::string16 registry_path_; 66 const base::string16 registry_path_;
61 const base::FilePath user_data_dir_; 67 const base::FilePath user_data_dir_;
62 const base::FilePath crash_dir_; 68 const base::FilePath crash_dir_;
69 GetExecutableDetailsCallback exe_details_cb_;
63 scoped_refptr<base::TaskRunner> io_task_runner_; 70 scoped_refptr<base::TaskRunner> io_task_runner_;
64 base::WeakPtrFactory<WatcherMetricsProviderWin> weak_ptr_factory_; 71 base::WeakPtrFactory<WatcherMetricsProviderWin> weak_ptr_factory_;
65 72
66 DISALLOW_COPY_AND_ASSIGN(WatcherMetricsProviderWin); 73 DISALLOW_COPY_AND_ASSIGN(WatcherMetricsProviderWin);
67 }; 74 };
68 75
69 } // namespace browser_watcher 76 } // namespace browser_watcher
70 77
71 #endif // COMPONENTS_BROWSER_WATCHER_WATCHER_METRICS_PROVIDER_WIN_H_ 78 #endif // COMPONENTS_BROWSER_WATCHER_WATCHER_METRICS_PROVIDER_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698