Skip to content

Commit

Permalink
Merge branch 'main' into debug
Browse files Browse the repository at this point in the history
  • Loading branch information
imindich authored Dec 23, 2024
2 parents 0d2dd06 + b7b2d76 commit 46fc10c
Show file tree
Hide file tree
Showing 27 changed files with 527 additions and 34 deletions.
17 changes: 12 additions & 5 deletions .github/actions/on_host_tests/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ runs:
env
# Explicitly point to libraries in extracted dir.
LD_LIBRARY_PATH="${test_dir}/out/${{ matrix.platform }}_${{ matrix.config }}/starboard"
LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${test_dir}/out/${{ matrix.platform }}_${{ matrix.config }}"
LD_LIBRARY_PATH="${test_dir}/starboard"
LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${test_dir}"
export LD_LIBRARY_PATH
# Make results dir available to the archiving step below.
results_dir="${GITHUB_WORKSPACE}/results"
echo "results_dir=${results_dir}" >> $GITHUB_ENV
failed_suites=""
cd ${test_dir}
for test_binary_path in $(ls -d out/**/*tests out/**/nplb); do
test_binary=$(basename "${test_binary_path}")
for test_binary in $(ls {*tests,nplb}); do
echo "Running tests for suite: ${test_binary}"
test_filter="*"
Expand All @@ -57,9 +57,16 @@ runs:
echo "Test filter evaluated to: ${test_filter}"
xml_path="${results_dir}/${test_binary}_testoutput.xml"
/usr/bin/xvfb-run -a --server-args="${XVFB_SERVER_ARGS}" ./$test_binary_path --gtest_filter="${test_filter}" --gtest_output="xml:${xml_path}"
/usr/bin/xvfb-run -a --server-args="${XVFB_SERVER_ARGS}" "./${test_binary}" --gtest_filter="${test_filter}" --gtest_output="xml:${xml_path}" || {
# Set exit code on failure.
failed_suites="${failed_suites} ${test_binary}"
}
done
echo "Finished running all unit tests..."
if [ -n "${failed_suites}" ]; then
echo "Test suites failed:${failed_suites}"
exit 1
fi
- name: Archive Test Results
if: success() || failure()
uses: actions/upload-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/process_test_results/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ inputs:
runs:
using: "composite"
steps:
- name: Download Artifacts
- name: Download Test Results
uses: actions/download-artifact@v4
with:
name: ${{ inputs.test_results_key }}
Expand Down
13 changes: 10 additions & 3 deletions .github/actions/upload_test_artifacts/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,20 @@ runs:
if: inputs.on_host == 'true'
run: |
set -x
cd src
tar cvf - out/${{ matrix.platform }}_${{ matrix.config }}/*tests out/${{ matrix.platform }}_${{ matrix.config }}/nplb out/${{ matrix.platform }}_${{ matrix.config }}/*.so out/${{ matrix.platform }}_${{ matrix.config }}/*.so.* out/${{ matrix.platform }}_${{ matrix.config }}/starboard/*.so.* out/${{ matrix.platform }}_${{ matrix.config }}/content/test | xz -T0 -1 -z - > test_artifacts.tar.xz
cd src/out/${{ matrix.platform }}_${{ matrix.config }}
test_deps_file="test.deps"
for test_binary in $(ls {nplb,*tests}); do
echo $test_binary
if [ -f "${test_binary}.runtime_deps" ]; then
cat "${test_binary}.runtime_deps" >> "${test_deps_file}"
fi
done
tar cvf - -T "${test_deps_file}" | xz -T0 -1 -z - > "${GITHUB_WORKSPACE}/test_artifacts.tar.xz"
shell: bash
- name: Upload On-Host Test Artifacts Archive
if: inputs.on_host == 'true'
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.test_artifacts_key }}
path: src/test_artifacts.tar.xz
path: test_artifacts.tar.xz
retention-days: 3
4 changes: 2 additions & 2 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,15 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
# TODO(bug?): android debug builds are broken.
if: ${{ ! (startsWith(matrix.platform, 'android') && matrix.config == 'debug') }}
if: ${{ ! (contains(matrix.platform, 'android') && matrix.config == 'debug') }}
with:
path: src
# Use fetch depth of 0 to get full history for a valid build id.
fetch-depth: 0
- name: Build Cobalt
uses: ./src/.github/actions/build
# TODO(bug?): android debug builds are broken.
if: ${{ ! (startsWith(matrix.platform, 'android') && matrix.config == 'debug') }}
if: ${{ ! (contains(matrix.platform, 'android') && matrix.config == 'debug') }}
with:
targets: ${{ needs.initialize.outputs.targets }}
- name: Upload Test Artifacts
Expand Down
3 changes: 1 addition & 2 deletions cobalt/build/gn.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ def get_build_args(build_args_path):
},
'qa': {
'symbol_level': 1,
'is_debug': 'false',
'is_official_build': 'true'
'is_debug': 'false'
},
'gold': {
'symbol_level': 0,
Expand Down
21 changes: 3 additions & 18 deletions cobalt/devinfra/kokoro/bin/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -265,19 +265,9 @@ create_and_upload_nightly_archive () {
fi
local gcs_archive_path="gs://$(get_bucket_name)/${platform}${gcs_path_suffix}/$(date +%F)/${KOKORO_ROOT_BUILD_NUMBER}/"

# Creates nightly archive from package directory.
python3 "${WORKSPACE_COBALT}/tools/create_archive.py" \
-s "${package_dir}" \
-d "${local_archive_path}" \
--intermediate

init_gcloud

# Uploads nightly archive.
"${GSUTIL}" cp "${local_archive_path}" "${gcs_archive_path}"

# Uploads build_info.json.
"${GSUTIL}" cp "${build_info_path}" "${gcs_archive_path}"
"${GSUTIL}" cp -r "${package_dir}" "${gcs_archive_path}"
}

run_package_release_pipeline () {
Expand All @@ -300,11 +290,7 @@ run_package_release_pipeline () {

# Create release package.
if [[ "${PLATFORM}" =~ "android" ]]; then
# Creates Android package directory.
python3 "${WORKSPACE_COBALT}/cobalt/devinfra/kokoro/build/android/simple_packager.py" \
"${out_dir}" \
"${package_dir}" \
"${WORKSPACE_COBALT}"
cp "${out_dir}/apks/Cobalt.apk" "${package_dir}"
elif [[ "${PLATFORM}" =~ "evergreen" ]]; then
local bootloader_out_dir=
if [ -n "${BOOTLOADER:-}" ]; then
Expand All @@ -316,8 +302,7 @@ run_package_release_pipeline () {
"${package_dir}" \
"${bootloader_out_dir:-}"
else
# Sets package directory as out directory.
package_dir="${out_dir}"
cp "${out_dir}/cobalt" "${package_dir}"
fi

# Create and upload nightly archive.
Expand Down
7 changes: 7 additions & 0 deletions content/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -2321,6 +2321,13 @@ source_set("browser") {
"worker_host/worker_script_loader_factory.h",
]

if (is_cobalt) {
sources += [
"cobalt/crash_annotator/crash_annotator_impl.cc",
"cobalt/crash_annotator/crash_annotator_impl.h",
]
}

if (use_starscan) {
sources += [
"starscan_load_observer.cc",
Expand Down
10 changes: 10 additions & 0 deletions content/browser/browser_interface_binders.cc
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@
#include "third_party/blink/public/public_buildflags.h"
#include "url/origin.h"

#if BUILDFLAG(IS_COBALT)
#include "content/browser/cobalt/crash_annotator/crash_annotator_impl.h"
#include "third_party/blink/public/mojom/cobalt/crash_annotator/crash_annotator.mojom.h"
#endif

#if BUILDFLAG(IS_ANDROID)
#include "content/browser/android/date_time_chooser_android.h"
#include "content/browser/android/text_suggestion_host_android.h"
Expand Down Expand Up @@ -841,6 +846,11 @@ void PopulateFrameBinders(RenderFrameHostImpl* host, mojo::BinderMap* map) {
map->Add<blink::mojom::SpeechSynthesis>(base::BindRepeating(
&RenderFrameHostImpl::GetSpeechSynthesis, base::Unretained(host)));

#if BUILDFLAG(IS_COBALT)
map->Add<blink::mojom::CrashAnnotator>(base::BindRepeating(
&RenderFrameHostImpl::GetCrashAnnotator, base::Unretained(host)));
#endif

#if !BUILDFLAG(IS_ANDROID)
map->Add<blink::mojom::DeviceAPIService>(base::BindRepeating(
&RenderFrameHostImpl::GetDeviceInfoService, base::Unretained(host)));
Expand Down
31 changes: 31 additions & 0 deletions content/browser/cobalt/crash_annotator/crash_annotator_impl.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright 2024 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.

#include "content/browser/cobalt/crash_annotator/crash_annotator_impl.h"

#include "base/functional/bind.h"
#include "base/functional/callback.h"

namespace content {

void CrashAnnotatorImpl::SetString(const std::string& key,
const std::string& value,
SetStringCallback callback) {
// TODO(cobalt, b/383301493): actually implement this.
LOG(INFO) << "CrashAnnotatorImpl::SetString key=" << key << " value="
<< value;
std::move(callback).Run(false);
}

} // namespace content
47 changes: 47 additions & 0 deletions content/browser/cobalt/crash_annotator/crash_annotator_impl.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Copyright 2024 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 CONTENT_BROWSER_CRASH_ANNOTATOR_IMPL_H_
#define CONTENT_BROWSER_CRASH_ANNOTATOR_IMPL_H_

#include <string>

#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "third_party/blink/public/mojom/cobalt/crash_annotator/crash_annotator.mojom.h"

namespace content {

// TODO(cobalt, b/383301493): consider another location for Cobalt's Mojo
// implementations, since they are not "core" services. mcasas@ suggested
// //components or //services as possible destinations.
class CrashAnnotatorImpl : public blink::mojom::CrashAnnotator {
public:
explicit CrashAnnotatorImpl(
mojo::PendingReceiver<blink::mojom::CrashAnnotator> receiver)
: receiver_(this, std::move(receiver)) {}
CrashAnnotatorImpl(const CrashAnnotatorImpl&) = delete;
CrashAnnotatorImpl& operator=(const CrashAnnotatorImpl&) = delete;

void SetString(const std::string& key,
const std::string& value,
SetStringCallback callback) override;

private:
mojo::Receiver<blink::mojom::CrashAnnotator> receiver_;
};

} // namespace content

#endif // CONTENT_BROWSER_CRASH_ANNOTATOR_IMPL_H_
11 changes: 11 additions & 0 deletions content/browser/renderer_host/render_frame_host_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,10 @@
#include "url/origin.h"
#include "url/url_constants.h"

#if BUILDFLAG(IS_COBALT)
#include "content/browser/cobalt/crash_annotator/crash_annotator_impl.h"
#endif

#if BUILDFLAG(IS_ANDROID)
#include "content/browser/android/content_url_loader_factory.h"
#include "content/browser/android/java_interfaces_impl.h"
Expand Down Expand Up @@ -11593,6 +11597,13 @@ void RenderFrameHostImpl::GetFileSystemManager(
storage_key(), std::move(receiver)));
}

#if BUILDFLAG(IS_COBALT)
void RenderFrameHostImpl::GetCrashAnnotator(
mojo::PendingReceiver<blink::mojom::CrashAnnotator> receiver) {
crash_annotator_ = std::make_unique<CrashAnnotatorImpl>(std::move(receiver));
}
#endif

void RenderFrameHostImpl::GetGeolocationService(
mojo::PendingReceiver<blink::mojom::GeolocationService> receiver) {
if (!geolocation_service_) {
Expand Down
17 changes: 17 additions & 0 deletions content/browser/renderer_host/render_frame_host_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@
#include "ui/gfx/geometry/rect.h"
#include "url/gurl.h"

#if BUILDFLAG(IS_COBALT)
#include "third_party/blink/public/mojom/cobalt/crash_annotator/crash_annotator.mojom-forward.h"
#include "third_party/blink/public/mojom/cobalt/crash_annotator/crash_annotator.mojom.h"
#endif

#if BUILDFLAG(IS_ANDROID)
#include "base/containers/id_map.h"
#include "services/device/public/mojom/nfc.mojom.h"
Expand Down Expand Up @@ -249,6 +254,9 @@ class DocumentServiceBase;
class AgentSchedulingGroupHost;
class BrowsingContextState;
class CodeCacheHostImpl;
#if BUILDFLAG(IS_COBALT)
class CrashAnnotatorImpl;
#endif
class CrossOriginEmbedderPolicyReporter;
class CrossOriginOpenerPolicyAccessReportManager;
class FeatureObserver;
Expand Down Expand Up @@ -1942,6 +1950,11 @@ class CONTENT_EXPORT RenderFrameHostImpl
void GetFileSystemAccessManager(
mojo::PendingReceiver<blink::mojom::FileSystemAccessManager> receiver);

#if BUILDFLAG(IS_COBALT)
void GetCrashAnnotator(
mojo::PendingReceiver<blink::mojom::CrashAnnotator> receiver);
#endif

#if !BUILDFLAG(IS_ANDROID)
void GetHidService(mojo::PendingReceiver<blink::mojom::HidService> receiver);

Expand Down Expand Up @@ -4492,6 +4505,10 @@ class CONTENT_EXPORT RenderFrameHostImpl
// Tracks the document policy which has been set on this frame.
std::unique_ptr<blink::DocumentPolicy> document_policy_;

#if BUILDFLAG(IS_COBALT)
std::unique_ptr<CrashAnnotatorImpl> crash_annotator_;
#endif

#if BUILDFLAG(IS_ANDROID)
// An InterfaceProvider for Java-implemented interfaces that are scoped to
// this RenderFrameHost. This provides access to interfaces implemented in
Expand Down
8 changes: 5 additions & 3 deletions media/starboard/starboard_renderer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -592,9 +592,11 @@ void StarboardRenderer::OnDemuxerStreamRead(
DCHECK(audio_read_in_progress_);
audio_read_in_progress_ = false;
for (const auto& buffer : buffers) {
last_audio_sample_interval_ =
buffer->timestamp() - timestamp_of_last_written_audio_;
timestamp_of_last_written_audio_ = buffer->timestamp();
if (!buffer->end_of_stream()) {
last_audio_sample_interval_ =
buffer->timestamp() - timestamp_of_last_written_audio_;
timestamp_of_last_written_audio_ = buffer->timestamp();
}
}
player_bridge_->WriteBuffers(DemuxerStream::AUDIO, buffers);
} else {
Expand Down
4 changes: 4 additions & 0 deletions third_party/blink/public/mojom/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,10 @@ mojom("mojom_platform") {
"worker/worker_options.mojom",
]

if (is_cobalt) {
sources += [ "cobalt/crash_annotator/crash_annotator.mojom" ]
}

if (is_android) {
sources += [ "input/synchronous_compositor.mojom" ]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright 2024 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.

module blink.mojom;

// The browser process must provide an implementation of this interface so that
// the renderer process can implement the CrashAnnotator Blink API.
interface CrashAnnotator {
// Recieves an annotation to set and responds with the result.
SetString(string key, string value) => (bool result);
};
7 changes: 7 additions & 0 deletions third_party/blink/renderer/bindings/generated_in_modules.gni
Original file line number Diff line number Diff line change
Expand Up @@ -2791,6 +2791,13 @@ generated_interface_sources_in_modules = [
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_webgl_sub_image.h",
]

if (is_cobalt) {
generated_interface_sources_in_modules += [
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_crash_annotator.cc",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_crash_annotator.h",
]
}

generated_namespace_sources_in_modules = [
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_css.cc",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_css.h",
Expand Down
Loading

0 comments on commit 46fc10c

Please sign in to comment.