xref: /aosp_15_r20/external/cronet/base/fuchsia/system_info.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2022 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef BASE_FUCHSIA_SYSTEM_INFO_H_
6 #define BASE_FUCHSIA_SYSTEM_INFO_H_
7 
8 #include "base/base_export.h"
9 
10 namespace fuchsia_buildinfo {
11 class BuildInfo;
12 }
13 namespace fuchsia_hwinfo {
14 class ProductInfo;
15 }
16 
17 namespace base {
18 
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.
22 // Returns whether the system info was successfully cached.
23 [[nodiscard]] BASE_EXPORT bool FetchAndCacheSystemInfo();
24 
25 // Returns the cached build info.
26 BASE_EXPORT const fuchsia_buildinfo::BuildInfo& GetCachedBuildInfo();
27 
28 // Synchronously fetches the system ProductInfo.
29 // Returns empty ProductInfo if the required service is unavailable or returns
30 // an error.
31 BASE_EXPORT fuchsia_hwinfo::ProductInfo GetProductInfo();
32 
33 // Resets the cached system info to empty so that
34 // FetchAndCacheSystemInfo() can be called again in this process.
35 BASE_EXPORT void ClearCachedSystemInfoForTesting();
36 
37 }  // namespace base
38 
39 #endif  // BASE_FUCHSIA_SYSTEM_INFO_H_
40