Skip to content

Commit

Permalink
Merge branch 'main' into maxz-sb16-socket-ps5
Browse files Browse the repository at this point in the history
  • Loading branch information
maxz-lab committed Apr 16, 2024
2 parents a550c7c + 977f1d7 commit 37b3a56
Show file tree
Hide file tree
Showing 1,464 changed files with 3,715 additions and 3,705 deletions.
2 changes: 1 addition & 1 deletion .github/actions/docker/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ runs:
set -x
docker_tag="${{ steps.meta.outputs.tags }}"
docker_tag="${docker_tag%.1[+,-]}"
echo "DOCKER_TAG=${docker_tag}" >> $GITHUB_ENV
echo "DOCKER_TAG=${docker_tag}" | head -n 1 >> $GITHUB_ENV
shell: bash
# We need to set docker tag properly for pull requests. In those scenarios where no docker related files
# were changed we need to use an existing image (e.g. main). In cases where docker image is rebuilt we have
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/docker_win/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ runs:
set -x
docker_tag="${{ steps.meta.outputs.tags }}"
docker_tag="${docker_tag%.1[+,-]}"
echo "DOCKER_TAG=${docker_tag}" >> $GITHUB_ENV
echo "DOCKER_TAG=${docker_tag}" | head -n 1 >> $GITHUB_ENV
shell: bash
# We need to set docker tag properly for pull requests. In those scenarios where no docker related files
# were changed we need to use an existing image (e.g. main). In cases where docker image is rebuilt we have
Expand Down
42 changes: 0 additions & 42 deletions .github/config/evergreen-x86.json

This file was deleted.

10 changes: 10 additions & 0 deletions .github/workflows/android.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ jobs:
needs: [ android-arm, android-arm64, android-x86 ]
permissions:
actions: write
contents: write
steps:
- name: Download arm-gold apk
uses: actions/download-artifact@v4
Expand Down Expand Up @@ -96,3 +97,12 @@ jobs:
retention-days: 90
compression-level: 0 # We expect kept artifacts to be already compressed
if-no-files-found: error
- name: Make a release zip
run: zip -0 -r "Android APKs.zip" . -i '*.apk'
- name: Upload the APKs to a release
if: ${{ github.event_name == 'release' }}
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2.9.0
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: "Android APKs.zip"
overwrite: true
9 changes: 0 additions & 9 deletions .github/workflows/evergreen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,3 @@ jobs:
platform: evergreen-arm64
nightly: ${{ github.event.inputs.nightly }}
run_api_leak_detector: true
evergreen-x86:
uses: ./.github/workflows/main.yaml
permissions:
packages: write
pull-requests: write
with:
platform: evergreen-x86
nightly: ${{ github.event.inputs.nightly }}
run_api_leak_detector: true
2 changes: 1 addition & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ jobs:
run: |
set -u
echo $DOCKER_TAG
echo "docker_tag=$DOCKER_TAG" >> $GITHUB_ENV
echo "docker_tag=$DOCKER_TAG" | head -n 1 >> $GITHUB_ENV
outputs:
docker_tag: ${{env.docker_tag}}

Expand Down
9 changes: 5 additions & 4 deletions base/files/file_util_starboard.cc
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ bool AbsolutePath(FilePath* path) {
bool DeleteFile(const FilePath &path, bool recursive) {
AssertBlockingAllowed();
const char *path_str = path.value().c_str();

bool directory = SbDirectoryCanOpen(path_str);
struct stat info;
bool directory = stat(path_str, &info) == 0 && S_ISDIR(info.st_mode);
if (!recursive || !directory) {
return SbFileDelete(path_str);
}
Expand Down Expand Up @@ -344,9 +344,10 @@ bool CreateDirectoryAndGetError(const FilePath &full_path, File::Error* error) {
if (DirectoryExists(*i)) {
continue;
}


struct stat info;
if (mkdir(i->value().c_str(), 0700) != 0 &&
!SbDirectoryCanOpen(i->value().c_str())){
!(stat(i->value().c_str(), &info) == 0 && S_ISDIR(info.st_mode))){
if (error)
*error = File::OSErrorToFileError(SbSystemGetLastError());
return false;
Expand Down
4 changes: 3 additions & 1 deletion base/threading/platform_thread_starboard.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

#include "base/threading/platform_thread.h"

#include <sched.h>

#include "base/logging.h"
#include "base/threading/thread_id_name_manager.h"
#include "base/threading/thread_restrictions.h"
Expand Down Expand Up @@ -96,7 +98,7 @@ PlatformThreadHandle PlatformThread::CurrentHandle() {

// static
void PlatformThread::YieldCurrentThread() {
SbThreadYield();
sched_yield();
}

// static
Expand Down
1 change: 1 addition & 0 deletions cobalt/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ group("gn_all") {
"//cobalt/renderer/sandbox:scaling_text_sandbox",
"//cobalt/speech/sandbox:speech_sandbox",
"//cobalt/ui_navigation/scroll_engine:scroll_engine_tests",
"//cobalt/watchdog:watchdog_test",
"//cobalt/web:web_test",
"//cobalt/web_animations:web_animations_test",
"//cobalt/webdriver:webdriver_test",
Expand Down
4 changes: 3 additions & 1 deletion cobalt/browser/splash_screen_cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ bool CreateDirsForKey(const std::string& key) {
starboard::strlcat(path.data(),
key.substr(prev_found, found - prev_found).c_str(),
kSbFileMaxPath);
if (mkdir(path.data(), 0700) != 0 && !SbDirectoryCanOpen(path.data())) {
struct stat info;
if (mkdir(path.data(), 0700) != 0 &&
!(stat(path.data(), &info) == 0 && S_ISDIR(info.st_mode))) {
return false;
}
prev_found = found;
Expand Down
4 changes: 3 additions & 1 deletion cobalt/cache/memory_capped_directory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ bool MemoryCappedDirectory::FileInfo::OldestFirst::operator()(
// static
std::unique_ptr<MemoryCappedDirectory> MemoryCappedDirectory::Create(
const base::FilePath& directory_path, uint32_t max_size) {
struct stat info;
if (mkdir(directory_path.value().c_str(), 0700) != 0 &&
!SbDirectoryCanOpen(directory_path.value().c_str())) {
!(stat(directory_path.value().c_str(), &info) == 0 &&
S_ISDIR(info.st_mode))) {
return nullptr;
}
auto memory_capped_directory = std::unique_ptr<MemoryCappedDirectory>(
Expand Down
30 changes: 30 additions & 0 deletions cobalt/h5vcc/h5vcc_crash_log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -174,5 +174,35 @@ void H5vccCrashLog::SetPersistentSettingWatchdogCrash(bool can_trigger_crash) {
if (watchdog) watchdog->SetPersistentSettingWatchdogCrash(can_trigger_crash);
}

bool H5vccCrashLog::LogEvent(const std::string& event) {
watchdog::Watchdog* watchdog = watchdog::Watchdog::GetInstance();
if (!watchdog) {
return false;
}

return watchdog->LogEvent(event);
}

script::Sequence<std::string> H5vccCrashLog::GetLogTrace() {
watchdog::Watchdog* watchdog = watchdog::Watchdog::GetInstance();

script::Sequence<std::string> sequence;
if (watchdog) {
std::vector<std::string> logTrace = watchdog->GetLogTrace();
for (std::size_t i = 0; i < logTrace.size(); ++i) {
sequence.push_back(logTrace[i]);
}
}

return sequence;
}

void H5vccCrashLog::ClearLog() {
watchdog::Watchdog* watchdog = watchdog::Watchdog::GetInstance();
if (watchdog) {
watchdog->ClearLog();
}
}

} // namespace h5vcc
} // namespace cobalt
6 changes: 6 additions & 0 deletions cobalt/h5vcc/h5vcc_crash_log.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ class H5vccCrashLog : public script::Wrappable {

void SetPersistentSettingWatchdogCrash(bool can_trigger_crash);

bool LogEvent(const std::string& event);

script::Sequence<std::string> GetLogTrace();

void ClearLog();

DEFINE_WRAPPABLE_TYPE(H5vccCrashLog);

private:
Expand Down
15 changes: 15 additions & 0 deletions cobalt/h5vcc/h5vcc_crash_log.idl
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,19 @@ interface H5vccCrashLog {
// Sets a persistent Watchdog setting that determines whether or not a
// Watchdog violation will trigger a crash.
void setPersistentSettingWatchdogCrash(boolean can_trigger_crash);

// Appends a string event to a ring buffer. These log events can be appended
// from JS code. When watchdog violation is created, a snapshot of
// that buffer is attached to a violation. Identical sequential events
// are de-duplicated.
// Max event length is 256. Ring buffer size is 128.
boolean logEvent(DOMString event);

// Returns a snapshot (a "logTrace") of ring buffer of log events.
// This can be used to read a logTrace at arbitrary moment,
// without any violation.
sequence<DOMString> getLogTrace();

// Clears the ring buffer of log events.
void clearLog();
};
2 changes: 2 additions & 0 deletions cobalt/loader/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ target(gtest_target_type, "loader_test") {

sources = [
"blob_fetcher_test.cc",
"fetcher_cache_test.cc",
"fetcher_factory_test.cc",
"fetcher_test.h",
"file_fetcher_test.cc",
Expand All @@ -201,6 +202,7 @@ target(gtest_target_type, "loader_test") {
"//testing/gmock",
"//testing/gtest",
"//third_party/ots:ots",
"//url",
]

data_deps = [ ":copy_loader_test_data" ]
Expand Down
10 changes: 10 additions & 0 deletions cobalt/loader/fetcher_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ class FetcherCache : public base::RefCountedThreadSafe<FetcherCache> {
Loader::FetcherCreator GetFetcherCreator(
const GURL& url, const Loader::FetcherCreator& real_fetcher_creator);
void NotifyResourceRequested(const std::string& url);
size_t size() const {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
CHECK_EQ(thread_id_, SbThreadGetId());
return total_size_;
}
size_t capacity() const {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
CHECK_EQ(thread_id_, SbThreadGetId());
return capacity_;
}

// To signal the imminent destruction of this object. If everything is
// working as expected, there shouldn't be any other reference of this object,
Expand Down
Loading

0 comments on commit 37b3a56

Please sign in to comment.