Skip to content

Commit 8ec342e

Browse files
starboard: Uniquely name GetConfigurationApi methods (#7142)
go/cobalt-flatten-starboard-namespace This change renames platform-specific functions to include a unique platform suffix (e.g., GetConfigurationApi becomes GetConfigurationApiAndroid). With unique function names established, platform-specific namespaces like starboard::android::shared, starboard::linux::shared, starboard::raspi::skia, etc., are removed. All configuration logic now resides directly within the top-level starboard namespace, simplifying the codebase and improving code discoverability Bug: 441955897 --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent d26036b commit 8ec342e

19 files changed

+48
-89
lines changed

starboard/android/shared/configuration.cc

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,36 +17,35 @@
1717
#include "starboard/common/configuration_defaults.h"
1818
#include "starboard/extension/configuration.h"
1919

20-
namespace starboard::android::shared {
21-
20+
namespace starboard {
2221
namespace {
2322

24-
const char* CobaltUserOnExitStrategy() {
23+
const char* CobaltUserOnExitStrategyAndroid() {
2524
// On Android, we almost never want to actually terminate the process, so
2625
// instead indicate that we would instead like to be suspended when users
2726
// initiate an "exit".
2827
return "suspend";
2928
}
3029

31-
int CobaltEglSwapInterval() {
30+
int CobaltEglSwapIntervalAndroid() {
3231
// Switch Android's SurfaceFlinger queue to "async mode" so that we don't
3332
// queue up rendered frames which would interfere with frame timing and
3433
// more importantly lead to input latency.
3534
return 0;
3635
}
3736

38-
bool CobaltEnableQuic() {
39-
return 0;
37+
bool CobaltEnableQuicAndroid() {
38+
return false;
4039
}
4140

4241
const CobaltExtensionConfigurationApi kConfigurationApi = {
4342
kCobaltExtensionConfigurationName,
4443
3,
45-
&CobaltUserOnExitStrategy,
44+
&CobaltUserOnExitStrategyAndroid,
4645
&CobaltRenderDirtyRegionOnlyDefault,
47-
&CobaltEglSwapInterval,
46+
&CobaltEglSwapIntervalAndroid,
4847
&CobaltFallbackSplashScreenUrlDefault,
49-
&CobaltEnableQuic,
48+
&CobaltEnableQuicAndroid,
5049
&CobaltSkiaCacheSizeInBytesDefault,
5150
&CobaltOffscreenTargetCacheSizeInBytesDefault,
5251
&CobaltEncodedImageCacheSizeInBytesDefault,
@@ -70,8 +69,8 @@ const CobaltExtensionConfigurationApi kConfigurationApi = {
7069

7170
} // namespace
7271

73-
const void* GetConfigurationApi() {
72+
const void* GetConfigurationApiAndroid() {
7473
return &kConfigurationApi;
7574
}
7675

77-
} // namespace starboard::android::shared
76+
} // namespace starboard

starboard/android/shared/configuration.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
#ifndef STARBOARD_ANDROID_SHARED_CONFIGURATION_H_
1616
#define STARBOARD_ANDROID_SHARED_CONFIGURATION_H_
1717

18-
namespace starboard::android::shared {
18+
namespace starboard {
1919

20-
const void* GetConfigurationApi();
20+
const void* GetConfigurationApiAndroid();
2121

22-
} // namespace starboard::android::shared
22+
} // namespace starboard
2323

2424
#endif // STARBOARD_ANDROID_SHARED_CONFIGURATION_H_

starboard/android/shared/system_get_extensions.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const void* SbSystemGetExtension(const char* name) {
4040
return starboard::android::shared::GetPlatformServiceApi();
4141
}
4242
if (strcmp(name, kCobaltExtensionConfigurationName) == 0) {
43-
return starboard::android::shared::GetConfigurationApi();
43+
return starboard::GetConfigurationApiAndroid();
4444
}
4545
if (strcmp(name, kCobaltExtensionMediaSessionName) == 0) {
4646
// TODO(b/377019873): Re-enable

starboard/common/configuration_defaults.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ using starboard::CobaltSkiaGlyphAtlasHeightDefault;
9393
using starboard::CobaltSkiaGlyphAtlasWidthDefault;
9494
using starboard::CobaltSoftwareSurfaceCacheSizeInBytesDefault;
9595
} // namespace common
96-
9796
} // namespace starboard
9897

9998
#endif // STARBOARD_COMMON_CONFIGURATION_DEFAULTS_H_

starboard/linux/shared/configuration.cc

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,9 @@
1919

2020
// Omit namespace linux due to symbol name conflict.
2121
namespace starboard {
22-
namespace shared {
23-
2422
namespace {
2523

26-
int CobaltEglSwapInterval() {
24+
int CobaltEglSwapIntervalLinux() {
2725
// This platform uses a compositor to present the rendering output, so
2826
// set the swap interval to update the buffer immediately. That buffer
2927
// will then be presented by the compositor on its own time.
@@ -35,7 +33,7 @@ const CobaltExtensionConfigurationApi kConfigurationApi = {
3533
3,
3634
&CobaltUserOnExitStrategyDefault,
3735
&CobaltRenderDirtyRegionOnlyDefault,
38-
&CobaltEglSwapInterval,
36+
&CobaltEglSwapIntervalLinux,
3937
&CobaltFallbackSplashScreenUrlDefault,
4038
&CobaltEnableQuicDefault,
4139
&CobaltSkiaCacheSizeInBytesDefault,
@@ -61,9 +59,8 @@ const CobaltExtensionConfigurationApi kConfigurationApi = {
6159

6260
} // namespace
6361

64-
const void* GetConfigurationApi() {
62+
const void* GetConfigurationApiLinux() {
6563
return &kConfigurationApi;
6664
}
6765

68-
} // namespace shared
6966
} // namespace starboard

starboard/linux/shared/configuration.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,10 @@
1515
#ifndef STARBOARD_LINUX_SHARED_CONFIGURATION_H_
1616
#define STARBOARD_LINUX_SHARED_CONFIGURATION_H_
1717

18-
// Omit namespace linux due to symbol name conflict.
1918
namespace starboard {
20-
namespace shared {
2119

22-
const void* GetConfigurationApi();
20+
const void* GetConfigurationApiLinux();
2321

24-
} // namespace shared
2522
} // namespace starboard
2623

2724
#endif // STARBOARD_LINUX_SHARED_CONFIGURATION_H_

starboard/linux/shared/system_get_extensions.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const void* SbSystemGetExtension(const char* name) {
5555
return starboard::shared::GetPlatformServiceApi();
5656
}
5757
if (strcmp(name, kCobaltExtensionConfigurationName) == 0) {
58-
return starboard::shared::GetConfigurationApi();
58+
return starboard::GetConfigurationApiLinux();
5959
}
6060
if (strcmp(name, kCobaltExtensionCrashHandlerName) == 0) {
6161
return starboard::GetCrashHandlerApi();

starboard/linux/x64x11/skia/configuration.cc

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,17 @@
1717
#include "starboard/common/configuration_defaults.h"
1818
#include "starboard/extension/configuration.h"
1919

20-
// Omit namespace linux due to symbol name conflict.
2120
namespace starboard {
22-
namespace x64x11 {
23-
namespace skia {
24-
2521
namespace {
2622

27-
int CobaltEglSwapInterval() {
23+
int CobaltEglSwapIntervalLinuxSkia() {
2824
// This platform uses a compositor to present the rendering output, so
2925
// set the swap interval to update the buffer immediately. That buffer
3026
// will then be presented by the compositor on its own time.
3127
return 0;
3228
}
3329

34-
const char* CobaltRasterizerType() {
30+
const char* CobaltRasterizerTypeLinuxSkia() {
3531
// Use the skia hardware rasterizer.
3632
return "hardware";
3733
}
@@ -41,7 +37,7 @@ const CobaltExtensionConfigurationApi kConfigurationApi = {
4137
3,
4238
&CobaltUserOnExitStrategyDefault,
4339
&CobaltRenderDirtyRegionOnlyDefault,
44-
&CobaltEglSwapInterval,
40+
&CobaltEglSwapIntervalLinuxSkia,
4541
&CobaltFallbackSplashScreenUrlDefault,
4642
&CobaltEnableQuicDefault,
4743
&CobaltSkiaCacheSizeInBytesDefault,
@@ -59,18 +55,16 @@ const CobaltExtensionConfigurationApi kConfigurationApi = {
5955
&CobaltReduceCpuMemoryByDefault,
6056
&CobaltReduceGpuMemoryByDefault,
6157
&CobaltGcZealDefault,
62-
&CobaltRasterizerType,
58+
&CobaltRasterizerTypeLinuxSkia,
6359
&CobaltEnableJitDefault,
6460
&CobaltFallbackSplashScreenTopicsDefault,
6561
&CobaltCanStoreCompiledJavascriptDefault,
6662
};
6763

6864
} // namespace
6965

70-
const void* GetConfigurationApi() {
66+
const void* GetConfigurationApiLinuxSkia() {
7167
return &kConfigurationApi;
7268
}
7369

74-
} // namespace skia
75-
} // namespace x64x11
7670
} // namespace starboard

starboard/linux/x64x11/skia/configuration.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,10 @@
1515
#ifndef STARBOARD_LINUX_X64X11_SKIA_CONFIGURATION_H_
1616
#define STARBOARD_LINUX_X64X11_SKIA_CONFIGURATION_H_
1717

18-
// Omit namespace linux due to symbol name conflict.
1918
namespace starboard {
20-
namespace x64x11 {
21-
namespace skia {
2219

23-
const void* GetConfigurationApi();
20+
const void* GetConfigurationApiLinuxSkia();
2421

25-
} // namespace skia
26-
} // namespace x64x11
2722
} // namespace starboard
2823

2924
#endif // STARBOARD_LINUX_X64X11_SKIA_CONFIGURATION_H_

starboard/linux/x64x11/skia/system_get_extensions.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
const void* SbSystemGetExtension(const char* name) {
2222
if (strcmp(name, kCobaltExtensionConfigurationName) == 0) {
23-
return starboard::x64x11::skia::GetConfigurationApi();
23+
return starboard::GetConfigurationApiLinuxSkia();
2424
}
2525
return NULL;
2626
}

0 commit comments

Comments
 (0)