blob: 48e949eb32fdaba50c2ae8b6c0f26348a45e5817 [file] [log] [blame]
Avi Drissmane4622aa2022-09-08 20:36:061// Copyright 2022 The Chromium Authors
David Dorwin7787caa2022-01-27 23:45:452// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Bryant Chandlerf533c3ea2022-05-17 19:35:415#ifndef BASE_FUCHSIA_SYSTEM_INFO_H_
6#define BASE_FUCHSIA_SYSTEM_INFO_H_
David Dorwin7787caa2022-01-27 23:45:457
8#include "base/base_export.h"
David Dorwin7787caa2022-01-27 23:45:459
Bryant Chandler3d47a752023-03-07 23:58:5510namespace fuchsia_buildinfo {
David Dorwin7787caa2022-01-27 23:45:4511class BuildInfo;
12}
Bryant Chandler3d47a752023-03-07 23:58:5513namespace fuchsia_hwinfo {
Bryant Chandler9bcd5cc2022-06-15 23:05:5514class ProductInfo;
15}
David Dorwin7787caa2022-01-27 23:45:4516
17namespace base {
18
Bryant Chandler9bcd5cc2022-06-15 23:05:5519// 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 Chandlerd972b692022-11-15 16:10:3722// Returns whether the system info was successfully cached.
23[[nodiscard]] BASE_EXPORT bool FetchAndCacheSystemInfo();
David Dorwin7787caa2022-01-27 23:45:4524
25// Returns the cached build info.
Bryant Chandler3d47a752023-03-07 23:58:5526BASE_EXPORT const fuchsia_buildinfo::BuildInfo& GetCachedBuildInfo();
David Dorwin7787caa2022-01-27 23:45:4527
Bryant Chandler9bcd5cc2022-06-15 23:05:5528// Synchronously fetches the system ProductInfo.
29// Returns empty ProductInfo if the required service is unavailable or returns
30// an error.
Bryant Chandler3d47a752023-03-07 23:58:5531BASE_EXPORT fuchsia_hwinfo::ProductInfo GetProductInfo();
Bryant Chandler9bcd5cc2022-06-15 23:05:5532
33// Resets the cached system info to empty so that
34// FetchAndCacheSystemInfo() can be called again in this process.
Bryant Chandlerf533c3ea2022-05-17 19:35:4135BASE_EXPORT void ClearCachedSystemInfoForTesting();
David Dorwin7787caa2022-01-27 23:45:4536
37} // namespace base
38
Bryant Chandlerf533c3ea2022-05-17 19:35:4139#endif // BASE_FUCHSIA_SYSTEM_INFO_H_