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

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: Merge 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 using GetExecutableDetailsCallback =
grt (UTC plus 2) 2016/09/28 19:42:45 please provide sufficient documentation here for a
manzagop (departed) 2016/09/29 15:23:14 Done.
24 base::Callback<void(base::string16*, base::string16*, base::string16*)>;
25
22 static const char kBrowserExitCodeHistogramName[]; 26 static const char kBrowserExitCodeHistogramName[];
23 27
24 // Initializes the reporter. |io_task_runner| is used for collecting 28 // Initializes the reporter. |io_task_runner| is used for collecting
25 // postmortem reports and clearing leftover data in registry if metrics 29 // postmortem reports and clearing leftover data in registry if metrics
26 // reporting is disabled. 30 // reporting is disabled.
27 WatcherMetricsProviderWin(const base::string16& registry_path, 31 WatcherMetricsProviderWin(const base::string16& registry_path,
28 const base::FilePath& user_data_dir, 32 const base::FilePath& user_data_dir,
29 const base::FilePath& crash_dir, 33 const base::FilePath& crash_dir,
34 const GetExecutableDetailsCallback& exe_details_cb,
30 base::TaskRunner* io_task_runner); 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
(...skipping 14 matching lines...) Expand all
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_;
63 scoped_refptr<base::TaskRunner> io_task_runner_; 68 scoped_refptr<base::TaskRunner> io_task_runner_;
69 GetExecutableDetailsCallback exe_details_cb_;
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