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

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

Issue 2715903003: Bound the impact of system instability on chrome instability. (Closed)
Patch Set: Don't inline complex destructors Created 3 years, 9 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 #include "components/browser_watcher/watcher_metrics_provider_win.h" 5 #include "components/browser_watcher/watcher_metrics_provider_win.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <memory> 10 #include <memory>
11 #include <set> 11 #include <set>
12 #include <utility>
12 #include <vector> 13 #include <vector>
13 14
14 #include "base/bind.h" 15 #include "base/bind.h"
15 #include "base/feature_list.h" 16 #include "base/feature_list.h"
16 #include "base/metrics/histogram.h" 17 #include "base/metrics/histogram.h"
17 #include "base/metrics/histogram_base.h" 18 #include "base/metrics/histogram_base.h"
18 #include "base/metrics/histogram_macros.h" 19 #include "base/metrics/histogram_macros.h"
19 #include "base/metrics/sparse_histogram.h" 20 #include "base/metrics/sparse_histogram.h"
20 #include "base/process/process.h" 21 #include "base/process/process.h"
21 #include "base/strings/string_number_conversions.h" 22 #include "base/strings/string_number_conversions.h"
22 #include "base/strings/string_piece.h" 23 #include "base/strings/string_piece.h"
23 #include "base/strings/utf_string_conversions.h" 24 #include "base/strings/utf_string_conversions.h"
24 #include "base/win/registry.h" 25 #include "base/win/registry.h"
25 #include "components/browser_watcher/features.h" 26 #include "components/browser_watcher/features.h"
26 #include "components/browser_watcher/postmortem_report_collector.h" 27 #include "components/browser_watcher/postmortem_report_collector.h"
27 #include "components/browser_watcher/stability_debugging.h" 28 #include "components/browser_watcher/stability_debugging.h"
29 #include "components/browser_watcher/system_session_analyzer_win.h"
28 #include "third_party/crashpad/crashpad/client/crash_report_database.h" 30 #include "third_party/crashpad/crashpad/client/crash_report_database.h"
29 31
30 namespace browser_watcher { 32 namespace browser_watcher {
31 33
32 namespace { 34 namespace {
33 35
34 // Process ID APIs on Windows talk in DWORDs, whereas for string formatting 36 // Process ID APIs on Windows talk in DWORDs, whereas for string formatting
35 // and parsing, this code uses int. In practice there are no process IDs with 37 // and parsing, this code uses int. In practice there are no process IDs with
36 // the high bit set on Windows, so there's no danger of overflow if this is 38 // the high bit set on Windows, so there's no danger of overflow if this is
37 // done consistently. 39 // done consistently.
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 std::unique_ptr<crashpad::CrashReportDatabase> crashpad_database = 258 std::unique_ptr<crashpad::CrashReportDatabase> crashpad_database =
257 crashpad::CrashReportDatabase::InitializeWithoutCreating(crash_dir_); 259 crashpad::CrashReportDatabase::InitializeWithoutCreating(crash_dir_);
258 if (!crashpad_database) { 260 if (!crashpad_database) {
259 LOG(ERROR) << "Failed to initialize a CrashPad database."; 261 LOG(ERROR) << "Failed to initialize a CrashPad database.";
260 LogCollectionInitStatus(CRASHPAD_DATABASE_INIT_FAILED); 262 LogCollectionInitStatus(CRASHPAD_DATABASE_INIT_FAILED);
261 return; 263 return;
262 } 264 }
263 265
264 LogCollectionInitStatus(INIT_SUCCESS); 266 LogCollectionInitStatus(INIT_SUCCESS);
265 267
266 // TODO(manzagop): fix incorrect version attribution on update. 268 // Get the reporter's version details.
267 base::string16 product_name, version_number, channel_name; 269 base::string16 product_name, version_number, channel_name;
268 exe_details_cb_.Run(&product_name, &version_number, &channel_name); 270 exe_details_cb_.Run(&product_name, &version_number, &channel_name);
269 PostmortemReportCollector collector(base::UTF16ToUTF8(product_name), 271
270 base::UTF16ToUTF8(version_number), 272 const size_t kSystemSessionsToInspect = 5U;
271 base::UTF16ToUTF8(channel_name)); 273 std::unique_ptr<SystemSessionEventFetcher> fetcher(
Sigurður Ásgeirsson 2017/03/01 15:09:27 why can't these be simple locals? why the allocati
manzagop (departed) 2017/03/01 21:07:45 No reason. Done.
274 new SystemSessionEventFetcher(kSystemSessionsToInspect));
275 std::unique_ptr<SystemSessionAnalyzer> analyzer(
276 new SystemSessionAnalyzer(std::move(fetcher)));
277
278 PostmortemReportCollector collector(
279 base::UTF16ToUTF8(product_name), base::UTF16ToUTF8(version_number),
280 base::UTF16ToUTF8(channel_name), std::move(analyzer));
272 collector.CollectAndSubmitForUpload(stability_dir, GetStabilityFilePattern(), 281 collector.CollectAndSubmitForUpload(stability_dir, GetStabilityFilePattern(),
273 excluded_debug_files, 282 excluded_debug_files,
274 crashpad_database.get()); 283 crashpad_database.get());
275 } 284 }
276 285
277 } // namespace browser_watcher 286 } // namespace browser_watcher
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698