Skip to content

Commit

Permalink
Run pre-commits for cast_starboard_api_changes.
Browse files Browse the repository at this point in the history
Bug: n/a
Test: n/a
  • Loading branch information
saqneo committed Aug 7, 2023
1 parent a29ae71 commit f4bcf2a
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 34 deletions.
5 changes: 3 additions & 2 deletions starboard/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ group("gn_all") {
"//starboard/client_porting/eztime:eztime_test",
"//starboard/client_porting/icu_init",
"//starboard/client_porting/poem:poem_unittests",
"//starboard/contrib/cast/cast_starboard_api/samples:cast",
"//starboard/examples/hello_world:starboard_hello_world_example",
"//starboard/examples/window:starboard_window_example",
"//starboard/extension:extension_test",
"//starboard/loader_app:app_key_files_test",
"//starboard/nplb",
"//starboard/nplb/nplb_evergreen_compat_tests",
"//starboard/contrib/cast/cast_starboard_api/samples:cast"
]

if (gl_type != "none") {
Expand Down Expand Up @@ -179,7 +179,8 @@ source_set("starboard_headers_only") {

if (current_toolchain == starboard_toolchain) {
# This is the default 'starboard_platform_target'; use default properties
starboard_platform_target("starboard_platform_group") {}
starboard_platform_target("starboard_platform_group") {
}

if (platform_tests_path == "") {
# If 'starboard_platform_tests' is not defined by the platform, then an
Expand Down
2 changes: 1 addition & 1 deletion starboard/build/config/starboard_target_type.gni
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ template("starboard_platform_target") {
public_deps += invoker.public_deps
}
}
}
}
4 changes: 2 additions & 2 deletions starboard/contrib/cast/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Cast Starboard API

The Cast Starboard API is a shared library which contains the portion of
Starboard required to run Cast.
Starboard required to run Cast.

### Customizations

Expand Down Expand Up @@ -45,7 +45,7 @@ ninja -C out/linux-x64x11_devel/ cast_starboard_api_test
To run the test suite:

```
./out/linux-x64x11_devel/cast_starboard_api_test_loader
./out/linux-x64x11_devel/cast_starboard_api_test_loader
```

### Known Issues
Expand Down
22 changes: 8 additions & 14 deletions starboard/contrib/cast/cast_starboard_api/samples/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ import("//starboard/build/config/starboard_target_type.gni")

group("cast") {
if (build_with_separate_cobalt_toolchain) {
public_deps = [
":cast_starboard_api($starboard_toolchain)"
]
public_deps = [ ":cast_starboard_api($starboard_toolchain)" ]
}
}

Expand All @@ -14,8 +12,8 @@ if (build_with_separate_cobalt_toolchain) {
starboard_platform_target("cast_starboard_api") {
ldflags = [
# Hide unwanted symbols, which also shrinks the resulting binary.
"-Wl,--version-script=" + rebase_path("./cast_starboard_api.lds",
root_build_dir)
"-Wl,--version-script=" +
rebase_path("./cast_starboard_api.lds", root_build_dir),
]

if (!use_asan) {
Expand All @@ -29,14 +27,12 @@ if (build_with_separate_cobalt_toolchain) {

copy("cast_starboard_api_test_data") {
install_content = true
sources = ["$root_out_dir/libcast_starboard_api.so"]
sources = [ "$root_out_dir/libcast_starboard_api.so" ]

# This artifact is consumed by a test built outside of the
# starboard_toolchain; move from `starboard/content/` to `content/`.
outputs = [ "$sb_static_contents_output_data_dir/../../content/{{source_file_part}}" ]
deps = [
":cast_starboard_api"
]
deps = [ ":cast_starboard_api" ]
}
}
target(gtest_target_type, "cast_starboard_api_test") {
Expand All @@ -45,13 +41,11 @@ if (build_with_separate_cobalt_toolchain) {
"//starboard/common/test_main.cc",
"cast_starboard_api_test.cc",
]
data_deps = [
":cast_starboard_api_test_data($starboard_toolchain)",
]
data_deps = [ ":cast_starboard_api_test_data($starboard_toolchain)" ]
deps = [
"//starboard",
"//testing/gtest",
"//starboard/nplb/testdata/file_tests:nplb_file_tests_data",
"//testing/gtest",
]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
#include "starboard/common/condition_variable.h"
#include "starboard/common/log.h"
#include "starboard/common/mutex.h"
#include "starboard/common/thread.h"
#include "starboard/egl.h"
#include "starboard/event.h"
#include "starboard/file.h"
#include "starboard/gles.h"
#include "starboard/system.h"
#include "starboard/window.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "starboard/common/thread.h"

namespace {

Expand Down Expand Up @@ -51,12 +51,13 @@ class CastStarboardApiTest : public ::testing::Test {

private:
class CastStarboardApiThread : public starboard::Thread {
public:
CastStarboardApiThread(CastStarboardApi* api) : starboard::Thread("cast_thread"), api_(api) {}
public:
explicit CastStarboardApiThread(CastStarboardApi* api)
: starboard::Thread("cast_thread"), api_(api) {}

void Run() override;

private:
private:
CastStarboardApi* api_;
};

Expand Down Expand Up @@ -100,8 +101,10 @@ void EventCallbackStatic(void* context) {

CastStarboardApiTest::CastStarboardApiTest() {
g_test_instance = this;
started_cond_ = std::make_unique<starboard::ConditionVariable>(started_mutex_);
received_cond_ = std::make_unique<starboard::ConditionVariable>(received_mutex_);
started_cond_ =
std::make_unique<starboard::ConditionVariable>(started_mutex_);
received_cond_ =
std::make_unique<starboard::ConditionVariable>(received_mutex_);

// Ensure libcast_starboard_api.so has been opened.
if (!g_lib) {
Expand Down Expand Up @@ -145,11 +148,11 @@ CastStarboardApiTest::~CastStarboardApiTest() {

void CastStarboardApiTest::EventHandleInternal(const SbEvent* event) {
switch (event->type) {
case kSbEventTypeStart:
started_cond_->Signal();
break;
default:
break;
case kSbEventTypeStart:
started_cond_->Signal();
break;
default:
break;
}

received_.push_back(event->type);
Expand All @@ -165,8 +168,8 @@ void CastStarboardApiTest::WaitForEventCallback() {
received_mutex_.Release();
}

void CastStarboardApiTest::CastStarboardApiThread::Run() {
api_->SbRunStarboardMain(0, nullptr, &EventHandleStatic);
void CastStarboardApiTest::CastStarboardApiThread::Run() {
api_->SbRunStarboardMain(0, nullptr, &EventHandleStatic);
}

// The default Application only be started once in the lifetime of the
Expand Down Expand Up @@ -265,4 +268,4 @@ TEST_F(CastStarboardApiTest, EventLoop_CastWindowSurface) {
api().SbWindowDestroy(window);
}

} // namespace
} // namespace
2 changes: 1 addition & 1 deletion starboard/shared/x11/application_x11.cc
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,7 @@ ApplicationX11::WaitForSystemEventWithTimeout(SbTime time) {
}

// In modular builds, |CreateWindow| is not always called before the event
// loop is running.
// loop is running.
if (!dev_input_) {
return nullptr;
}
Expand Down

0 comments on commit f4bcf2a

Please sign in to comment.