Skip to content

Commit

Permalink
Merge branch '24.lts.1+' into 24.lts.1+-1402
Browse files Browse the repository at this point in the history
  • Loading branch information
osagie98 authored Nov 8, 2023
2 parents 7a85406 + 8cf8714 commit 1620dd8
Show file tree
Hide file tree
Showing 260 changed files with 6,033 additions and 2,321 deletions.
2 changes: 1 addition & 1 deletion .github/config/raspi-2-skia.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"platform":"raspi-2-skia",
"target_platform":"raspi-2-skia",
"target_cpu":"target_cpu=\\\"arm\\\"",
"extra_gn_arguments": "is_clang=false"
"extra_gn_arguments": "build_with_separate_cobalt_toolchain=true use_asan=false"
}
]
}
24 changes: 2 additions & 22 deletions .github/config/raspi-2.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
},
"platforms": [
"raspi-2",
"raspi-2-sbversion-13",
"raspi-2-sbversion-14",
"raspi-2-sbversion-15"
],
"includes": [
Expand All @@ -24,33 +22,15 @@
"platform":"raspi-2",
"target_platform":"raspi-2",
"target_cpu":"target_cpu=\\\"arm\\\"",
"extra_gn_arguments": "is_clang=false",
"dimension": "release_version=regex:10.*"
},
{
"name":"sbversion-13",
"platform":"raspi-2-sbversion-13",
"target_platform":"raspi-2",
"target_cpu":"target_cpu=\\\"arm\\\"",
"extra_gn_arguments":"is_clang=false",
"sb_api_version": "sb_api_version=13",
"dimension": "release_version=regex:10.*"
},
{
"name":"sbversion-14",
"platform":"raspi-2-sbversion-14",
"target_platform":"raspi-2",
"target_cpu":"target_cpu=\\\"arm\\\"",
"extra_gn_arguments":"is_clang=false",
"sb_api_version": "sb_api_version=14",
"extra_gn_arguments": "build_with_separate_cobalt_toolchain=true use_asan=false",
"dimension": "release_version=regex:10.*"
},
{
"name":"sbversion-15",
"platform":"raspi-2-sbversion-15",
"target_platform":"raspi-2",
"target_cpu":"target_cpu=\\\"arm\\\"",
"extra_gn_arguments":"is_clang=false",
"extra_gn_arguments": "build_with_separate_cobalt_toolchain=true use_asan=false",
"sb_api_version": "sb_api_version=15",
"dimension": "release_version=regex:10.*"
}
Expand Down
2 changes: 1 addition & 1 deletion base/android/jni_generator/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.jni.generator">

<uses-sdk android:minSdkVersion="24" android:targetSdkVersion="33" />
<uses-sdk android:minSdkVersion="24" android:targetSdkVersion="34" />
<application></application>

</manifest>
8 changes: 7 additions & 1 deletion base/logging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -478,9 +478,15 @@ SbLogPriority LogLevelToStarboardLogPriority(int level) {
case LOG_ERROR:
return kSbLogPriorityError;
case LOG_FATAL:
case LOG_VERBOSE:
return kSbLogPriorityFatal;
case LOG_VERBOSE:
default:
if (level <= LOG_VERBOSE) {
// Verbose level can be any negative integer, sanity check its range to
// filter out potential errors.
DCHECK_GE(level, -256);
return kSbLogPriorityInfo;
}
NOTREACHED() << "Unrecognized log level.";
return kSbLogPriorityInfo;
}
Expand Down
18 changes: 13 additions & 5 deletions cobalt/audio/audio_device.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ typedef media::AudioBus AudioBus;
namespace {
const int kRenderBufferSizeFrames = 1024;
const int kDefaultFramesPerChannel = 8 * kRenderBufferSizeFrames;

int AlignUp(int value, int alignment) {
int decremented_value = value - 1;
return decremented_value + alignment - (decremented_value % alignment);
}
} // namespace

class AudioDevice::Impl {
Expand Down Expand Up @@ -85,11 +90,13 @@ AudioDevice::Impl::Impl(int number_of_channels, RenderCallback* callback)
: number_of_channels_(number_of_channels),
output_sample_type_(GetPreferredOutputStarboardSampleType()),
render_callback_(callback),
frames_per_channel_(std::max(SbAudioSinkGetMinBufferSizeInFrames(
number_of_channels, output_sample_type_,
kStandardOutputSampleRate) +
kRenderBufferSizeFrames * 2,
kDefaultFramesPerChannel)),
frames_per_channel_(
std::max(AlignUp(SbAudioSinkGetMinBufferSizeInFrames(
number_of_channels, output_sample_type_,
kStandardOutputSampleRate) +
kRenderBufferSizeFrames * 2,
kRenderBufferSizeFrames),
kDefaultFramesPerChannel)),
input_audio_bus_(static_cast<size_t>(number_of_channels),
static_cast<size_t>(kRenderBufferSizeFrames),
GetPreferredOutputSampleType(), AudioBus::kPlanar),
Expand All @@ -99,6 +106,7 @@ AudioDevice::Impl::Impl(int number_of_channels, RenderCallback* callback)
DCHECK(number_of_channels_ == 1 || number_of_channels_ == 2)
<< "Invalid number of channels: " << number_of_channels_;
DCHECK(render_callback_);
DCHECK(frames_per_channel_ % kRenderBufferSizeFrames == 0);
DCHECK(SbAudioSinkIsAudioFrameStorageTypeSupported(
kSbMediaAudioFrameStorageTypeInterleaved))
<< "Only interleaved frame storage is supported.";
Expand Down
1 change: 1 addition & 0 deletions cobalt/base/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ static_library("base") {
"log_message_handler.cc",
"log_message_handler.h",
"message_queue.h",
"on_metric_upload_event.h",
"on_screen_keyboard_hidden_event.h",
"on_screen_keyboard_shown_event.h",
"path_provider.cc",
Expand Down
61 changes: 61 additions & 0 deletions cobalt/base/on_metric_upload_event.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// 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_BASE_ON_METRIC_UPLOAD_EVENT_H_
#define COBALT_BASE_ON_METRIC_UPLOAD_EVENT_H_

#include <string>
#include <utility>

#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/strings/string_util.h"
#include "cobalt/base/event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/h5vcc/h5vcc_metric_type.h"

namespace base {

// Event sent when a metric payload is ready for upload.
class OnMetricUploadEvent : public Event {
public:
OnMetricUploadEvent(const cobalt::h5vcc::H5vccMetricType& metric_type,
const std::string& serialized_proto)
: metric_type_(metric_type), serialized_proto_(serialized_proto) {}

explicit OnMetricUploadEvent(const Event* event) {
CHECK(event != nullptr);
const base::OnMetricUploadEvent* on_metric_upload_event =
base::polymorphic_downcast<const base::OnMetricUploadEvent*>(event);
metric_type_ = on_metric_upload_event->metric_type();
serialized_proto_ = on_metric_upload_event->serialized_proto();
}

const cobalt::h5vcc::H5vccMetricType& metric_type() const {
return metric_type_;
}

const std::string& serialized_proto() const { return serialized_proto_; }


BASE_EVENT_SUBCLASS(OnMetricUploadEvent);

private:
cobalt::h5vcc::H5vccMetricType metric_type_;
std::string serialized_proto_;
};

} // namespace base

#endif // COBALT_BASE_ON_METRIC_UPLOAD_EVENT_H_
1 change: 0 additions & 1 deletion cobalt/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ static_library("browser") {
"client_hint_headers.h",
"device_authentication.cc",
"device_authentication.h",
"lifecycle_observer.h",
"on_screen_keyboard_starboard_bridge.cc",
"on_screen_keyboard_starboard_bridge.h",
"render_tree_combiner.cc",
Expand Down
13 changes: 9 additions & 4 deletions cobalt/browser/application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,12 @@ std::string GetMinLogLevelString() {
}

int StringToLogLevel(const std::string& log_level) {
if (log_level == "info") {
if (log_level == "verbose") {
// The lower the verbose level is, the more messages are logged. Set it to
// a lower enough value to ensure that all known verbose messages are
// logged.
return logging::LOG_VERBOSE - 15;
} else if (log_level == "info") {
return logging::LOG_INFO;
} else if (log_level == "warning") {
return logging::LOG_WARNING;
Expand Down Expand Up @@ -698,9 +703,6 @@ Application::Application(const base::Closure& quit_closure, bool should_preload,
base::kApplicationStateStarted, kWatchdogTimeInterval,
kWatchdogTimeWait, watchdog::NONE);

cobalt::cache::Cache::GetInstance()->set_persistent_settings(
persistent_settings_.get());

base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
base::Optional<cssom::ViewportSize> requested_viewport_size =
GetRequestedViewportSize(command_line);
Expand Down Expand Up @@ -1025,6 +1027,8 @@ Application::Application(const base::Closure& quit_closure, bool should_preload,
base::TimeDelta::FromSeconds(duration_in_seconds));
}
#endif // ENABLE_DEBUG_COMMAND_LINE_SWITCHES

AddCrashLogApplicationState(base::kApplicationStateStarted);
}

Application::~Application() {
Expand Down Expand Up @@ -1524,6 +1528,7 @@ void Application::InitMetrics() {
metrics::kMetricEnabledSettingName, false);
auto metric_event_interval = persistent_settings_->GetPersistentSettingAsInt(
metrics::kMetricEventIntervalSettingName, 300);
metrics_services_manager_->SetEventDispatcher(&event_dispatcher_);
metrics_services_manager_->SetUploadInterval(metric_event_interval);
metrics_services_manager_->ToggleMetricsEnabled(is_metrics_enabled);
// Metric recording state initialization _must_ happen before we bootstrap
Expand Down
Loading

0 comments on commit 1620dd8

Please sign in to comment.