Skip to content

Commit

Permalink
Remove SbSystemGetDeviceType (#3895)
Browse files Browse the repository at this point in the history
b/355449840
  • Loading branch information
madhurajayaraman committed Aug 8, 2024
1 parent 2b99b15 commit 40e7ce8
Show file tree
Hide file tree
Showing 22 changed files with 0 additions and 332 deletions.
7 changes: 0 additions & 7 deletions cobalt/browser/application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -127,17 +127,10 @@ std::string GetDevServersListenIp() {
// Default to INADDR_ANY
std::string listen_ip(ip_v6 ? "::" : "0.0.0.0");

#if SB_API_VERSION < 15
// Desktop PCs default to loopback.
if (SbSystemGetDeviceType() == kSbSystemDeviceTypeDesktopPC) {
listen_ip = ip_v6 ? "::1" : "127.0.0.1";
}
#else
if (starboard::GetSystemPropertyString(kSbSystemPropertyDeviceType) ==
starboard::kSystemDeviceTypeDesktopPC) {
listen_ip = ip_v6 ? "::1" : "127.0.0.1";
}
#endif

#if defined(ENABLE_DEBUG_COMMAND_LINE_SWITCHES)
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
Expand Down
52 changes: 0 additions & 52 deletions cobalt/browser/user_agent_platform_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,47 +110,6 @@ void GetUserAgentInputMap(

namespace {

#if SB_API_VERSION < 15

struct DeviceTypeName {
SbSystemDeviceType device_type;
char device_type_string[10];
};

const DeviceTypeName kDeviceTypeStrings[] = {
{kSbSystemDeviceTypeBlueRayDiskPlayer, "BDP"},
{kSbSystemDeviceTypeGameConsole, "GAME"},
{kSbSystemDeviceTypeOverTheTopBox, "OTT"},
{kSbSystemDeviceTypeSetTopBox, "STB"},
{kSbSystemDeviceTypeTV, "TV"},
{kSbSystemDeviceTypeAndroidTV, "ATV"},
{kSbSystemDeviceTypeDesktopPC, "DESKTOP"},
{kSbSystemDeviceTypeVideoProjector, "PROJECTOR"},
{kSbSystemDeviceTypeUnknown, "UNKNOWN"}};

std::string CreateDeviceTypeString(SbSystemDeviceType device_type) {
for (auto& map : kDeviceTypeStrings) {
if (map.device_type == device_type) {
return std::string(map.device_type_string);
}
}
NOTREACHED();
return "UNKNOWN";
}

#if !defined(COBALT_BUILD_TYPE_GOLD)
SbSystemDeviceType GetDeviceType(std::string device_type_string) {
for (auto& map : kDeviceTypeStrings) {
if (!SbStringCompareNoCase(map.device_type_string,
device_type_string.c_str())) {
return map.device_type;
}
}
return kSbSystemDeviceTypeUnknown;
}
#endif
#endif // SB_API_VERSION < 15

static bool isAsciiAlphaDigit(int c) {
return base::IsAsciiAlpha(c) || base::IsAsciiDigit(c);
}
Expand Down Expand Up @@ -320,15 +279,10 @@ void InitializeUserAgentPlatformInfoFields(UserAgentPlatformInfo& info) {
info.set_aux_field(value);
}

#if SB_API_VERSION >= 15
result = SbSystemGetProperty(kSbSystemPropertyDeviceType, value,
kSystemPropertyMaxLength);
SB_DCHECK(result);
info.set_device_type(value);
#else
// Fill platform info if it is a hardware TV device.
info.set_device_type(SbSystemGetDeviceType());
#endif

// Chipset model number
result = SbSystemGetProperty(kSbSystemPropertyChipsetModelNumber, value,
Expand Down Expand Up @@ -481,12 +435,6 @@ void UserAgentPlatformInfo::set_original_design_manufacturer(
}
}

#if SB_API_VERSION < 15
void UserAgentPlatformInfo::set_device_type(SbSystemDeviceType device_type) {
device_type_ = device_type;
device_type_string_ = CreateDeviceTypeString(device_type_);
}
#endif
void UserAgentPlatformInfo::set_device_type(const std::string& device_type) {
device_type_string_ = device_type;
}
Expand Down
11 changes: 0 additions & 11 deletions cobalt/browser/user_agent_platform_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ class UserAgentPlatformInfo : public web::UserAgentPlatformInfo {
base::Optional<std::string> original_design_manufacturer() const override {
return original_design_manufacturer_;
}

#if SB_API_VERSION < 15
SbSystemDeviceType device_type() const override { return device_type_; }
#endif

const std::string& device_type_string() const override {
return device_type_string_;
}
Expand Down Expand Up @@ -101,9 +96,6 @@ class UserAgentPlatformInfo : public web::UserAgentPlatformInfo {
void set_os_name_and_version(const std::string& os_name_and_version);
void set_original_design_manufacturer(
base::Optional<std::string> original_design_manufacturer);
#if SB_API_VERSION < 15
void set_device_type(SbSystemDeviceType device_type);
#endif
void set_device_type(const std::string& device_type);
void set_chipset_model_number(
base::Optional<std::string> chipset_model_number);
Expand Down Expand Up @@ -132,9 +124,6 @@ class UserAgentPlatformInfo : public web::UserAgentPlatformInfo {
std::string starboard_version_;
std::string os_name_and_version_;
base::Optional<std::string> original_design_manufacturer_;
#if SB_API_VERSION < 15
SbSystemDeviceType device_type_ = kSbSystemDeviceTypeUnknown;
#endif
std::string device_type_string_;
base::Optional<std::string> chipset_model_number_;
base::Optional<std::string> model_year_;
Expand Down
5 changes: 0 additions & 5 deletions cobalt/web/testing/mock_user_agent_platform_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ class MockUserAgentPlatformInfo : public web::UserAgentPlatformInfo {
base::Optional<std::string> original_design_manufacturer() const override {
return optional_empty_string_;
}
#if SB_API_VERSION < 15
SbSystemDeviceType device_type() const override {
return kSbSystemDeviceTypeUnknown;
}
#endif
const std::string& device_type_string() const override {
return empty_string_;
}
Expand Down
3 changes: 0 additions & 3 deletions cobalt/web/user_agent_platform_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ class UserAgentPlatformInfo {
virtual const std::string& starboard_version() const = 0;
virtual const std::string& os_name_and_version() const = 0;
virtual base::Optional<std::string> original_design_manufacturer() const = 0;
#if SB_API_VERSION < 15
virtual SbSystemDeviceType device_type() const = 0;
#endif
virtual const std::string& device_type_string() const = 0;
virtual base::Optional<std::string> chipset_model_number() const = 0;
virtual base::Optional<std::string> model_year() const = 0;
Expand Down
1 change: 0 additions & 1 deletion starboard/android/shared/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,6 @@ static_library("starboard_platform") {
"speech_synthesis_internal.cc",
"speech_synthesis_is_supported.cc",
"speech_synthesis_speak.cc",
"system_get_device_type.cc",
"system_get_extensions.cc",
"system_get_locale_id.cc",
"system_get_path.cc",
Expand Down
23 changes: 0 additions & 23 deletions starboard/android/shared/system_get_device_type.cc

This file was deleted.

3 changes: 0 additions & 3 deletions starboard/elf_loader/exported_symbols.cc
Original file line number Diff line number Diff line change
Expand Up @@ -327,9 +327,6 @@ ExportedSymbols::ExportedSymbols() {
#endif // SB_API_VERSION < 16
REGISTER_SYMBOL(SbSystemBreakIntoDebugger);
REGISTER_SYMBOL(SbSystemClearLastError);
#if SB_API_VERSION < 15
REGISTER_SYMBOL(SbSystemGetDeviceType);
#endif
REGISTER_SYMBOL(SbSystemGetErrorString);
REGISTER_SYMBOL(SbSystemGetExtension);
REGISTER_SYMBOL(SbSystemGetLastError);
Expand Down
1 change: 0 additions & 1 deletion starboard/linux/shared/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ static_library("starboard_platform_sources") {
"//starboard/linux/shared/routes.h",
"//starboard/linux/shared/soft_mic_platform_service.cc",
"//starboard/linux/shared/soft_mic_platform_service.h",
"//starboard/linux/shared/system_get_device_type.cc",
"//starboard/linux/shared/system_get_extensions.cc",
"//starboard/linux/shared/system_get_path.cc",
"//starboard/linux/shared/system_has_capability.cc",
Expand Down
23 changes: 0 additions & 23 deletions starboard/linux/shared/system_get_device_type.cc

This file was deleted.

28 changes: 0 additions & 28 deletions starboard/nplb/system_get_property_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,6 @@ namespace {
// Size of appropriate value buffer.
const size_t kValueSize = 1024;

#if SB_API_VERSION < 15
bool IsCEDevice(SbSystemDeviceType device_type) {
switch (device_type) {
case kSbSystemDeviceTypeBlueRayDiskPlayer:
case kSbSystemDeviceTypeGameConsole:
case kSbSystemDeviceTypeOverTheTopBox:
case kSbSystemDeviceTypeSetTopBox:
case kSbSystemDeviceTypeTV:
return true;
case kSbSystemDeviceTypeDesktopPC:
case kSbSystemDeviceTypeUnknown:
default:
return false;
}
}
#endif
bool IsCEDevice(std::string device_type) {
if (device_type == kSystemDeviceTypeBlueRayDiskPlayer ||
device_type == kSystemDeviceTypeGameConsole ||
Expand Down Expand Up @@ -97,17 +81,6 @@ TEST(SbSystemGetPropertyTest, ReturnsRequired) {
BasicTest(kSbSystemPropertyFirmwareVersion, false, true, __LINE__);
BasicTest(kSbSystemPropertySystemIntegratorName, false, true, __LINE__);
BasicTest(kSbSystemPropertySpeechApiKey, false, true, __LINE__);
#if SB_API_VERSION < 15
if (IsCEDevice(SbSystemGetDeviceType())) {
BasicTest(kSbSystemPropertyBrandName, true, true, __LINE__);
BasicTest(kSbSystemPropertyModelName, true, true, __LINE__);
BasicTest(kSbSystemPropertyModelYear, false, true, __LINE__);
} else {
BasicTest(kSbSystemPropertyBrandName, false, true, __LINE__);
BasicTest(kSbSystemPropertyModelName, false, true, __LINE__);
BasicTest(kSbSystemPropertyModelYear, false, true, __LINE__);
}
#else
const size_t kSystemPropertyMaxLength = 1024;
char value[kSystemPropertyMaxLength];
bool result;
Expand All @@ -122,7 +95,6 @@ TEST(SbSystemGetPropertyTest, ReturnsRequired) {
BasicTest(kSbSystemPropertyModelName, false, true, __LINE__);
BasicTest(kSbSystemPropertyModelYear, false, true, __LINE__);
}
#endif
}

TEST(SbSystemGetPropertyTest, FailsGracefullyZeroBufferLength) {
Expand Down
1 change: 0 additions & 1 deletion starboard/raspi/shared/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ static_library("starboard_platform_sources") {
"//starboard/raspi/shared/open_max/video_decoder.cc",
"//starboard/raspi/shared/open_max/video_decoder.h",
"//starboard/raspi/shared/player_components_factory.cc",
"//starboard/raspi/shared/system_get_device_type.cc",
"//starboard/raspi/shared/system_get_property.cc",
"//starboard/raspi/shared/system_gles2.cc",
"//starboard/raspi/shared/thread_create_priority.cc",
Expand Down
23 changes: 0 additions & 23 deletions starboard/raspi/shared/system_get_device_type.cc

This file was deleted.

23 changes: 0 additions & 23 deletions starboard/shared/stub/system_get_device_type.cc

This file was deleted.

6 changes: 0 additions & 6 deletions starboard/shared/uwp/application_uwp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1328,16 +1328,10 @@ int InternalMain() {

#if defined(COBALT_BUILD_TYPE_GOLD)
// Early exit for gold builds on desktop as a security measure.
#if SB_API_VERSION < 15
if (SbSystemGetDeviceType() == kSbSystemDeviceTypeDesktopPC) {
return main_return_value;
}
#else
if (GetSystemPropertyString(kSbSystemPropertyDeviceType) ==
kSystemDeviceTypeDesktopPC) {
return main_return_value;
}
#endif
#endif // defined(COBALT_BUILD_TYPE_GOLD)

shared::win32::RegisterMainThread();
Expand Down
7 changes: 0 additions & 7 deletions starboard/shared/uwp/player_components_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -219,18 +219,11 @@ class PlayerComponentsFactory : public PlayerComponents::Factory {
}

#if !SB_HAS(GPU_DECODERS_ON_DESKTOP)
#if SB_API_VERSION < 15
if (SbSystemGetDeviceType() == kSbSystemDeviceTypeDesktopPC) {
SB_LOG(WARNING) << "GPU decoder disabled on Desktop.";
return false;
}
#else
if (GetSystemPropertyString(kSbSystemPropertyDeviceType) ==
kSystemDeviceTypeDesktopPC) {
SB_LOG(WARNING) << "GPU decoder disabled on Desktop.";
return false;
}
#endif
#endif // !SB_HAS(GPU_DECODERS_ON_DESKTOP)
if (video_codec != kSbMediaVideoCodecVp9 &&
video_codec != kSbMediaVideoCodecAv1) {
Expand Down
Loading

0 comments on commit 40e7ce8

Please sign in to comment.