diff --git a/.github/actions/docker/action.yaml b/.github/actions/docker/action.yaml index 2880521fd45e..d32282f52506 100644 --- a/.github/actions/docker/action.yaml +++ b/.github/actions/docker/action.yaml @@ -61,8 +61,11 @@ runs: echo "DOCKER_TAG=${docker_tag}" >> $GITHUB_ENV shell: bash - name: Set up Cloud SDK - if: ${{ (steps.changed-files.outputs.any_changed == 'true') && (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.fork) }} uses: isarkis/setup-gcloud@40dce7857b354839efac498d3632050f568090b6 # v1.1.1 + - name: Configure Docker auth for GCloud + shell: bash + run: | + gcloud auth configure-docker - name: Set Docker Tag id: set-docker-tag-presubmit-fork env: diff --git a/.github/actions/on_device_tests/action.yaml b/.github/actions/on_device_tests/action.yaml index f7a9df22db8c..82e3c786ee64 100644 --- a/.github/actions/on_device_tests/action.yaml +++ b/.github/actions/on_device_tests/action.yaml @@ -4,7 +4,7 @@ description: Runs on-device tests. runs: using: "composite" steps: - - name: Install requirements + - name: Install Requirements run: | pip3 install grpcio==1.38.0 grpcio-tools==1.38.0 shell: bash @@ -12,15 +12,14 @@ runs: run: | python -m grpc_tools.protoc -Itools/ --python_out=tools/ --grpc_python_out=tools/ tools/on_device_tests_gateway.proto shell: bash - - name: Set up Cloud SDK + - name: Set Up Cloud SDK uses: isarkis/setup-gcloud@40dce7857b354839efac498d3632050f568090b6 # v1.1.1 - name: Set env vars - env: - WORKFLOW: ${{ github.workflow }} run: | echo "PROJECT_NAME=$(gcloud config get-value project)" >> $GITHUB_ENV - echo "GITHUB_RUN_NUMBER=${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV - echo "WORKFLOW=${WORKFLOW}" >> $GITHUB_ENV + + # Test results and logs + echo "GCS_RESULTS_PATH=gs://cobalt-unittest-storage/results/${{ matrix.name }}/${{ github.run_id }}_${{ matrix.shard }}" >> $GITHUB_ENV # Boot loader env if [ "${COBALT_EVERGREEN_LOADER}" != "null" ]; then @@ -43,8 +42,9 @@ runs: echo "USE_SHARDING=1" >> $GITHUB_ENV fi shell: bash - - name: run ${{ env.SHARD_NAME }} tests on ${{ matrix.platform }} platform + - name: Run ${{ env.SHARD_NAME }} Tests on ${{ matrix.platform }} Platform env: + GCS_PATH: gs://${{ env.PROJECT_NAME }}-test-artifacts/${{ github.workflow }}/${{ github.run_number }}/${{ matrix.platform }}_${{ matrix.config }} GITHUB_SHA: ${{ github.sha }} GITHUB_TOKEN: ${{ github.token }} GITHUB_PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }} @@ -58,14 +58,16 @@ runs: GITHUB_COMMIT_AUTHOR_USERNAME: ${{ github.event.commits[0].author.username }} GITHUB_COMMIT_AUTHOR_EMAIL: ${{ github.event.commits[0].author.email }} GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }} + GITHUB_RUN_NUMBER: ${{ github.run_number }} GITHUB_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + GITHUB_WORKFLOW: ${{ github.workflow }} run: | set -uxe python3 -u tools/on_device_tests_gateway_client.py \ --token ${GITHUB_TOKEN} \ --change_id ${GITHUB_PR_NUMBER:-postsubmit} \ trigger \ - --test_type ${{ env.TEST_TYPE }} \ + --test_type ${TEST_TYPE} \ --platform ${{ matrix.target_platform }} \ --config ${{ matrix.config }} \ --tag cobalt_github_${GITHUB_EVENT_NAME} \ @@ -77,10 +79,11 @@ runs: ${DIMENSION:+"--dimension" "$DIMENSION"} \ ${USE_SHARDING:+"--unittest_shard_index" "${{ matrix.shard }}"} \ ${ON_DEVICE_TEST_ATTEMPTS:+"--test_attempts" "$ON_DEVICE_TEST_ATTEMPTS"} \ - --archive_path gs://${PROJECT_NAME}-test-artifacts/${WORKFLOW}/${GITHUB_RUN_NUMBER}/${{ matrix.platform }}_${{ matrix.config }}/artifacts.tar \ + --archive_path "${GCS_PATH}/artifacts.tar" \ + --gcs_result_path "${GCS_RESULTS_PATH}" \ --label github \ --label ${GITHUB_EVENT_NAME} \ - --label ${WORKFLOW} \ + --label ${GITHUB_WORKFLOW} \ --label actor-${GITHUB_ACTOR} \ --label actor_id-${GITHUB_ACTOR_ID} \ --label triggering_actor-${GITHUB_TRIGGERING_ACTOR} \ @@ -89,3 +92,73 @@ runs: --label author-${GITHUB_PR_HEAD_USER_LOGIN:-$GITHUB_COMMIT_AUTHOR_USERNAME} \ --label author_id-${GITHUB_PR_HEAD_USER_ID:-$GITHUB_COMMIT_AUTHOR_EMAIL} shell: bash + - name: Download ${{ matrix.platform }} Test Results + if: always() && env.TEST_TYPE == 'unit_test' + run: | + # Don't break on error (-e), some commands are expected to fail. + set -ux + + COBALT_LOGS_DIR="${GITHUB_WORKSPACE}/cobalt_logs" + UNIT_TEST_RESULT_PATH="${GITHUB_WORKSPACE}/unit-test-results" + COBALT_XMLS_FILENAME="cobalt_xmls.zip" + + # Forward environment variables for uploading artifacts in later steps. + echo "UNIT_TEST_RESULT_PATH=${UNIT_TEST_RESULT_PATH}" >> $GITHUB_ENV + echo "COBALT_LOGS_DIR=${COBALT_LOGS_DIR}" >> $GITHUB_ENV + + mkdir -p "${GITHUB_WORKSPACE}/test_results" + cd "${GITHUB_WORKSPACE}/test_results" + + i=0 + # Try downloading the results for 6x 10 seconds before giving up. + while [ $i -lt 6 ]; do + # The results are uploaded after the test has completed. + sleep 10 + + # The log files are named by the device lab test driver. + COBALT_ERROR_LOG="webDriverTestLog.ERROR" + COBALT_INFO_LOG="webDriverTestLog.INFO" + + # This command will fail until the results have been uploaded. + gsutil cp "${GCS_RESULTS_PATH}/${COBALT_ERROR_LOG}" . + gsutil cp "${GCS_RESULTS_PATH}/${COBALT_INFO_LOG}" . + gsutil cp "${GCS_RESULTS_PATH}/${COBALT_XMLS_FILENAME}" . + + # Break if all files were downloaded. + if [[ -f "${COBALT_XMLS_FILENAME}" && -f "${COBALT_ERROR_LOG}" && -f "${COBALT_INFO_LOG}" ]]; then + break + fi + + i=$(( ${i} + 1 )) + done + + # Print device logs. Might fail if the log file failed to download. + cat ${COBALT_ERROR_LOG} + + # Rename log files for archiving to not expose legacy weirdness. + mkdir -p "${COBALT_LOGS_DIR}/${{ matrix.platform }}/" + mv "${COBALT_ERROR_LOG}" "${COBALT_LOGS_DIR}/${{ matrix.platform }}/stderr_${{ matrix.shard }}.log" + mv "${COBALT_INFO_LOG}" "${COBALT_LOGS_DIR}/${{ matrix.platform }}/stdout_${{ matrix.shard }}.log" + + # Prepare unit test results for DataDog upload. + RESULT_PATH=${UNIT_TEST_RESULT_PATH}/${{ matrix.platform }}/${{ matrix.shard }}/ + mkdir -p ${RESULT_PATH} + + # Set tags for test differentiation. + tags="platform:${{ matrix.platform }}" + echo $tags > ${UNIT_TEST_RESULT_PATH}/${{ matrix.platform }}/TAGS + + unzip ${COBALT_XMLS_FILENAME} -d ${RESULT_PATH} + shell: bash + - name: Archive Unit Test Logs + uses: actions/upload-artifact@v3 + if: always() && env.TEST_TYPE == 'unit_test' + with: + name: Device logs + path: ${{ env.COBALT_LOGS_DIR }}/ + - name: Archive Unit Test Results + uses: actions/upload-artifact@v3 + if: always() && env.TEST_TYPE == 'unit_test' + with: + name: unit-test-results + path: ${{ env.UNIT_TEST_RESULT_PATH }}/ diff --git a/.github/actions/on_host_test/action.yaml b/.github/actions/on_host_test/action.yaml index f4fac30f3365..2276acdc37ed 100644 --- a/.github/actions/on_host_test/action.yaml +++ b/.github/actions/on_host_test/action.yaml @@ -96,7 +96,7 @@ runs: fi fi - name: Populate TAGS for unit test report - if: (success() || failure()) && steps.run-tests.outputs.test_type == 'unit_tests' + if: always() && steps.run-tests.outputs.test_type == 'unit_tests' shell: bash run: | # Set tags for test differentiation. @@ -105,7 +105,7 @@ runs: echo $tags > ${TEST_RESULTS_DIR}/${{ matrix.platform }}/TAGS - name: Archive unit test results uses: actions/upload-artifact@v3 - if: (success() || failure()) && steps.run-tests.outputs.test_type == 'unit_tests' + if: always() && steps.run-tests.outputs.test_type == 'unit_tests' with: name: unit-test-results path: ${{env.TEST_RESULTS_DIR}}/ diff --git a/.github/workflows/unit_test_report.yaml b/.github/workflows/unit_test_report.yaml index 5d9cf16af4c2..2b9b707839a7 100644 --- a/.github/workflows/unit_test_report.yaml +++ b/.github/workflows/unit_test_report.yaml @@ -3,9 +3,10 @@ name: Upload Unit Test Results on: workflow_run: workflows: + - android - evergreen - linux - - win32 + - raspi-2 types: - completed diff --git a/base/BUILD.gn b/base/BUILD.gn index f148e14e5832..0a99702aad6e 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn @@ -1112,7 +1112,10 @@ component("base") { } if (is_starboard && current_toolchain != host_toolchain) { - deps += [ "//starboard:starboard_group" ] + deps += [ + "//starboard/common", + "//starboard:starboard_group" + ] } # `raw_ptr` cannot be made a component due to CRT symbol issues. @@ -2702,7 +2705,10 @@ static_library("base_static") { deps = [ "//build:chromeos_buildflags" ] if (is_starboard && current_toolchain != host_toolchain) { - deps += [ "//starboard:starboard_group" ] + deps += [ + "//starboard/common", + "//starboard:starboard_group" + ] } if (is_win) { diff --git a/base/files/file_enumerator_starboard.cc b/base/files/file_enumerator_starboard.cc index efa6f0813f7e..c87f3b49a873 100644 --- a/base/files/file_enumerator_starboard.cc +++ b/base/files/file_enumerator_starboard.cc @@ -22,7 +22,6 @@ #include "starboard/common/log.h" #include "starboard/common/string.h" #include "starboard/configuration_constants.h" -#include "starboard/memory.h" namespace base { diff --git a/base/files/file_util_starboard.cc b/base/files/file_util_starboard.cc index a86848f4dde9..204010419d63 100644 --- a/base/files/file_util_starboard.cc +++ b/base/files/file_util_starboard.cc @@ -476,6 +476,17 @@ FilePath MakeAbsoluteFilePath(const FilePath& input) { return input; } +bool SetNonBlocking(int fd) { + const int flags = fcntl(fd, F_GETFL); + if (flags == -1) + return false; + if (flags & O_NONBLOCK) + return true; + if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) == -1) + return false; + return true; +} + namespace internal { bool MoveUnsafe(const FilePath& from_path, const FilePath& to_path) { diff --git a/base/files/memory_mapped_file_starboard.cc b/base/files/memory_mapped_file_starboard.cc index 0bdf66fc4d13..110de9daeeae 100644 --- a/base/files/memory_mapped_file_starboard.cc +++ b/base/files/memory_mapped_file_starboard.cc @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -27,7 +28,6 @@ #include "base/threading/scoped_blocking_call.h" #include "build/build_config.h" #include "starboard/extension/memory_mapped_file.h" -#include "starboard/memory.h" namespace base { diff --git a/base/message_loop/message_pump_io_starboard.cc b/base/message_loop/message_pump_io_starboard.cc index d9ce934a2046..8cee057454e3 100644 --- a/base/message_loop/message_pump_io_starboard.cc +++ b/base/message_loop/message_pump_io_starboard.cc @@ -14,6 +14,12 @@ #include "base/message_loop/message_pump_io_starboard.h" +#if SB_API_VERSION >= 16 +#include +#include +#include +#endif + #include "base/auto_reset.h" #include "base/compiler_specific.h" #include "base/logging.h" @@ -28,17 +34,46 @@ namespace base { MessagePumpIOStarboard::SocketWatcher::SocketWatcher(const Location& from_here) : created_from_location_(from_here), interests_(kSbSocketWaiterInterestNone), +#if SB_API_VERSION >= 16 + socket_(-1), +#else socket_(kSbSocketInvalid), +#endif pump_(nullptr), watcher_(nullptr), weak_factory_(this) {} MessagePumpIOStarboard::SocketWatcher::~SocketWatcher() { +#if SB_API_VERSION >= 16 + if (socket_ >= 0) { + StopWatchingFileDescriptor(); + } +#else if (SbSocketIsValid(socket_)) { StopWatchingSocket(); } +#endif } +#if SB_API_VERSION >= 16 +bool MessagePumpIOStarboard::SocketWatcher::StopWatchingFileDescriptor() { + watcher_ = nullptr; + interests_ = kSbSocketWaiterInterestNone; + if (socket_ < 0) { + pump_ = nullptr; + // If this watcher is not watching anything, no-op and return success. + return true; + } + int socket = Release(); + bool result = true; + if (socket >= 0) { + DCHECK(pump_); + result = pump_->StopWatchingFileDescriptor(socket); + } + pump_ = nullptr; + return result; +} +#else bool MessagePumpIOStarboard::SocketWatcher::StopWatchingSocket() { watcher_ = nullptr; interests_ = kSbSocketWaiterInterestNone; @@ -57,21 +92,59 @@ bool MessagePumpIOStarboard::SocketWatcher::StopWatchingSocket() { pump_ = nullptr; return result; } +#endif +#if SB_API_VERSION >= 16 +void MessagePumpIOStarboard::SocketWatcher::Init(int socket, + bool persistent) { + DCHECK(socket >= 0); + DCHECK(socket_ < 0); +#else void MessagePumpIOStarboard::SocketWatcher::Init(SbSocket socket, bool persistent) { DCHECK(socket); DCHECK(!socket_); +#endif socket_ = socket; persistent_ = persistent; } +#if SB_API_VERSION >= 16 +int MessagePumpIOStarboard::SocketWatcher::Release() { + int socket = socket_; + socket_ = -1; + return socket; +} +#else SbSocket MessagePumpIOStarboard::SocketWatcher::Release() { SbSocket socket = socket_; socket_ = kSbSocketInvalid; return socket; } +#endif + +#if SB_API_VERSION >= 16 +void MessagePumpIOStarboard::SocketWatcher::OnFileCanReadWithoutBlocking( + int socket, + MessagePumpIOStarboard* pump) { + if (!watcher_) + return; + pump->WillProcessIOEvent(); + watcher_->OnFileCanReadWithoutBlocking(socket); + pump->DidProcessIOEvent(); +} + +void MessagePumpIOStarboard::SocketWatcher::OnFileCanWriteWithoutBlocking( + int socket, + MessagePumpIOStarboard* pump) { + if (!watcher_) + return; + pump->WillProcessIOEvent(); + watcher_->OnFileCanWriteWithoutBlocking(socket); + pump->DidProcessIOEvent(); +} +#else void MessagePumpIOStarboard::SocketWatcher::OnSocketReadyToRead( SbSocket socket, MessagePumpIOStarboard* pump) { @@ -91,6 +164,7 @@ void MessagePumpIOStarboard::SocketWatcher::OnSocketReadyToWrite( watcher_->OnSocketReadyToWrite(socket); pump->DidProcessIOEvent(); } +#endif MessagePumpIOStarboard::MessagePumpIOStarboard() : keep_running_(true), @@ -102,12 +176,21 @@ MessagePumpIOStarboard::~MessagePumpIOStarboard() { SbSocketWaiterDestroy(waiter_); } +#if SB_API_VERSION >= 16 +bool MessagePumpIOStarboard::WatchFileDescriptor(int socket, + bool persistent, + int mode, + SocketWatcher* controller, + Watcher* delegate) { + DCHECK(socket >= 0); +#else bool MessagePumpIOStarboard::Watch(SbSocket socket, bool persistent, int mode, SocketWatcher* controller, Watcher* delegate) { DCHECK(SbSocketIsValid(socket)); +#endif DCHECK(controller); DCHECK(delegate); DCHECK(mode == WATCH_READ || mode == WATCH_WRITE || mode == WATCH_READ_WRITE); @@ -123,8 +206,13 @@ bool MessagePumpIOStarboard::Watch(SbSocket socket, interests |= kSbSocketWaiterInterestWrite; } +#if SB_API_VERSION >= 16 + int old_socket = controller->Release(); + if (old_socket >= 0) { +#else SbSocket old_socket = controller->Release(); if (SbSocketIsValid(old_socket)) { +#endif // It's illegal to use this function to listen on 2 separate fds with the // same |controller|. if (old_socket != socket) { @@ -141,12 +229,24 @@ bool MessagePumpIOStarboard::Watch(SbSocket socket, interests |= old_interest_mask; // Must disarm the event before we can reuse it. +#if SB_API_VERSION >= 16 + SbPosixSocketWaiterRemove(waiter_, old_socket); +#else SbSocketWaiterRemove(waiter_, old_socket); +#endif // SB_API_VERSION >= 16 } // Set current interest mask and waiter for this event. - if (!SbSocketWaiterAdd(waiter_, socket, controller, - OnSocketWaiterNotification, interests, persistent)) { + bool result = false; +#if SB_API_VERSION >= 16 + result = SbPosixSocketWaiterAdd(waiter_, socket, controller, + OnPosixSocketWaiterNotification, interests, persistent); + +#else + result = SbSocketWaiterAdd(waiter_, socket, controller, + OnSocketWaiterNotification, interests, persistent); +#endif // SB_API_VERSION >= 16 + if (result == false) { return false; } @@ -157,9 +257,15 @@ bool MessagePumpIOStarboard::Watch(SbSocket socket, return true; } +#if SB_API_VERSION >= 16 +bool MessagePumpIOStarboard::StopWatchingFileDescriptor(int socket) { + return SbPosixSocketWaiterRemove(waiter_, socket); +} +#else bool MessagePumpIOStarboard::StopWatching(SbSocket socket) { return SbSocketWaiterRemove(waiter_, socket); } +#endif // SB_API_VERSION >= 16 void MessagePumpIOStarboard::AddIOObserver(IOObserver* obs) { io_observers_.AddObserver(obs); @@ -252,6 +358,36 @@ void MessagePumpIOStarboard::DidProcessIOEvent() { } } +#if SB_API_VERSION >= 16 + +// static +void MessagePumpIOStarboard::OnPosixSocketWaiterNotification(SbSocketWaiter waiter, + int socket, + void* context, + int ready_interests) { + base::WeakPtr controller = + static_cast(context)->weak_factory_.GetWeakPtr(); + DCHECK(controller.get()); + + MessagePumpIOStarboard* pump = controller->pump(); + pump->processed_io_events_ = true; + + // If not persistent, the watch has been released at this point. + if (!controller->persistent()) { + controller->Release(); + } + + if (ready_interests & kSbSocketWaiterInterestWrite) { + controller->OnFileCanWriteWithoutBlocking(socket, pump); + } + + // Check |controller| in case it's been deleted previously. + if (controller.get() && ready_interests & kSbSocketWaiterInterestRead) { + controller->OnFileCanReadWithoutBlocking(socket, pump); + } +} + +#else // static void MessagePumpIOStarboard::OnSocketWaiterNotification(SbSocketWaiter waiter, SbSocket socket, @@ -279,4 +415,5 @@ void MessagePumpIOStarboard::OnSocketWaiterNotification(SbSocketWaiter waiter, } } +#endif // SB_API_VERSION >= 16 } // namespace base diff --git a/base/message_loop/message_pump_io_starboard.h b/base/message_loop/message_pump_io_starboard.h index b7d807dec914..887cec12f01f 100644 --- a/base/message_loop/message_pump_io_starboard.h +++ b/base/message_loop/message_pump_io_starboard.h @@ -15,6 +15,8 @@ #ifndef BASE_MESSAGE_PUMP_IO_STARBOARD_H_ #define BASE_MESSAGE_PUMP_IO_STARBOARD_H_ +#include "starboard/configuration.h" + #include "base/compiler_specific.h" #include "base/memory/weak_ptr.h" #include "base/message_loop/message_pump.h" @@ -49,8 +51,13 @@ class BASE_EXPORT MessagePumpIOStarboard : public MessagePump { public: // These methods are called from MessageLoop::Run when a socket can be // interacted with without blocking. +#if SB_API_VERSION >= 16 + virtual void OnFileCanReadWithoutBlocking(int socket) {} + virtual void OnFileCanWriteWithoutBlocking(int socket) {} +#else virtual void OnSocketReadyToRead(SbSocket socket) {} virtual void OnSocketReadyToWrite(SbSocket socket) {} +#endif protected: virtual ~Watcher() {} @@ -70,7 +77,11 @@ class BASE_EXPORT MessagePumpIOStarboard : public MessagePump { // Stops watching the socket, always safe to call. No-op if there's nothing // to do. +#if SB_API_VERSION >= 16 + bool StopWatchingFileDescriptor(); +#else bool StopWatchingSocket(); +#endif bool persistent() const { return persistent_; } @@ -79,8 +90,13 @@ class BASE_EXPORT MessagePumpIOStarboard : public MessagePump { friend class MessagePumpIOStarboardTest; // Called by MessagePumpIOStarboard. +#if SB_API_VERSION >= 16 + void Init(int socket, bool persistent); + int Release(); +#else void Init(SbSocket socket, bool persistent); SbSocket Release(); +#endif int interests() const { return interests_; } void set_interests(int interests) { interests_ = interests; } @@ -90,12 +106,21 @@ class BASE_EXPORT MessagePumpIOStarboard : public MessagePump { void set_watcher(Watcher* watcher) { watcher_ = watcher; } +#if SB_API_VERSION >= 16 + void OnFileCanReadWithoutBlocking(int socket, MessagePumpIOStarboard* pump); + void OnFileCanWriteWithoutBlocking(int socket, MessagePumpIOStarboard* pump); +#else void OnSocketReadyToRead(SbSocket socket, MessagePumpIOStarboard* pump); void OnSocketReadyToWrite(SbSocket socket, MessagePumpIOStarboard* pump); +#endif const Location created_from_location_; int interests_; +#if SB_API_VERSION >= 16 + int socket_; +#else SbSocket socket_; +#endif bool persistent_; MessagePumpIOStarboard* pump_; Watcher* watcher_; @@ -123,6 +148,16 @@ class BASE_EXPORT MessagePumpIOStarboard : public MessagePump { // If an error occurs while calling this method in a cumulative fashion, the // event previously attached to |controller| is aborted. Returns true on // success. Must be called on the same thread the message_pump is running on. +#if SB_API_VERSION >= 16 + bool WatchFileDescriptor(int socket, + bool persistent, + int mode, + SocketWatcher* controller, + Watcher* delegate); + + // Stops watching the socket. + bool StopWatchingFileDescriptor(int socket); +#else bool Watch(SbSocket socket, bool persistent, int mode, @@ -131,6 +166,7 @@ class BASE_EXPORT MessagePumpIOStarboard : public MessagePump { // Stops watching the socket. bool StopWatching(SbSocket socket); +#endif void AddIOObserver(IOObserver* obs); void RemoveIOObserver(IOObserver* obs); @@ -149,10 +185,17 @@ class BASE_EXPORT MessagePumpIOStarboard : public MessagePump { // Called by SbSocketWaiter to tell us a registered socket can be read and/or // written to. +#if SB_API_VERSION >= 16 + static void OnPosixSocketWaiterNotification(SbSocketWaiter waiter, + int socket, + void* context, + int ready_interests); +#else static void OnSocketWaiterNotification(SbSocketWaiter waiter, SbSocket socket, void* context, int ready_interests); +#endif bool should_quit() const { return !keep_running_; } diff --git a/base/message_loop/message_pump_io_starboard_unittest.cc b/base/message_loop/message_pump_io_starboard_unittest.cc index c6231f70d882..f6874839cbd1 100644 --- a/base/message_loop/message_pump_io_starboard_unittest.cc +++ b/base/message_loop/message_pump_io_starboard_unittest.cc @@ -18,6 +18,12 @@ #include +#if SB_API_VERSION >= 16 +#include +#include +#include +#endif + #include "base/functional/bind.h" #include "base/run_loop.h" #include "base/synchronization/waitable_event.h" @@ -42,8 +48,12 @@ class MessagePumpIOStarboardTest : public testing::Test { void SetUp() override { Thread::Options options(MessagePumpType::IO, 0); ASSERT_TRUE(io_thread_.StartWithOptions(std::move(options))); +#if SB_API_VERSION >= 16 + socket_ = ::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); +#else socket_ = SbSocketCreate(SbSocketAddressType::kSbSocketAddressTypeIpv4, SbSocketProtocol::kSbSocketProtocolTcp); SbSocketIsValid(socket_); +#endif } void TearDown() override { @@ -52,33 +62,56 @@ class MessagePumpIOStarboardTest : public testing::Test { // pipe. io_thread_.Stop(); +#if SB_API_VERSION >= 16 + close(socket_); +#else SbSocketDestroy(socket_); +#endif } std::unique_ptr CreateMessagePump() { return std::make_unique(); } +#if SB_API_VERSION >= 16 + int socket() { + return socket_; + } +#else SbSocket socket() { return socket_; } +#endif scoped_refptr io_runner() const { return io_thread_.task_runner(); } void SimulateIOEvent(MessagePumpIOStarboard::SocketWatcher* controller) { +#if SB_API_VERSION >= 16 + MessagePumpIOStarboard::OnPosixSocketWaiterNotification(nullptr, + -1, + controller, + (kSbSocketWaiterInterestRead | kSbSocketWaiterInterestWrite)); + +#else + MessagePumpIOStarboard::OnSocketWaiterNotification(nullptr, nullptr, controller, (kSbSocketWaiterInterestRead | kSbSocketWaiterInterestWrite)); +#endif } std::unique_ptr task_environment_; private: Thread io_thread_; +#if SB_API_VERSION >= 16 + int socket_; +#else SbSocket socket_; +#endif }; namespace { @@ -90,8 +123,13 @@ class StupidWatcher : public MessagePumpIOStarboard::Watcher { ~StupidWatcher() override = default; // MessagePumpIOStarboard::Watcher interface +#if SB_API_VERSION >= 16 + void OnFileCanReadWithoutBlocking(int socket) override {} + void OnFileCanWriteWithoutBlocking(int socket) override {} +#else void OnSocketReadyToRead(SbSocket socket) override {} void OnSocketReadyToWrite(SbSocket socket) override {} +#endif }; // Death tests not supported. @@ -106,8 +144,13 @@ class BaseWatcher : public MessagePumpIOStarboard::Watcher { ~BaseWatcher() override = default; // MessagePumpIOStarboard::Watcher interface +#if SB_API_VERSION >= 16 + void OnFileCanReadWithoutBlocking(int socket) override { NOTREACHED(); } + void OnFileCanWriteWithoutBlocking(int socket) override { NOTREACHED(); } +#else void OnSocketReadyToRead(SbSocket socket) override { NOTREACHED(); } void OnSocketReadyToWrite(SbSocket socket) override { NOTREACHED(); } +#endif }; class DeleteWatcher : public BaseWatcher { @@ -122,7 +165,11 @@ class DeleteWatcher : public BaseWatcher { return controller_.get(); } +#if SB_API_VERSION >= 16 + void OnFileCanWriteWithoutBlocking(int socket) override { +#else void OnSocketReadyToWrite(SbSocket socket) override { +#endif DCHECK(controller_); controller_.reset(); } @@ -136,7 +183,11 @@ TEST_F(MessagePumpIOStarboardTest, DISABLED_DeleteWatcher) { DeleteWatcher delegate( std::make_unique(FROM_HERE)); std::unique_ptr pump = CreateMessagePump(); +#if SB_API_VERSION >= 16 + pump->WatchFileDescriptor(socket(), +#else pump->Watch(socket(), +#endif /*persistent=*/false, MessagePumpIOStarboard::WATCH_READ_WRITE, delegate.controller(), @@ -151,9 +202,16 @@ class StopWatcher : public BaseWatcher { ~StopWatcher() override = default; +#if SB_API_VERSION >= 16 + void OnFileCanWriteWithoutBlocking(int socket) override { + controller_->StopWatchingFileDescriptor(); + } +#else void OnSocketReadyToWrite(SbSocket socket) override { controller_->StopWatchingSocket(); } +#endif + private: raw_ptr controller_ = nullptr; @@ -164,7 +222,11 @@ TEST_F(MessagePumpIOStarboardTest, DISABLED_StopWatcher) { std::unique_ptr pump = CreateMessagePump(); MessagePumpIOStarboard::SocketWatcher controller(FROM_HERE); StopWatcher delegate(&controller); +#if SB_API_VERSION >= 16 + pump->WatchFileDescriptor(socket(), +#else pump->Watch(socket(), +#endif /*persistent=*/false, MessagePumpIOStarboard::WATCH_READ_WRITE, &controller, @@ -186,22 +248,35 @@ class NestedPumpWatcher : public MessagePumpIOStarboard::Watcher { NestedPumpWatcher() = default; ~NestedPumpWatcher() override = default; +#if SB_API_VERSION >= 16 + void OnFileCanReadWithoutBlocking(int socket) override { +#else void OnSocketReadyToRead(SbSocket socket) override { +#endif RunLoop runloop; SingleThreadTaskRunner::GetCurrentDefault()->PostTask( FROM_HERE, BindOnce(&QuitMessageLoopAndStart, runloop.QuitClosure())); runloop.Run(); } +#if SB_API_VERSION >= 16 + void OnFileCanWriteWithoutBlocking(int socket) override {} +}; +#else void OnSocketReadyToWrite(SbSocket socket) override {} }; +#endif // Fails on some platforms. TEST_F(MessagePumpIOStarboardTest, DISABLED_NestedPumpWatcher) { NestedPumpWatcher delegate; std::unique_ptr pump = CreateMessagePump(); MessagePumpIOStarboard::SocketWatcher controller(FROM_HERE); +#if SB_API_VERSION >= 16 + pump->WatchFileDescriptor(socket(), +#else pump->Watch(socket(), +#endif /*persistent=*/false, MessagePumpIOStarboard::WATCH_READ, &controller, @@ -218,7 +293,11 @@ class QuitWatcher : public BaseWatcher { QuitWatcher(base::OnceClosure quit_closure) : quit_closure_(std::move(quit_closure)) {} +#if SB_API_VERSION >= 16 + void OnFileCanReadWithoutBlocking(int socket) override { +#else void OnSocketReadyToRead(SbSocket socket) override { +#endif // Post a fatal closure to the MessageLoop before we quit it. SingleThreadTaskRunner::GetCurrentDefault()->PostTask( FROM_HERE, BindOnce(&FatalClosure)); @@ -252,7 +331,11 @@ TEST_F(MessagePumpIOStarboardTest, DISABLED_QuitWatcher) { std::unique_ptr watcher(new WaitableEventWatcher); // Tell the pump to watch the pipe. +#if SB_API_VERSION >= 16 + pump->WatchFileDescriptor(socket(), +#else pump->Watch(socket(), +#endif /*persistent=*/false, MessagePumpIOStarboard::WATCH_READ, &controller, diff --git a/base/metrics/persistent_memory_allocator.cc b/base/metrics/persistent_memory_allocator.cc index c4976fd425e4..f546eef9bdeb 100644 --- a/base/metrics/persistent_memory_allocator.cc +++ b/base/metrics/persistent_memory_allocator.cc @@ -35,9 +35,6 @@ #include #endif #endif -#if defined(STARBOARD) -#include "starboard/memory.h" -#endif namespace { diff --git a/base/process/memory_starboard.cc b/base/process/memory_starboard.cc index 728afa27cf5a..344684cb3eb7 100644 --- a/base/process/memory_starboard.cc +++ b/base/process/memory_starboard.cc @@ -16,7 +16,6 @@ #include -#include "starboard/memory.h" namespace base { diff --git a/base/strings/safe_sprintf_unittest.cc b/base/strings/safe_sprintf_unittest.cc index 1cfe22200c89..2edd509e1a6c 100644 --- a/base/strings/safe_sprintf_unittest.cc +++ b/base/strings/safe_sprintf_unittest.cc @@ -19,7 +19,6 @@ #if defined(STARBOARD) #include "starboard/common/string.h" -#include "starboard/memory.h" #include "starboard/types.h" #endif diff --git a/base/strings/string_number_conversions_unittest.cc b/base/strings/string_number_conversions_unittest.cc index 3dc8fd8ee9e4..45fd5fabb91a 100644 --- a/base/strings/string_number_conversions_unittest.cc +++ b/base/strings/string_number_conversions_unittest.cc @@ -19,7 +19,6 @@ #include "base/strings/utf_string_conversions.h" #include "testing/gtest/include/gtest/gtest.h" #if defined(STARBOARD) -#include "starboard/memory.h" #include "starboard/types.h" #endif diff --git a/base/strings/string_util_starboard.h b/base/strings/string_util_starboard.h index 857cd6576207..0de30a7b9980 100644 --- a/base/strings/string_util_starboard.h +++ b/base/strings/string_util_starboard.h @@ -22,7 +22,6 @@ #include "base/logging.h" #include "base/strings/string_util.h" #include "starboard/common/string.h" -#include "starboard/memory.h" #include "starboard/types.h" namespace base { diff --git a/base/strings/string_util_unittest.cc b/base/strings/string_util_unittest.cc index 7751370c2dd0..700e3ab470c9 100644 --- a/base/strings/string_util_unittest.cc +++ b/base/strings/string_util_unittest.cc @@ -18,7 +18,6 @@ #include "base/strings/utf_string_conversions.h" #include "build/build_config.h" #include "starboard/common/string.h" -#include "starboard/memory.h" #include "starboard/types.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/base/task/current_thread.cc b/base/task/current_thread.cc index 673e2028d4a2..c3a8274ed15c 100644 --- a/base/task/current_thread.cc +++ b/base/task/current_thread.cc @@ -212,6 +212,16 @@ MessagePumpForIO* CurrentIOThread::GetMessagePumpForIO() const { #if !BUILDFLAG(IS_NACL) #if defined(STARBOARD) +#if SB_API_VERSION >= 16 +bool CurrentIOThread::WatchFileDescriptor(int socket, + bool persistent, + int mode, + SocketWatcher* controller, + Watcher* delegate) { + return static_cast(GetMessagePumpForIO()) + ->WatchFileDescriptor(socket, persistent, mode, controller, delegate); +} +#else bool CurrentIOThread::Watch(SbSocket socket, bool persistent, int mode, @@ -220,6 +230,9 @@ bool CurrentIOThread::Watch(SbSocket socket, return static_cast(GetMessagePumpForIO()) ->Watch(socket, persistent, mode, controller, delegate); } +#endif + + #elif BUILDFLAG(IS_WIN) HRESULT CurrentIOThread::RegisterIOHandler( HANDLE file, diff --git a/base/task/current_thread.h b/base/task/current_thread.h index 5106c5e9fd71..36f9664d0276 100644 --- a/base/task/current_thread.h +++ b/base/task/current_thread.h @@ -279,11 +279,20 @@ class BASE_EXPORT CurrentIOThread : public CurrentThread { WATCH_WRITE = base::MessagePumpIOStarboard::WATCH_WRITE, WATCH_READ_WRITE = base::MessagePumpIOStarboard::WATCH_READ_WRITE}; +#if SB_API_VERSION >= 16 + bool WatchFileDescriptor(int socket, + bool persistent, + int mode, + SocketWatcher* controller, + Watcher* delegate); +#else bool Watch(SbSocket socket, bool persistent, int mode, SocketWatcher* controller, Watcher* delegate); +#endif + #elif BUILDFLAG(IS_WIN) // Please see MessagePumpWin for definitions of these methods. HRESULT RegisterIOHandler(HANDLE file, MessagePumpForIO::IOHandler* handler); diff --git a/base/task/thread_pool/thread_group_impl_unittest.cc b/base/task/thread_pool/thread_group_impl_unittest.cc index 3e6e2cb185b6..843e66378159 100644 --- a/base/task/thread_pool/thread_group_impl_unittest.cc +++ b/base/task/thread_pool/thread_group_impl_unittest.cc @@ -53,6 +53,10 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/abseil-cpp/absl/types/optional.h" +#if defined(STARBOARD) +#include "starboard/configuration_constants.h" +#endif + namespace base { namespace internal { namespace { diff --git a/chrome/updater/utils_test.cc b/chrome/updater/utils_test.cc index c9b2b1015dbd..f2018d7c917a 100644 --- a/chrome/updater/utils_test.cc +++ b/chrome/updater/utils_test.cc @@ -24,6 +24,7 @@ #include "base/strings/strcat.h" #include "base/values.h" #include "gmock/gmock.h" +#include "starboard/configuration_constants.h" #include "starboard/extension/installation_manager.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/cobalt/audio/audio_buffer.cc b/cobalt/audio/audio_buffer.cc index 6a3c169d6a6d..cd1682d4507c 100644 --- a/cobalt/audio/audio_buffer.cc +++ b/cobalt/audio/audio_buffer.cc @@ -21,7 +21,6 @@ #include "cobalt/audio/audio_helpers.h" #include "cobalt/web/dom_exception.h" -#include "starboard/memory.h" namespace cobalt { namespace audio { diff --git a/cobalt/audio/audio_file_reader_wav.cc b/cobalt/audio/audio_file_reader_wav.cc index d5534cbff587..6d490cddd629 100644 --- a/cobalt/audio/audio_file_reader_wav.cc +++ b/cobalt/audio/audio_file_reader_wav.cc @@ -21,7 +21,6 @@ #include "base/basictypes.h" #include "base/logging.h" #include "cobalt/media/base/endian_util.h" -#include "starboard/memory.h" namespace cobalt { namespace audio { diff --git a/cobalt/base/circular_buffer_shell.cc b/cobalt/base/circular_buffer_shell.cc index 2ccbe9a7161c..9ae3f9ad5a58 100644 --- a/cobalt/base/circular_buffer_shell.cc +++ b/cobalt/base/circular_buffer_shell.cc @@ -5,16 +5,13 @@ #include "cobalt/base/circular_buffer_shell.h" #include +#include #include #include "base/logging.h" #include "build/build_config.h" -#if defined(STARBOARD) -#include "starboard/memory.h" -#endif - static inline void* add_to_pointer(void* pointer, size_t amount) { return static_cast(pointer) + amount; } diff --git a/cobalt/black_box_tests/black_box_tests.py b/cobalt/black_box_tests/black_box_tests.py index e9f2f868a4a8..c2295f529513 100755 --- a/cobalt/black_box_tests/black_box_tests.py +++ b/cobalt/black_box_tests/black_box_tests.py @@ -69,6 +69,7 @@ 'cpu_usage_tracker_test', 'default_site_can_load', 'disable_eval_with_csp', + 'h5vcc_settings_test', 'h5vcc_storage_write_verify_test', # TODO(b/346882263): Disabled, it's suddenly flaky # 'h5vcc_watchdog_api_test', diff --git a/cobalt/black_box_tests/testdata/h5vcc_settings.html b/cobalt/black_box_tests/testdata/h5vcc_settings.html new file mode 100644 index 000000000000..65631171c54c --- /dev/null +++ b/cobalt/black_box_tests/testdata/h5vcc_settings.html @@ -0,0 +1,91 @@ + + + + + + + Cobalt h5vcc.settings + + + + + + diff --git a/starboard/android/arm64/vulkan/test_filters.py b/cobalt/black_box_tests/tests/h5vcc_settings_test.py similarity index 52% rename from starboard/android/arm64/vulkan/test_filters.py rename to cobalt/black_box_tests/tests/h5vcc_settings_test.py index b44d9cda8526..8c47d3b1458a 100644 --- a/starboard/android/arm64/vulkan/test_filters.py +++ b/cobalt/black_box_tests/tests/h5vcc_settings_test.py @@ -11,18 +11,17 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -"""Starboard Android ARM-64 Vulkan Platform Test Filters.""" +"""Tests h5vcc.settings functionality.""" -from starboard.android.shared import test_filters as shared_test_filters +from cobalt.black_box_tests import black_box_tests +from cobalt.black_box_tests.threaded_web_server import ThreadedWebServer -def CreateTestFilters(): - return AndroidArm64VulkanTestFilters() +class H5vccSettingsTest(black_box_tests.BlackBoxTestCase): - -class AndroidArm64VulkanTestFilters(shared_test_filters.TestFilters): - """Starboard Android ARM-64 Vulkan Platform Test Filters.""" - - def GetTestFilters(self): - filters = super().GetTestFilters() - return filters + def test_service_worker_fetch(self): + with ThreadedWebServer(binding_address=self.GetBindingAddress()) as server: + url = server.GetURL(file_name='testdata/h5vcc_settings.html') + with self.CreateCobaltRunner(url=url) as runner: + runner.WaitForJSTestsSetup() + self.assertTrue(runner.JSTestsSucceeded()) diff --git a/cobalt/browser/memory_settings/calculations_test.cc b/cobalt/browser/memory_settings/calculations_test.cc index f5e978455c6b..1a69237eb09b 100644 --- a/cobalt/browser/memory_settings/calculations_test.cc +++ b/cobalt/browser/memory_settings/calculations_test.cc @@ -21,7 +21,6 @@ #include "cobalt/browser/memory_settings/constants.h" #include "cobalt/browser/memory_settings/test_common.h" #include "cobalt/browser/switches.h" -#include "starboard/memory.h" #include "starboard/system.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/cobalt/browser/memory_settings/pretty_print_test.cc b/cobalt/browser/memory_settings/pretty_print_test.cc index 5dfaaab4db76..3757f5187f49 100644 --- a/cobalt/browser/memory_settings/pretty_print_test.cc +++ b/cobalt/browser/memory_settings/pretty_print_test.cc @@ -27,7 +27,6 @@ #include "cobalt/browser/memory_settings/memory_settings.h" #include "cobalt/browser/memory_settings/test_common.h" #include "cobalt/browser/switches.h" -#include "starboard/memory.h" #include "starboard/system.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/cobalt/build/cobalt_configuration.py b/cobalt/build/cobalt_configuration.py index 404aaad337f1..a8369d84fe0a 100644 --- a/cobalt/build/cobalt_configuration.py +++ b/cobalt/build/cobalt_configuration.py @@ -197,7 +197,6 @@ def GetTestTargets(self): 'csp_test', 'cssom_test', 'css_parser_test', - 'cwrappers_test', 'dom_parser_test', 'dom_test', # TODO(b/292127297): This target is not built for all platforms. diff --git a/cobalt/csp/source_list_test.cc b/cobalt/csp/source_list_test.cc index 0b5309ae0525..259a9d1c177e 100644 --- a/cobalt/csp/source_list_test.cc +++ b/cobalt/csp/source_list_test.cc @@ -21,7 +21,6 @@ #include "cobalt/network/local_network.h" #include "net/base/url_util.h" #include "starboard/common/socket.h" -#include "starboard/memory.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h" @@ -224,7 +223,6 @@ TEST_F(SourceListTest, TestInsecureLocalhostDefaultInsecureV4) { EXPECT_FALSE(source_list.Matches(GURL("https://example.locaLHost./"))); } -#if SB_HAS(IPV6) TEST_F(SourceListTest, TestInsecureLocalhostDefaultInsecureV6) { SourceList source_list(&checker_, csp_.get(), "connect-src"); @@ -259,7 +257,6 @@ TEST_F(SourceListTest, TestInsecureLocalhostDefaultInsecureV6) { EXPECT_FALSE(source_list.Matches( GURL("https://[0000:0000:0000:0000:0000:0000:0000:0001]:80/"))); } -#endif TEST_F(SourceListTest, TestInsecureLocalhostInsecureV4) { SourceList source_list(&checker_, csp_.get(), "connect-src"); @@ -279,7 +276,6 @@ TEST_F(SourceListTest, TestInsecureLocalhostInsecureV4) { EXPECT_TRUE(source_list.Matches(GURL("http://127.255.0.0/"))); } -#if SB_HAS(IPV6) TEST_F(SourceListTest, TestInsecureLocalhostInsecureV6) { SourceList source_list(&checker_, csp_.get(), "connect-src"); std::string sources = "'cobalt-insecure-localhost'"; @@ -295,7 +291,6 @@ TEST_F(SourceListTest, TestInsecureLocalhostInsecureV6) { EXPECT_TRUE(source_list.Matches( GURL("http://[0000:0000:0000:0000:0000:0000:0000:0001]:80/"))); } -#endif TEST_F(SourceListTest, TestInsecureLocalhostSecureV4) { SourceList source_list(&checker_, csp_.get(), "connect-src"); @@ -327,7 +322,6 @@ TEST_F(SourceListTest, TestInsecureLocalhostSecureV4) { EXPECT_FALSE(source_list.Matches(GURL("https://example.locaLHost./"))); } -#if SB_HAS(IPV6) TEST_F(SourceListTest, TestInsecureLocalhostSecureV6) { SourceList source_list(&checker_, csp_.get(), "connect-src"); std::string sources = "'cobalt-insecure-localhost'"; @@ -349,7 +343,6 @@ TEST_F(SourceListTest, TestInsecureLocalhostSecureV6) { EXPECT_FALSE(source_list.Matches( GURL("https://[0000:0000:0000:0000:0000:0000:0000:0001]:80/"))); } -#endif TEST_F(SourceListTest, TestInsecurePrivateRangeDefaultV4) { SourceList source_list(&checker_, csp_.get(), "connect-src"); @@ -367,7 +360,6 @@ TEST_F(SourceListTest, TestInsecurePrivateRangeDefaultV4) { EXPECT_FALSE(source_list.Matches(GURL("https://255.255.255.255/"))); } -#if SB_HAS(IPV6) TEST_F(SourceListTest, TestInsecurePrivateRangeDefaultV6) { SourceList source_list(&checker_, csp_.get(), "connect-src"); @@ -382,7 +374,6 @@ TEST_F(SourceListTest, TestInsecurePrivateRangeDefaultV6) { EXPECT_FALSE(source_list.Matches(GURL("http://[FE80::]/"))); EXPECT_FALSE(source_list.Matches(GURL("https://[FE80::]/"))); } -#endif TEST_F(SourceListTest, TestInsecurePrivateRangeV4Private) { std::string sources = "'cobalt-insecure-private-range'"; @@ -416,7 +407,6 @@ TEST_F(SourceListTest, TestInsecurePrivateRangeV4Secure) { EXPECT_FALSE(source_list.Matches(GURL("https://0.0.0.0/"))); } -#if SB_HAS(IPV6) TEST_F(SourceListTest, TestInsecurePrivateRangeV6ULA) { std::string sources = "'cobalt-insecure-private-range'"; // These are insecure calls. @@ -446,7 +436,6 @@ TEST_F(SourceListTest, TestInsecurePrivateRangeV6Secure) { GURL("https://[2606:2800:220:1:248:1893:25c8:1946]/"))); EXPECT_FALSE(source_list.Matches(GURL("https://[FE80::]/"))); } -#endif TEST_F(SourceListTest, TestInsecureLocalNetworkDefaultV4Local) { std::string sources = "'cobalt-insecure-local-network'"; @@ -481,7 +470,6 @@ TEST_F(SourceListTest, TestInsecureLocalNetworkDefaultV4Secure) { EXPECT_FALSE(source_list.Matches(GURL("https://143.195.170.1/"))); } -#if SB_HAS(IPV6) TEST_F(SourceListTest, TestInsecureLocalNetworkDefaultV6Local) { std::string sources = "'cobalt-insecure-local-network'"; SourceList source_list(&checker_, csp_.get(), "connect-src"); @@ -520,7 +508,6 @@ TEST_F(SourceListTest, TestInsecureLocalNetworkDefaultV6Secure) { EXPECT_FALSE(source_list.Matches( GURL("https://[2606:2800:220:1:248:1893:25c8:1946]/"))); } -#endif TEST_F(SourceListTest, TestInvalidHash) { std::string sources = "'sha256-c3uoUQo23pT8hqB5MoAZnI9LiPUc+lWgGBKHfV07iAM='"; diff --git a/cobalt/css_parser/grammar.h b/cobalt/css_parser/grammar.h index a0a5347dff0d..f9b1b9571afc 100644 --- a/cobalt/css_parser/grammar.h +++ b/cobalt/css_parser/grammar.h @@ -106,7 +106,6 @@ struct cobalt_yyltype { #define YYLTYPE_IS_TRIVIAL 0 #if defined(STARBOARD) -#include "starboard/memory.h" #define YYFREE free #define YYMALLOC malloc #endif diff --git a/cobalt/css_parser/scanner.cc b/cobalt/css_parser/scanner.cc index 289dd8763b8b..d576d214be4d 100644 --- a/cobalt/css_parser/scanner.cc +++ b/cobalt/css_parser/scanner.cc @@ -27,7 +27,6 @@ #include "cobalt/cssom/media_type_names.h" #include "cobalt/cssom/pseudo_class_names.h" #include "cobalt/cssom/pseudo_element_names.h" -#include "starboard/client_porting/cwrappers/pow_wrapper.h" #include "third_party/icu/source/common/unicode/unistr.h" namespace cobalt { diff --git a/cobalt/debug/BUILD.gn b/cobalt/debug/BUILD.gn index 3c07c2f62e19..34608b33fdb8 100644 --- a/cobalt/debug/BUILD.gn +++ b/cobalt/debug/BUILD.gn @@ -80,6 +80,7 @@ static_library("debug") { "//net", "//net/server:http_server", "//starboard:starboard_group", + "//starboard/common", "//third_party/devtools:devtools_frontend_resources", ] diff --git a/cobalt/dom/captions/system_caption_settings.cc b/cobalt/dom/captions/system_caption_settings.cc index 185502ecb4df..2abe6bcd606c 100644 --- a/cobalt/dom/captions/system_caption_settings.cc +++ b/cobalt/dom/captions/system_caption_settings.cc @@ -28,7 +28,6 @@ #include "cobalt/dom/captions/caption_state.h" #include "cobalt/web/event_target.h" #include "starboard/extension/accessibility.h" -#include "starboard/memory.h" namespace cobalt { namespace dom { diff --git a/cobalt/extension/configuration.h b/cobalt/extension/configuration.h deleted file mode 100644 index 36f5ae456cf6..000000000000 --- a/cobalt/extension/configuration.h +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2023 The Cobalt Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef COBALT_EXTENSION_CONFIGURATION_H_ -#define COBALT_EXTENSION_CONFIGURATION_H_ - -#if SB_API_VERSION <= 14 -#include "starboard/extension/configuration.h" -#else -#error "Extensions have moved, please see CHANGELOG for details." -#endif - -#endif // COBALT_EXTENSION_CONFIGURATION_H_ diff --git a/cobalt/extension/crash_handler.h b/cobalt/extension/crash_handler.h deleted file mode 100644 index 628c27eea1dd..000000000000 --- a/cobalt/extension/crash_handler.h +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2023 The Cobalt Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef COBALT_EXTENSION_CRASH_HANDLER_H_ -#define COBALT_EXTENSION_CRASH_HANDLER_H_ - -#if SB_API_VERSION <= 14 -#include "starboard/extension/crash_handler.h" -#else -#error "Extensions have moved, please see Starboard CHANGELOG for details." -#endif - -#endif // COBALT_EXTENSION_CRASH_HANDLER_H_ diff --git a/cobalt/extension/demuxer.h b/cobalt/extension/demuxer.h deleted file mode 100644 index 96e210b6fe15..000000000000 --- a/cobalt/extension/demuxer.h +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2023 The Cobalt Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef COBALT_EXTENSION_DEMUXER_H_ -#define COBALT_EXTENSION_DEMUXER_H_ - -#if SB_API_VERSION <= 14 -#include "starboard/extension/demuxer.h" -#else -#error "Extensions have moved, please see Starboard CHANGELOG for details." -#endif - -#endif // COBALT_EXTENSION_DEMUXER_H_ diff --git a/cobalt/extension/font.h b/cobalt/extension/font.h deleted file mode 100644 index 6eaac679eaac..000000000000 --- a/cobalt/extension/font.h +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2023 The Cobalt Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef COBALT_EXTENSION_FONT_H_ -#define COBALT_EXTENSION_FONT_H_ - -#if SB_API_VERSION <= 14 -#include "starboard/extension/font.h" -#else -#error "Extensions have moved, please see Starboard CHANGELOG for details." -#endif - -#endif // COBALT_EXTENSION_FONT_H_ diff --git a/cobalt/extension/free_space.h b/cobalt/extension/free_space.h deleted file mode 100644 index 856cf17cab39..000000000000 --- a/cobalt/extension/free_space.h +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2023 The Cobalt Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef COBALT_EXTENSION_FREE_SPACE_H_ -#define COBALT_EXTENSION_FREE_SPACE_H_ - -#if SB_API_VERSION <= 14 -#include "starboard/extension/free_space.h" -#else -#error "Extensions have moved, please see Starboard CHANGELOG for details." -#endif - -#endif // COBALT_EXTENSION_FREE_SPACE_H_ diff --git a/cobalt/extension/graphics.h b/cobalt/extension/graphics.h deleted file mode 100644 index e7943c942822..000000000000 --- a/cobalt/extension/graphics.h +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2023 The Cobalt Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef COBALT_EXTENSION_GRAPHICS_H_ -#define COBALT_EXTENSION_GRAPHICS_H_ - -#if SB_API_VERSION <= 14 -#include "starboard/extension/graphics.h" -#else -#error "Extensions have moved, please see Starboard CHANGELOG for details." -#endif - -#endif // COBALT_EXTENSION_GRAPHICS_H_ diff --git a/cobalt/extension/installation_manager.h b/cobalt/extension/installation_manager.h deleted file mode 100644 index 97a07579efe5..000000000000 --- a/cobalt/extension/installation_manager.h +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2023 The Cobalt Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef COBALT_EXTENSION_INSTALLATION_MANAGER_H_ -#define COBALT_EXTENSION_INSTALLATION_MANAGER_H_ - -#if SB_API_VERSION <= 14 -#include "starboard/extension/installation_manager.h" -#else -#error "Extensions have moved, please see Starboard CHANGELOG for details." -#endif - -#endif // COBALT_EXTENSION_INSTALLATION_MANAGER_H_ diff --git a/cobalt/extension/javascript_cache.h b/cobalt/extension/javascript_cache.h deleted file mode 100644 index ef58a742b751..000000000000 --- a/cobalt/extension/javascript_cache.h +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2023 The Cobalt Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef COBALT_EXTENSION_JAVASCRIPT_CACHE_H_ -#define COBALT_EXTENSION_JAVASCRIPT_CACHE_H_ - -#if SB_API_VERSION <= 14 -#include "starboard/extension/javascript_cache.h" -#else -#error "Extensions have moved, please see Starboard CHANGELOG for details." -#endif - -#endif // COBALT_EXTENSION_JAVASCRIPT_CACHE_H_ diff --git a/cobalt/extension/media_session.h b/cobalt/extension/media_session.h deleted file mode 100644 index 1aebd300b75d..000000000000 --- a/cobalt/extension/media_session.h +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2023 The Cobalt Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef COBALT_EXTENSION_MEDIA_SESSION_H_ -#define COBALT_EXTENSION_MEDIA_SESSION_H_ - -#if SB_API_VERSION <= 14 -#include "starboard/extension/media_session.h" -#else -#error "Extensions have moved, please see Starboard CHANGELOG for details." -#endif - -#endif // COBALT_EXTENSION_MEDIA_SESSION_H_ diff --git a/cobalt/extension/memory_mapped_file.h b/cobalt/extension/memory_mapped_file.h deleted file mode 100644 index c5ac54c3c517..000000000000 --- a/cobalt/extension/memory_mapped_file.h +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2023 The Cobalt Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef COBALT_EXTENSION_MEMORY_MAPPED_FILE_H_ -#define COBALT_EXTENSION_MEMORY_MAPPED_FILE_H_ - -#if SB_API_VERSION <= 14 -#include "starboard/extension/memory_mapped_file.h" -#else -#error "Extensions have moved, please see Starboard CHANGELOG for details." -#endif - -#endif // COBALT_EXTENSION_MEMORY_MAPPED_FILE_H_ diff --git a/cobalt/extension/platform_service.h b/cobalt/extension/platform_service.h deleted file mode 100644 index fca88ef9aef9..000000000000 --- a/cobalt/extension/platform_service.h +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2023 The Cobalt Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef COBALT_EXTENSION_PLATFORM_SERVICE_H_ -#define COBALT_EXTENSION_PLATFORM_SERVICE_H_ - -#if SB_API_VERSION <= 14 -#include "starboard/extension/platform_service.h" -#else -#error "Extensions have moved, please see Starboard CHANGELOG for details." -#endif - -#endif // COBALT_EXTENSION_PLATFORM_SERVICE_H_ diff --git a/cobalt/extension/updater_notification.h b/cobalt/extension/updater_notification.h deleted file mode 100644 index e56e77dae826..000000000000 --- a/cobalt/extension/updater_notification.h +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2023 The Cobalt Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef COBALT_EXTENSION_UPDATER_NOTIFICATION_H_ -#define COBALT_EXTENSION_UPDATER_NOTIFICATION_H_ - -#if SB_API_VERSION <= 14 -#include "starboard/extension/updater_notification.h" -#else -#error "Extensions have moved, please see Starboard CHANGELOG for details." -#endif - -#endif // COBALT_EXTENSION_UPDATER_NOTIFICATION_H_ diff --git a/cobalt/extension/url_fetcher_observer.h b/cobalt/extension/url_fetcher_observer.h deleted file mode 100644 index 65619d3bbc31..000000000000 --- a/cobalt/extension/url_fetcher_observer.h +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2023 The Cobalt Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef COBALT_EXTENSION_URL_FETCHER_OBSERVER_H_ -#define COBALT_EXTENSION_URL_FETCHER_OBSERVER_H_ - -#if SB_API_VERSION <= 14 -#include "starboard/extension/url_fetcher_observer.h" -#else -#error "Extensions have moved, please see Starboard CHANGELOG for details." -#endif - -#endif // COBALT_EXTENSION_URL_FETCHER_OBSERVER_H_ diff --git a/cobalt/h5vcc/BUILD.gn b/cobalt/h5vcc/BUILD.gn index 8220342a9258..6a1cc2cd9898 100644 --- a/cobalt/h5vcc/BUILD.gn +++ b/cobalt/h5vcc/BUILD.gn @@ -84,6 +84,7 @@ static_library("h5vcc") { "//cobalt/worker", "//net", "//starboard:starboard_group", + "//starboard/common", "//third_party/protobuf:protobuf_lite", ] if (enable_in_app_dial) { diff --git a/cobalt/h5vcc/h5vcc_accessibility.cc b/cobalt/h5vcc/h5vcc_accessibility.cc index 0e5861c0ef5f..4eec49a91765 100644 --- a/cobalt/h5vcc/h5vcc_accessibility.cc +++ b/cobalt/h5vcc/h5vcc_accessibility.cc @@ -21,7 +21,6 @@ #include "cobalt/base/accessibility_text_to_speech_settings_changed_event.h" #include "cobalt/browser/switches.h" #include "starboard/extension/accessibility.h" -#include "starboard/memory.h" namespace cobalt { namespace h5vcc { diff --git a/cobalt/h5vcc/h5vcc_settings.cc b/cobalt/h5vcc/h5vcc_settings.cc index 382febda7d99..165b86ca2426 100644 --- a/cobalt/h5vcc/h5vcc_settings.cc +++ b/cobalt/h5vcc/h5vcc_settings.cc @@ -118,30 +118,15 @@ bool H5vccSettings::Set(const std::string& name, SetValueType value) const { } } + // Disabled due to a bug with previous implementation. + if (name.compare("protocolfilter") == 0) { + return false; + } if (name.compare(network::kProtocolFilterKey) == 0 && value.IsType() && value.AsType().size() < 16384) { - std::string raw_json = value.AsType(); - base::Value old_config_json; - persistent_settings_->Get(network::kProtocolFilterKey, &old_config_json); - - if (raw_json.empty() && (!old_config_json.is_string() || - !old_config_json.GetString().empty())) { - persistent_settings_->Set(network::kProtocolFilterKey, base::Value()); - network_module_->SetProtocolFilterUpdatePending(); - return true; - } - - absl::optional old_config = - base::JSONReader::Read(old_config_json.GetString()); - absl::optional new_config = base::JSONReader::Read(raw_json); - if (!new_config) return false; - if (old_config && *old_config == *new_config) return false; - - persistent_settings_->Set(network::kProtocolFilterKey, - base::Value(raw_json)); - network_module_->SetProtocolFilterUpdatePending(); - return true; + return network_module_->SetHttpProtocolFilterPersistentSetting( + value.AsType()); } if (name.compare("cpu_usage_tracker_intervals") == 0 && diff --git a/cobalt/h5vcc/h5vcc_storage.cc b/cobalt/h5vcc/h5vcc_storage.cc index 9b6c095b8845..05487f8abad9 100644 --- a/cobalt/h5vcc/h5vcc_storage.cc +++ b/cobalt/h5vcc/h5vcc_storage.cc @@ -32,6 +32,7 @@ #include "net/http/http_cache.h" #include "net/http/http_transaction_factory.h" #include "starboard/common/string.h" +#include "starboard/configuration_constants.h" namespace cobalt { namespace h5vcc { diff --git a/cobalt/loader/image/animated_webp_image.cc b/cobalt/loader/image/animated_webp_image.cc index 619ced57e216..bcd670d1146f 100644 --- a/cobalt/loader/image/animated_webp_image.cc +++ b/cobalt/loader/image/animated_webp_image.cc @@ -28,7 +28,6 @@ #include "cobalt/render_tree/image_node.h" #include "cobalt/render_tree/node.h" #include "cobalt/render_tree/rect_node.h" -#include "starboard/memory.h" namespace cobalt { namespace loader { diff --git a/cobalt/loader/image/webp_image_decoder.cc b/cobalt/loader/image/webp_image_decoder.cc index 250f17e76081..90296936a0d2 100644 --- a/cobalt/loader/image/webp_image_decoder.cc +++ b/cobalt/loader/image/webp_image_decoder.cc @@ -20,7 +20,6 @@ #include "base/trace_event/trace_event.h" #include "cobalt/loader/image/animated_webp_image.h" #include "starboard/configuration.h" -#include "starboard/memory.h" namespace cobalt { namespace loader { diff --git a/cobalt/media/BUILD.gn b/cobalt/media/BUILD.gn index 72aa18148ab4..fc2c7a8b53fd 100644 --- a/cobalt/media/BUILD.gn +++ b/cobalt/media/BUILD.gn @@ -111,6 +111,7 @@ component("media") { "//media", "//net", "//starboard:starboard_group", + "//starboard/common", "//third_party/protobuf:protobuf_lite", "//ui/gfx:gfx", "//url", diff --git a/cobalt/media/base/audio_bus.cc b/cobalt/media/base/audio_bus.cc index e656769be84c..4df5a3d87cc7 100644 --- a/cobalt/media/base/audio_bus.cc +++ b/cobalt/media/base/audio_bus.cc @@ -17,7 +17,6 @@ #include #include -#include "starboard/memory.h" namespace cobalt { namespace media { diff --git a/cobalt/media/base/endian_util.h b/cobalt/media/base/endian_util.h index de979ccde455..a8be522e0298 100644 --- a/cobalt/media/base/endian_util.h +++ b/cobalt/media/base/endian_util.h @@ -16,7 +16,6 @@ #define COBALT_MEDIA_BASE_ENDIAN_UTIL_H_ #include "base/sys_byteorder.h" -#include "starboard/memory.h" // TODO: Consider Starboardize functions in this file. diff --git a/cobalt/media/base/interleaved_sinc_resampler.cc b/cobalt/media/base/interleaved_sinc_resampler.cc index ae83cb1aa69c..5ffc80dc5e6a 100644 --- a/cobalt/media/base/interleaved_sinc_resampler.cc +++ b/cobalt/media/base/interleaved_sinc_resampler.cc @@ -52,7 +52,6 @@ #include #include "base/logging.h" -#include "starboard/memory.h" namespace cobalt { namespace media { diff --git a/cobalt/media/base/sbplayer_bridge.cc b/cobalt/media/base/sbplayer_bridge.cc index e9a7cad71ccd..5f849281df51 100644 --- a/cobalt/media/base/sbplayer_bridge.cc +++ b/cobalt/media/base/sbplayer_bridge.cc @@ -34,7 +34,6 @@ #include "starboard/common/string.h" #include "starboard/configuration.h" #include "starboard/extension/player_set_max_video_input_size.h" -#include "starboard/memory.h" namespace cobalt { namespace media { diff --git a/cobalt/media/bidirectional_fit_reuse_allocator_test.cc b/cobalt/media/bidirectional_fit_reuse_allocator_test.cc index d4b50fa3d3dc..cdf46a8e4934 100644 --- a/cobalt/media/bidirectional_fit_reuse_allocator_test.cc +++ b/cobalt/media/bidirectional_fit_reuse_allocator_test.cc @@ -21,7 +21,6 @@ #include "starboard/common/fixed_no_free_allocator.h" #include "starboard/common/pointer_arithmetic.h" #include "starboard/configuration.h" -#include "starboard/memory.h" #include "starboard/types.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/cobalt/media/decoder_buffer_allocator.cc b/cobalt/media/decoder_buffer_allocator.cc index eb3607ef7551..021cf728e912 100644 --- a/cobalt/media/decoder_buffer_allocator.cc +++ b/cobalt/media/decoder_buffer_allocator.cc @@ -23,7 +23,6 @@ #include "starboard/common/allocator.h" #include "starboard/configuration.h" #include "starboard/media.h" -#include "starboard/memory.h" namespace cobalt { namespace media { diff --git a/cobalt/media/progressive/avc_parser.cc b/cobalt/media/progressive/avc_parser.cc index e5e7c527d127..4565ad4e6e52 100644 --- a/cobalt/media/progressive/avc_parser.cc +++ b/cobalt/media/progressive/avc_parser.cc @@ -31,7 +31,6 @@ #include "media/base/video_transformation.h" #include "media/base/video_types.h" #include "media/formats/mp4/aac.h" -#include "starboard/memory.h" namespace cobalt { namespace media { diff --git a/cobalt/media/progressive/mp4_map_unittest.cc b/cobalt/media/progressive/mp4_map_unittest.cc index 14bf9937b895..38cf9ebc694e 100644 --- a/cobalt/media/progressive/mp4_map_unittest.cc +++ b/cobalt/media/progressive/mp4_map_unittest.cc @@ -25,7 +25,6 @@ #include "cobalt/media/base/endian_util.h" #include "cobalt/media/progressive/mock_data_source_reader.h" #include "cobalt/media/progressive/mp4_parser.h" -#include "starboard/memory.h" #include "starboard/types.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/cobalt/media/sandbox/BUILD.gn b/cobalt/media/sandbox/BUILD.gn index 79505f67123a..843c4eaa91c3 100644 --- a/cobalt/media/sandbox/BUILD.gn +++ b/cobalt/media/sandbox/BUILD.gn @@ -60,6 +60,7 @@ target(final_executable_type, "web_media_player_sandbox") { "//cobalt/trace_event", "//media", "//starboard:starboard_group", + "//starboard/common", "//ui/gfx:gfx", "//url", ] diff --git a/cobalt/media/sandbox/format_guesstimator.cc b/cobalt/media/sandbox/format_guesstimator.cc index e34c7643b127..ad598495561b 100644 --- a/cobalt/media/sandbox/format_guesstimator.cc +++ b/cobalt/media/sandbox/format_guesstimator.cc @@ -38,7 +38,6 @@ #include "net/base/filename_util.h" #include "net/base/url_util.h" #include "starboard/common/file.h" -#include "starboard/memory.h" #include "starboard/types.h" #include "ui/gfx/geometry/size.h" diff --git a/cobalt/media/sandbox/media_source_demuxer.cc b/cobalt/media/sandbox/media_source_demuxer.cc index 2c523cb7892f..8767a5946171 100644 --- a/cobalt/media/sandbox/media_source_demuxer.cc +++ b/cobalt/media/sandbox/media_source_demuxer.cc @@ -28,7 +28,6 @@ #include "cobalt/media/base/demuxer.h" #include "cobalt/media/base/pipeline_status.h" #include "cobalt/media/filters/chunk_demuxer.h" -#include "starboard/memory.h" namespace cobalt { namespace media { diff --git a/cobalt/media/sandbox/raw_video_decoder_fuzzer.cc b/cobalt/media/sandbox/raw_video_decoder_fuzzer.cc index 40cf996a2e22..e2034e68612d 100644 --- a/cobalt/media/sandbox/raw_video_decoder_fuzzer.cc +++ b/cobalt/media/sandbox/raw_video_decoder_fuzzer.cc @@ -26,7 +26,6 @@ #include "cobalt/media/sandbox/media_sandbox.h" #include "cobalt/media/sandbox/media_source_demuxer.h" #include "cobalt/media/sandbox/zzuf_fuzzer.h" -#include "starboard/memory.h" namespace cobalt { namespace media { diff --git a/cobalt/network/custom/url_request_simple_job.cc b/cobalt/network/custom/url_request_simple_job.cc index e8839ca3e67c..791bd845a4f7 100644 --- a/cobalt/network/custom/url_request_simple_job.cc +++ b/cobalt/network/custom/url_request_simple_job.cc @@ -35,7 +35,6 @@ #include "net/base/net_errors.h" #include "net/http/http_request_headers.h" #include "net/http/http_util.h" -#include "starboard/memory.h" namespace net { diff --git a/cobalt/network/local_network_test.cc b/cobalt/network/local_network_test.cc index e0f604a008ed..88d475b7c4b4 100644 --- a/cobalt/network/local_network_test.cc +++ b/cobalt/network/local_network_test.cc @@ -43,8 +43,6 @@ TEST(IsPrivateRange, v4) { EXPECT_FALSE(IsIPInPrivateRange(ParseSocketAddress("239.255.255.255"))); } -#if SB_HAS(IPV6) - TEST(IsPrivateRange, v6) { EXPECT_TRUE(IsIPInPrivateRange(ParseSocketAddress("[fd00::]"))); EXPECT_TRUE(IsIPInPrivateRange(ParseSocketAddress("[fd00:1:2:3:4:5::]"))); @@ -53,7 +51,5 @@ TEST(IsPrivateRange, v6) { ParseSocketAddress("[2606:2800:220:1:248:1893:25c8:1946]"))); } -#endif // SB_HAS(IPV6) - } // namespace network } // namespace cobalt diff --git a/cobalt/network/network_module.cc b/cobalt/network/network_module.cc index 8954d43c3fe1..5a41e7fa8044 100644 --- a/cobalt/network/network_module.cc +++ b/cobalt/network/network_module.cc @@ -19,6 +19,7 @@ #include "base/bind.h" #include "base/command_line.h" #include "base/json/json_reader.h" +#include "base/json/json_writer.h" #include "base/logging.h" #include "base/path_service.h" #include "base/strings/string_number_conversions.h" @@ -161,8 +162,52 @@ void NetworkModule::SetEnableHttp3FromPersistentSettings() { } } -void NetworkModule::SetProtocolFilterUpdatePending() { +bool NetworkModule::SetHttpProtocolFilterPersistentSetting( + const std::string& raw_json) { + base::Value old_config_json; + options_.persistent_settings->Get(network::kProtocolFilterKey, + &old_config_json); + + if (raw_json.empty()) { + if (old_config_json.is_none()) { + return false; + } + options_.persistent_settings->Set(network::kProtocolFilterKey, + base::Value()); + protocol_filter_update_pending_ = true; + return true; + } + + absl::optional old_config; + if (old_config_json.is_string()) { + old_config = base::JSONReader::Read(old_config_json.GetString()); + } + absl::optional raw_config = base::JSONReader::Read(raw_json); + if (!raw_config) return false; + base::Value::List new_config; + if (!raw_config->is_list()) return false; + for (auto& filter_value : raw_config->GetList()) { + if (!filter_value.is_dict()) continue; + const auto& dict = filter_value.GetDict(); + const base::Value* origin = dict.Find("origin"); + const base::Value* alt_svc = dict.Find("altSvc"); + if (!origin || !alt_svc) continue; + if (!origin->is_string() || !alt_svc->is_string()) continue; + base::Value::Dict dest_dict; + dest_dict.Set("origin", origin->GetString()); + dest_dict.Set("altSvc", alt_svc->GetString()); + new_config.Append(std::move(dest_dict)); + } + if (new_config.empty()) return false; + if (old_config && old_config->is_list() && + old_config->GetList() == new_config) + return false; + absl::optional json = base::WriteJson(new_config); + if (!json) return false; + options_.persistent_settings->Set(network::kProtocolFilterKey, + base::Value(*json)); protocol_filter_update_pending_ = true; + return true; } void NetworkModule::SetProtocolFilterFromPersistentSettings() { diff --git a/cobalt/network/network_module.h b/cobalt/network/network_module.h index 436d69c95958..9ddd9bb50447 100644 --- a/cobalt/network/network_module.h +++ b/cobalt/network/network_module.h @@ -61,7 +61,7 @@ constexpr int32_t kEnabledClientHintHeaders = (kCallTypeLoader | kCallTypeXHR); const char kQuicEnabledPersistentSettingsKey[] = "QUICEnabled"; const char kHttp2EnabledPersistentSettingsKey[] = "HTTP2Enabled"; const char kHttp3EnabledPersistentSettingsKey[] = "HTTP3Enabled"; -const char kProtocolFilterKey[] = "protocolfilter"; +const char kProtocolFilterKey[] = "httpProtocolFilter"; class NetworkSystem; // NetworkModule wraps various networking-related components such as @@ -134,7 +134,7 @@ class NetworkModule : public base::CurrentThread::DestructionObserver { void SetEnableQuicFromPersistentSettings(); void SetEnableHttp2FromPersistentSettings(); void SetEnableHttp3FromPersistentSettings(); - void SetProtocolFilterUpdatePending(); + bool SetHttpProtocolFilterPersistentSetting(const std::string&); void SetProtocolFilterFromPersistentSettings(); // Adds the Client Hint Headers to the provided URLFetcher if enabled. diff --git a/cobalt/network/socket_address_parser.cc b/cobalt/network/socket_address_parser.cc index ddfa3ca0f28b..c65a46b35103 100644 --- a/cobalt/network/socket_address_parser.cc +++ b/cobalt/network/socket_address_parser.cc @@ -17,7 +17,6 @@ #include "base/basictypes.h" #include "base/logging.h" #include "net/base/ip_address.h" -#include "starboard/memory.h" #include "url/third_party/mozilla/url_parse.h" #include "url/url_canon.h" #include "url/url_canon_ip.h" diff --git a/cobalt/overlay_info/overlay_info_registry_test.cc b/cobalt/overlay_info/overlay_info_registry_test.cc index 0b5d97ebad2b..797939df5a2e 100644 --- a/cobalt/overlay_info/overlay_info_registry_test.cc +++ b/cobalt/overlay_info/overlay_info_registry_test.cc @@ -21,7 +21,6 @@ #include "base/logging.h" #include "base/strings/string_split.h" -#include "starboard/memory.h" #include "starboard/types.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/cobalt/overlay_info/qr_code_overlay.cc b/cobalt/overlay_info/qr_code_overlay.cc index c3a4901b05e0..6f43eea4f59b 100644 --- a/cobalt/overlay_info/qr_code_overlay.cc +++ b/cobalt/overlay_info/qr_code_overlay.cc @@ -23,7 +23,6 @@ #include "base/trace_event/trace_event.h" #include "cobalt/overlay_info/overlay_info_registry.h" #include "cobalt/render_tree/animations/animate_node.h" -#include "starboard/memory.h" #include "third_party/QR-Code-generator/cpp/QrCode.hpp" namespace cobalt { diff --git a/cobalt/renderer/backend/egl/graphics_system.cc b/cobalt/renderer/backend/egl/graphics_system.cc index 664750c924b8..db1be3b300c6 100644 --- a/cobalt/renderer/backend/egl/graphics_system.cc +++ b/cobalt/renderer/backend/egl/graphics_system.cc @@ -18,19 +18,11 @@ #include #include "base/debug/leak_annotations.h" -#if defined(ENABLE_GLIMP_TRACING) -#include "base/trace_event/trace_event.h" -#endif - #include "cobalt/configuration/configuration.h" #include "cobalt/renderer/backend/egl/display.h" #include "cobalt/renderer/backend/egl/graphics_context.h" #include "cobalt/renderer/backend/egl/texture.h" #include "cobalt/renderer/backend/egl/utils.h" -#if defined(ENABLE_GLIMP_TRACING) -#include "internal/starboard/shared/glimp/tracing/tracing.h" -#endif - #include "cobalt/renderer/egl_and_gles.h" #if defined(GLES3_SUPPORTED) @@ -45,19 +37,6 @@ namespace cobalt { namespace renderer { namespace backend { -#if defined(ENABLE_GLIMP_TRACING) -// Hookup glimp tracing to Chromium's base trace_event tracing. -class GlimpToBaseTraceEventBridge : public glimp::TraceEventImpl { - public: - void BeginTrace(const char* name) override { - TRACE_EVENT_BEGIN0("glimp", name); - } - void EndTrace(const char* name) override { TRACE_EVENT_END0("glimp", name); } -}; - -GlimpToBaseTraceEventBridge s_glimp_to_base_trace_event_bridge; -#endif // #if defined(ENABLE_GLIMP_TRACING) - namespace { struct ChooseConfigResult { @@ -133,12 +112,6 @@ base::Optional ChooseConfig( GraphicsSystemEGL::GraphicsSystemEGL( system_window::SystemWindow* system_window) { -#if defined(ENABLE_GLIMP_TRACING) - // If glimp tracing is enabled, hook up glimp trace calls to Chromium's - // base trace_event calls. - glimp::SetTraceEventImplementation(&s_glimp_to_base_trace_event_bridge); -#endif // #if defined(ENABLE_GLIMP_TRACING) - display_ = EGL_CALL_SIMPLE(eglGetDisplay(EGL_DEFAULT_DISPLAY)); CHECK_NE(EGL_NO_DISPLAY, display_); CHECK_EQ(EGL_SUCCESS, EGL_CALL_SIMPLE(eglGetError())); diff --git a/cobalt/renderer/backend/egl/texture_data_cpu.cc b/cobalt/renderer/backend/egl/texture_data_cpu.cc index 7bf9189e3489..0ff4b2835617 100644 --- a/cobalt/renderer/backend/egl/texture_data_cpu.cc +++ b/cobalt/renderer/backend/egl/texture_data_cpu.cc @@ -21,7 +21,6 @@ #include "cobalt/renderer/backend/egl/utils.h" #include "cobalt/renderer/egl_and_gles.h" #include "starboard/configuration.h" -#include "starboard/memory.h" namespace cobalt { namespace renderer { diff --git a/cobalt/renderer/rasterizer/egl/draw_callback.cc b/cobalt/renderer/rasterizer/egl/draw_callback.cc index 0d3a26308865..6a9d3e2ce172 100644 --- a/cobalt/renderer/rasterizer/egl/draw_callback.cc +++ b/cobalt/renderer/rasterizer/egl/draw_callback.cc @@ -19,7 +19,6 @@ #include "cobalt/renderer/egl_and_gles.h" #include "egl/generated_shader_impl.h" #include "starboard/configuration.h" -#include "starboard/memory.h" namespace cobalt { namespace renderer { diff --git a/cobalt/renderer/rasterizer/egl/draw_poly_color.cc b/cobalt/renderer/rasterizer/egl/draw_poly_color.cc index 3276f0cb293d..ac0f1a860672 100644 --- a/cobalt/renderer/rasterizer/egl/draw_poly_color.cc +++ b/cobalt/renderer/rasterizer/egl/draw_poly_color.cc @@ -23,7 +23,6 @@ #include "cobalt/renderer/egl_and_gles.h" #include "egl/generated_shader_impl.h" #include "starboard/configuration.h" -#include "starboard/memory.h" namespace cobalt { namespace renderer { diff --git a/cobalt/renderer/rasterizer/egl/draw_rect_border.cc b/cobalt/renderer/rasterizer/egl/draw_rect_border.cc index 833c72928854..5209e6d2148e 100644 --- a/cobalt/renderer/rasterizer/egl/draw_rect_border.cc +++ b/cobalt/renderer/rasterizer/egl/draw_rect_border.cc @@ -22,7 +22,6 @@ #include "cobalt/renderer/rasterizer/common/utils.h" #include "egl/generated_shader_impl.h" #include "starboard/configuration.h" -#include "starboard/memory.h" namespace cobalt { namespace renderer { diff --git a/cobalt/renderer/rasterizer/egl/draw_rect_color_texture.cc b/cobalt/renderer/rasterizer/egl/draw_rect_color_texture.cc index af1f1395a844..6221e4f7aefb 100644 --- a/cobalt/renderer/rasterizer/egl/draw_rect_color_texture.cc +++ b/cobalt/renderer/rasterizer/egl/draw_rect_color_texture.cc @@ -18,7 +18,6 @@ #include "cobalt/renderer/backend/egl/utils.h" #include "cobalt/renderer/egl_and_gles.h" #include "starboard/configuration.h" -#include "starboard/memory.h" namespace cobalt { namespace renderer { diff --git a/cobalt/renderer/rasterizer/egl/draw_rect_linear_gradient.cc b/cobalt/renderer/rasterizer/egl/draw_rect_linear_gradient.cc index ab50f8dff066..dffa781bb7b9 100644 --- a/cobalt/renderer/rasterizer/egl/draw_rect_linear_gradient.cc +++ b/cobalt/renderer/rasterizer/egl/draw_rect_linear_gradient.cc @@ -21,7 +21,6 @@ #include "cobalt/renderer/egl_and_gles.h" #include "egl/generated_shader_impl.h" #include "starboard/configuration.h" -#include "starboard/memory.h" namespace cobalt { namespace renderer { diff --git a/cobalt/renderer/rasterizer/egl/draw_rect_radial_gradient.cc b/cobalt/renderer/rasterizer/egl/draw_rect_radial_gradient.cc index cf63e70ef61a..8cfdd763f2d4 100644 --- a/cobalt/renderer/rasterizer/egl/draw_rect_radial_gradient.cc +++ b/cobalt/renderer/rasterizer/egl/draw_rect_radial_gradient.cc @@ -21,7 +21,6 @@ #include "cobalt/renderer/egl_and_gles.h" #include "egl/generated_shader_impl.h" #include "starboard/configuration.h" -#include "starboard/memory.h" namespace cobalt { namespace renderer { diff --git a/cobalt/renderer/rasterizer/egl/draw_rect_shadow_blur.cc b/cobalt/renderer/rasterizer/egl/draw_rect_shadow_blur.cc index 03d51155a98e..6e157e228fef 100644 --- a/cobalt/renderer/rasterizer/egl/draw_rect_shadow_blur.cc +++ b/cobalt/renderer/rasterizer/egl/draw_rect_shadow_blur.cc @@ -21,7 +21,6 @@ #include "cobalt/renderer/backend/egl/utils.h" #include "cobalt/renderer/egl_and_gles.h" #include "starboard/configuration.h" -#include "starboard/memory.h" namespace cobalt { namespace renderer { diff --git a/cobalt/renderer/rasterizer/egl/draw_rect_shadow_spread.cc b/cobalt/renderer/rasterizer/egl/draw_rect_shadow_spread.cc index ce841f5656dc..cf465984d089 100644 --- a/cobalt/renderer/rasterizer/egl/draw_rect_shadow_spread.cc +++ b/cobalt/renderer/rasterizer/egl/draw_rect_shadow_spread.cc @@ -20,7 +20,6 @@ #include "cobalt/renderer/backend/egl/utils.h" #include "cobalt/renderer/egl_and_gles.h" #include "starboard/configuration.h" -#include "starboard/memory.h" namespace cobalt { namespace renderer { diff --git a/cobalt/renderer/rasterizer/egl/draw_rect_texture.cc b/cobalt/renderer/rasterizer/egl/draw_rect_texture.cc index 93feafdb5d5d..4f8146a79ff0 100644 --- a/cobalt/renderer/rasterizer/egl/draw_rect_texture.cc +++ b/cobalt/renderer/rasterizer/egl/draw_rect_texture.cc @@ -18,7 +18,6 @@ #include "cobalt/renderer/backend/egl/utils.h" #include "cobalt/renderer/egl_and_gles.h" #include "starboard/configuration.h" -#include "starboard/memory.h" namespace cobalt { namespace renderer { diff --git a/cobalt/renderer/rasterizer/egl/draw_rrect_color.cc b/cobalt/renderer/rasterizer/egl/draw_rrect_color.cc index fe8804c7602c..aab7bd253f31 100644 --- a/cobalt/renderer/rasterizer/egl/draw_rrect_color.cc +++ b/cobalt/renderer/rasterizer/egl/draw_rrect_color.cc @@ -18,7 +18,6 @@ #include "cobalt/renderer/egl_and_gles.h" #include "egl/generated_shader_impl.h" #include "starboard/configuration.h" -#include "starboard/memory.h" namespace cobalt { namespace renderer { diff --git a/cobalt/renderer/rasterizer/egl/draw_rrect_color_texture.cc b/cobalt/renderer/rasterizer/egl/draw_rrect_color_texture.cc index 95fdbe5d397f..d000b343ede4 100644 --- a/cobalt/renderer/rasterizer/egl/draw_rrect_color_texture.cc +++ b/cobalt/renderer/rasterizer/egl/draw_rrect_color_texture.cc @@ -18,7 +18,6 @@ #include "cobalt/renderer/backend/egl/utils.h" #include "cobalt/renderer/egl_and_gles.h" #include "starboard/configuration.h" -#include "starboard/memory.h" namespace cobalt { namespace renderer { diff --git a/cobalt/renderer/rasterizer/egl/graphics_state.cc b/cobalt/renderer/rasterizer/egl/graphics_state.cc index 3096deb6ffbc..050871607319 100644 --- a/cobalt/renderer/rasterizer/egl/graphics_state.cc +++ b/cobalt/renderer/rasterizer/egl/graphics_state.cc @@ -18,7 +18,6 @@ #include "cobalt/renderer/backend/egl/utils.h" #include "starboard/configuration.h" -#include "starboard/memory.h" namespace cobalt { namespace renderer { diff --git a/cobalt/renderer/rasterizer/skia/skia/config/SkUserConfig.h b/cobalt/renderer/rasterizer/skia/skia/config/SkUserConfig.h index 7655d1dbce31..8f1706143aab 100644 --- a/cobalt/renderer/rasterizer/skia/skia/config/SkUserConfig.h +++ b/cobalt/renderer/rasterizer/skia/skia/config/SkUserConfig.h @@ -110,41 +110,6 @@ // would like these formats to match. // Always use OpenGL byte-order (RGBA). -#if defined(STARBOARD) -const uint8_t r32_or_bendian_a32_shift = - kSbPreferredRgbaByteOrder == SB_PREFERRED_RGBA_BYTE_ORDER_BGRA ? 16 : 0; - -#ifdef SK_CPU_BENDIAN -#define SK_R32_SHIFT 24 -#define SK_G32_SHIFT (16 - r32_or_bendian_a32_shift) -#define SK_B32_SHIFT 8 -#define SK_A32_SHIFT r32_or_bendian_a32_shift -#else -#define SK_R32_SHIFT r32_or_bendian_a32_shift -#define SK_G32_SHIFT 8 -#define SK_B32_SHIFT (16 - r32_or_bendian_a32_shift) -#define SK_A32_SHIFT 24 -#endif - -#elif defined(STARBOARD) && \ - kSbPreferredRgbaByteOrder == SB_PREFERRED_RGBA_BYTE_ORDER_BGRA -#ifdef SK_CPU_BENDIAN -#define SK_R32_SHIFT 24 -#define SK_G32_SHIFT 0 -#define SK_B32_SHIFT 8 -#define SK_A32_SHIFT 16 -#else -#define SK_R32_SHIFT 16 -#define SK_G32_SHIFT 8 -#define SK_B32_SHIFT 0 -#define SK_A32_SHIFT 24 -#endif - -#else - -// Default to RGBA otherwise. Skia only supports either BGRA or RGBA, so if -// kSbPreferredRgbaByteOrder is neither, we default it to RGBA and we will -// have to do color conversions at runtime. #ifdef SK_CPU_BENDIAN #define SK_R32_SHIFT 24 #define SK_G32_SHIFT 16 @@ -157,8 +122,6 @@ const uint8_t r32_or_bendian_a32_shift = #define SK_A32_SHIFT 24 #endif -#endif - /* Some compilers don't support long long for 64bit integers. If yours does not, define this to the appropriate type. */ diff --git a/cobalt/renderer/rasterizer/skia/skia/src/ports/SkMemory_starboard.cc b/cobalt/renderer/rasterizer/skia/skia/src/ports/SkMemory_starboard.cc index cc99cf00c638..2da1ca3d8466 100644 --- a/cobalt/renderer/rasterizer/skia/skia/src/ports/SkMemory_starboard.cc +++ b/cobalt/renderer/rasterizer/skia/skia/src/ports/SkMemory_starboard.cc @@ -15,7 +15,6 @@ #include #include "SkMalloc.h" -#include "starboard/memory.h" #include "starboard/system.h" #define SK_DEBUGFAILF(fmt, ...) \ diff --git a/cobalt/renderer/test/jpeg_utils/jpeg_encode.cc b/cobalt/renderer/test/jpeg_utils/jpeg_encode.cc index e44ba9114e2d..37a1f33aee17 100644 --- a/cobalt/renderer/test/jpeg_utils/jpeg_encode.cc +++ b/cobalt/renderer/test/jpeg_utils/jpeg_encode.cc @@ -20,7 +20,6 @@ #include #include "base/trace_event/trace_event.h" -#include "starboard/memory.h" #include "third_party/libjpeg_turbo/turbojpeg.h" namespace cobalt { diff --git a/cobalt/script/v8c/isolate_fellowship.cc b/cobalt/script/v8c/isolate_fellowship.cc index 4abfcacbc662..52305c31e790 100644 --- a/cobalt/script/v8c/isolate_fellowship.cc +++ b/cobalt/script/v8c/isolate_fellowship.cc @@ -26,7 +26,6 @@ #include "cobalt/script/v8c/switches.h" #include "cobalt/script/v8c/v8c_tracing_controller.h" #include "starboard/configuration_constants.h" -#include "starboard/memory.h" namespace cobalt { namespace script { diff --git a/cobalt/script/v8c/v8c_array_buffer.cc b/cobalt/script/v8c/v8c_array_buffer.cc index c8a536ec5997..bf11b88a3c6f 100644 --- a/cobalt/script/v8c/v8c_array_buffer.cc +++ b/cobalt/script/v8c/v8c_array_buffer.cc @@ -17,7 +17,6 @@ #include #include "cobalt/base/polymorphic_downcast.h" -#include "starboard/memory.h" namespace cobalt { namespace script { diff --git a/cobalt/site/docker/Dockerfile b/cobalt/site/docker/Dockerfile index 1acba94d9995..90bd6358e18d 100644 --- a/cobalt/site/docker/Dockerfile +++ b/cobalt/site/docker/Dockerfile @@ -13,7 +13,7 @@ # limitations under the License. ARG FROM_IMAGE -FROM ${FROM_IMAGE:-gcr.io/cloud-marketplace-containers/google/debian11} +FROM ${FROM_IMAGE:-marketplace.gcr.io/google/debian11:latest} RUN apt update -qqy \ && apt install -qqy --no-install-recommends \ diff --git a/cobalt/site/docs/development/setup-android.md b/cobalt/site/docs/development/setup-android.md index 01b8fc68b6a1..518404b85b46 100644 --- a/cobalt/site/docs/development/setup-android.md +++ b/cobalt/site/docs/development/setup-android.md @@ -39,8 +39,6 @@ return and complete the following steps. ./starboard/tools/download_clang.sh ./starboard/android/shared/download_sdk.sh ``` - If you encountered `Failed to find package patcher;v4` error, please edit starboard/android/shared/download_sdk.sh - and remove `"patcher;v4" \ ` near line 53. 1. Install additional Linux packages @@ -276,6 +274,23 @@ Similar to loader_app, create the directory with arguments that meet the target adb shell "am start --esa args '--evergreen_library=app/cobalt/lib/libnplb.so,--evergreen_content=app/cobalt/content' dev.cobalt.coat" ``` +1. Generate test result with XML format + + Due to access permission constrains on AOSP, the xml file should be created + by `adb shell` first, before nplb apk writing test result in it. + + ```sh + # create a file in a folder with read/write permission + adb shell "mkdir -p /data/local/tmp/" + adb shell "touch /data/local/tmp/nplb_testResult.xml" + + # Make the file writable + adb shell "chmod a+w /data/local/tmp/nplb_testResult.xml" + + # test and output to xml file + adb shell "am start --esa args '--evergreen_library=app/cobalt/lib/libnplb.so,--evergreen_content=app/cobalt/content,--gtest_output=xml:/data/local/tmp/nplb_testResult.xml' dev.cobalt.coat" + ``` + ### Build and run nplb evergreen compat test apk 1. Build nplb_evergreen_compat_tests apk diff --git a/cobalt/site/docs/development/setup-linux.md b/cobalt/site/docs/development/setup-linux.md index 889c4d079677..0d613125ad41 100644 --- a/cobalt/site/docs/development/setup-linux.md +++ b/cobalt/site/docs/development/setup-linux.md @@ -17,35 +17,35 @@ Required libraries can differ depending on your Linux distribution and version. 1. Run the following command to install packages needed to build and run Cobalt on Linux: - ``` - $ sudo apt update && sudo apt install -qqy --no-install-recommends \ - bison clang libasound2-dev libgles2-mesa-dev libglib2.0-dev \ - libxcomposite-dev libxi-dev libxrender-dev nasm ninja-build \ - python3.8-venv + ```sh + sudo apt update && sudo apt install -qqy --no-install-recommends \ + bison clang libasound2-dev libgles2-mesa-dev libglib2.0-dev \ + libxcomposite-dev libxi-dev libxrender-dev nasm ninja-build \ + python3-venv ``` 1. Install ccache to support build acceleration. Build acceleration is \ enabled by default and must be disabled if ccache is not installed. - ``` - $ sudo apt install -qqy --no-install-recommends ccache + ```sh + sudo apt install -qqy --no-install-recommends ccache ``` We recommend adjusting the cache size as needed to increase cache hits: - ``` - $ ccache --max-size=20G + ```sh + ccache --max-size=20G ``` 1. Install Node.js via `nvm`: - ``` - $ export NVM_DIR=~/.nvm - $ export NODE_VERSION=12.17.0 + ```sh + export NVM_DIR=~/.nvm + export NODE_VERSION=12.17.0 - $ curl --silent -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash + curl --silent -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash - $ . $NVM_DIR/nvm.sh \ + . $NVM_DIR/nvm.sh \ && nvm install --lts \ && nvm alias default lts/* \ && nvm use default @@ -58,8 +58,8 @@ Required libraries can differ depending on your Linux distribution and version. 1. Clone the Cobalt code repository. The following `git` command creates a `cobalt` directory that contains the repository: - ``` - $ git clone https://github.com/youtube/cobalt.git + ```sh + git clone https://github.com/youtube/cobalt.git ``` 1. Set `PYTHONPATH` environment variable to include the full path to the @@ -67,7 +67,7 @@ Required libraries can differ depending on your Linux distribution and version. the end of your ~/.bash_profile (replacing `fullpathto` with the actual path where you cloned the repo): - ``` + ```sh export PYTHONPATH="/fullpathto/cobalt:${PYTHONPATH}" ``` @@ -78,8 +78,10 @@ Required libraries can differ depending on your Linux distribution and version. 1. Enter your new `cobalt` directory: - ``` - $ cd cobalt + ```sh + cd cobalt + export COBALT_SRC=${PWD} + export PYTHONPATH=${PWD}:${PYTHONPATH} ```