Avi Drissman | e4622aa | 2022-09-08 20:36:06 | [diff] [blame] | 1 | // Copyright 2022 The Chromium Authors |
David Dorwin | 7787caa | 2022-01-27 23:45:45 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
Bryant Chandler | f533c3ea | 2022-05-17 19:35:41 | [diff] [blame] | 5 | #ifndef BASE_FUCHSIA_SYSTEM_INFO_H_ |
| 6 | #define BASE_FUCHSIA_SYSTEM_INFO_H_ |
David Dorwin | 7787caa | 2022-01-27 23:45:45 | [diff] [blame] | 7 | |
| 8 | #include "base/base_export.h" |
David Dorwin | 7787caa | 2022-01-27 23:45:45 | [diff] [blame] | 9 | |
Bryant Chandler | 3d47a75 | 2023-03-07 23:58:55 | [diff] [blame] | 10 | namespace fuchsia_buildinfo { |
David Dorwin | 7787caa | 2022-01-27 23:45:45 | [diff] [blame] | 11 | class BuildInfo; |
| 12 | } |
Bryant Chandler | 3d47a75 | 2023-03-07 23:58:55 | [diff] [blame] | 13 | namespace fuchsia_hwinfo { |
Bryant Chandler | 9bcd5cc | 2022-06-15 23:05:55 | [diff] [blame] | 14 | class ProductInfo; |
| 15 | } |
David Dorwin | 7787caa | 2022-01-27 23:45:45 | [diff] [blame] | 16 | |
| 17 | namespace base { |
| 18 | |
Bryant Chandler | 9bcd5cc | 2022-06-15 23:05:55 | [diff] [blame] | 19 | // Makes a blocking call to fetch the info from the system and caches it |
| 20 | // before returning. Must be called in each process during the initialization |
| 21 | // phase. |
Bryant Chandler | d972b69 | 2022-11-15 16:10:37 | [diff] [blame] | 22 | // Returns whether the system info was successfully cached. |
| 23 | [[nodiscard]] BASE_EXPORT bool FetchAndCacheSystemInfo(); |
David Dorwin | 7787caa | 2022-01-27 23:45:45 | [diff] [blame] | 24 | |
| 25 | // Returns the cached build info. |
Bryant Chandler | 3d47a75 | 2023-03-07 23:58:55 | [diff] [blame] | 26 | BASE_EXPORT const fuchsia_buildinfo::BuildInfo& GetCachedBuildInfo(); |
David Dorwin | 7787caa | 2022-01-27 23:45:45 | [diff] [blame] | 27 | |
Bryant Chandler | 9bcd5cc | 2022-06-15 23:05:55 | [diff] [blame] | 28 | // Synchronously fetches the system ProductInfo. |
| 29 | // Returns empty ProductInfo if the required service is unavailable or returns |
| 30 | // an error. |
Bryant Chandler | 3d47a75 | 2023-03-07 23:58:55 | [diff] [blame] | 31 | BASE_EXPORT fuchsia_hwinfo::ProductInfo GetProductInfo(); |
Bryant Chandler | 9bcd5cc | 2022-06-15 23:05:55 | [diff] [blame] | 32 | |
| 33 | // Resets the cached system info to empty so that |
| 34 | // FetchAndCacheSystemInfo() can be called again in this process. |
Bryant Chandler | f533c3ea | 2022-05-17 19:35:41 | [diff] [blame] | 35 | BASE_EXPORT void ClearCachedSystemInfoForTesting(); |
David Dorwin | 7787caa | 2022-01-27 23:45:45 | [diff] [blame] | 36 | |
| 37 | } // namespace base |
| 38 | |
Bryant Chandler | f533c3ea | 2022-05-17 19:35:41 | [diff] [blame] | 39 | #endif // BASE_FUCHSIA_SYSTEM_INFO_H_ |