Chromium Code Reviews| Index: components/browser_watcher/stability_debugging.cc |
| diff --git a/components/browser_watcher/stability_debugging_win.cc b/components/browser_watcher/stability_debugging.cc |
| similarity index 85% |
| rename from components/browser_watcher/stability_debugging_win.cc |
| rename to components/browser_watcher/stability_debugging.cc |
| index 3eb4e47b2affb3eac0e7f5a1995dcb4781810dbe..4341ffe7d3f6cc1eae8357edb4ea324c060a3938 100644 |
| --- a/components/browser_watcher/stability_debugging_win.cc |
| +++ b/components/browser_watcher/stability_debugging.cc |
| @@ -2,10 +2,11 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#include "components/browser_watcher/stability_debugging_win.h" |
| +#include "components/browser_watcher/stability_debugging.h" |
| #include <string> |
| +#include "base/debug/activity_tracker.h" |
| #include "base/feature_list.h" |
| #include "base/files/file.h" |
| #include "base/metrics/persistent_memory_allocator.h" |
| @@ -19,6 +20,7 @@ namespace browser_watcher { |
| namespace { |
| +#if defined(OS_WIN) |
| bool GetCreationTime(const base::Process& process, base::Time* time) { |
|
bcwhite
2016/12/05 17:20:57
Are these really windows-only?
manzagop (departed)
2016/12/06 20:35:08
The current implementation is, because it relies o
|
| DCHECK(time); |
| @@ -33,9 +35,12 @@ bool GetCreationTime(const base::Process& process, base::Time* time) { |
| *time = base::Time::FromFileTime(creation_time); |
| return true; |
| } |
| +#endif // defined(OS_WIN) |
| } // namespace |
| +#if defined(OS_WIN) |
| + |
| base::FilePath GetStabilityDir(const base::FilePath& user_data_dir) { |
| return user_data_dir.AppendASCII("Stability"); |
| } |
| @@ -84,5 +89,15 @@ void MarkStabilityFileForDeletion(const base::FilePath& user_data_dir) { |
| base::File::FLAG_READ | |
| base::File::FLAG_DELETE_ON_CLOSE); |
| } |
| +#endif // defined(OS_WIN) |
| + |
| +void SetStabilityDataInt(base::StringPiece name, int64_t value) { |
| + base::debug::GlobalActivityTracker* global_tracker = |
| + base::debug::GlobalActivityTracker::Get(); |
| + if (!global_tracker) |
| + return; // Activity tracking isn't enabled. |
| + |
| + global_tracker->user_data().SetInt(name, value); |
| +} |
| } // namespace browser_watcher |