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 #include "components/browser_watcher/stability_debugging_win.h" | 5 #include "components/browser_watcher/stability_debugging_win.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/debug/activity_tracker.h" | |
9 #include "base/feature_list.h" | 10 #include "base/feature_list.h" |
10 #include "base/files/file.h" | 11 #include "base/files/file.h" |
11 #include "base/metrics/persistent_memory_allocator.h" | 12 #include "base/metrics/persistent_memory_allocator.h" |
12 #include "base/path_service.h" | 13 #include "base/path_service.h" |
13 #include "base/process/process.h" | 14 #include "base/process/process.h" |
14 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
15 #include "base/time/time.h" | 16 #include "base/time/time.h" |
16 #include "components/browser_watcher/features.h" | 17 #include "components/browser_watcher/features.h" |
17 | 18 |
18 namespace browser_watcher { | 19 namespace browser_watcher { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
78 } | 79 } |
79 | 80 |
80 // Open (with delete) and then immediately close the file by going out of | 81 // Open (with delete) and then immediately close the file by going out of |
81 // scope. This should cause the stability debugging file to be deleted prior | 82 // scope. This should cause the stability debugging file to be deleted prior |
82 // to the next execution. | 83 // to the next execution. |
83 base::File file(stability_file, base::File::FLAG_OPEN | | 84 base::File file(stability_file, base::File::FLAG_OPEN | |
84 base::File::FLAG_READ | | 85 base::File::FLAG_READ | |
85 base::File::FLAG_DELETE_ON_CLOSE); | 86 base::File::FLAG_DELETE_ON_CLOSE); |
86 } | 87 } |
87 | 88 |
89 void SetStabilityDataInt(base::StringPiece name, int64_t value) { | |
90 base::debug::GlobalActivityTracker* global_tracker = | |
91 base::debug::GlobalActivityTracker::Get(); | |
92 if (!global_tracker) | |
93 return; // Activity tracking isn't enabled. | |
94 base::debug::ActivityUserData& global_user_data = global_tracker->user_data(); | |
bcwhite
2016/12/01 16:35:20
Blank line above.
manzagop (departed)
2016/12/05 15:44:04
Done.
| |
95 global_user_data.SetInt(name, value); | |
bcwhite
2016/12/01 16:35:20
Skip assigning it to a variable and just call SetI
manzagop (departed)
2016/12/05 15:44:04
Done.
| |
96 } | |
97 | |
88 } // namespace browser_watcher | 98 } // namespace browser_watcher |
OLD | NEW |