Skip to content

Commit

Permalink
Merge branch 'main' into deprecate_nv12
Browse files Browse the repository at this point in the history
  • Loading branch information
kaidokert committed Mar 25, 2024
2 parents 6b565f5 + bf93736 commit 1fc3580
Show file tree
Hide file tree
Showing 22 changed files with 403 additions and 105 deletions.
19 changes: 19 additions & 0 deletions cobalt/browser/application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "base/command_line.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/statistics_recorder.h"
#include "base/metrics/user_metrics.h"
#include "base/optional.h"
Expand Down Expand Up @@ -82,6 +83,7 @@
#include "starboard/event.h"
#include "starboard/extension/crash_handler.h"
#include "starboard/extension/installation_manager.h"
#include "starboard/extension/loader_app_metrics.h"
#include "starboard/system.h"
#include "url/gurl.h"

Expand Down Expand Up @@ -617,6 +619,22 @@ void AddCrashLogApplicationState(base::ApplicationState state) {
<< "required version, so not sending application state.";
}

void RecordLoaderAppMetrics() {
auto metrics_extension =
static_cast<const StarboardExtensionLoaderAppMetricsApi*>(
SbSystemGetExtension(kStarboardExtensionLoaderAppMetricsName));
if (metrics_extension &&
strcmp(metrics_extension->name,
kStarboardExtensionLoaderAppMetricsName) == 0 &&
metrics_extension->version >= 1) {
base::UmaHistogramEnumeration(
"Cobalt.LoaderApp.CrashpadInstallationStatus",
metrics_extension->GetCrashpadInstallationStatus());
LOG(INFO) << "Recorded sample for "
<< "Cobalt.LoaderApp.CrashpadInstallationStatus";
}
}

} // namespace

// Static user logs
Expand Down Expand Up @@ -1023,6 +1041,7 @@ Application::Application(const base::Closure& quit_closure, bool should_preload,
#endif // ENABLE_DEBUG_COMMAND_LINE_SWITCHES

AddCrashLogApplicationState(base::kApplicationStateStarted);
RecordLoaderAppMetrics();
}

Application::~Application() {
Expand Down
13 changes: 0 additions & 13 deletions cobalt/renderer/rasterizer/pixel_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,6 @@
#include "third_party/glm/glm/gtc/matrix_transform.hpp"
#include "third_party/glm/glm/gtx/transform.hpp"

#define BILINEAR_FILTERING_SUPPORTED 1

#if defined(STARBOARD)
#if !SB_HAS(BILINEAR_FILTERING_SUPPORT)
#undef BILINEAR_FILTERING_SUPPORTED
#define BILINEAR_FILTERING_SUPPORTED 0
#endif
#endif

using cobalt::loader::image::AnimatedWebPImage;
using cobalt::loader::image::MockImageDecoder;
using cobalt::loader::image::MockImageDecoderCallback;
Expand Down Expand Up @@ -2059,8 +2050,6 @@ TEST_F(PixelTest, ImageEdgeNoWrapWithPixelCentersOffset) {
PointF(100.0f, 100.51f), kNumCascades));
}

#if BILINEAR_FILTERING_SUPPORTED

TEST_F(PixelTest, ImagesAreLinearlyInterpolated) {
// We want to make sure that image pixels are accessed through a bilinear
// interpolation magnification filter.
Expand All @@ -2081,8 +2070,6 @@ TEST_F(PixelTest, ZoomedInImagesDoNotWrapInterpolated) {
ScaleMatrix(2) * TranslateMatrix(-0.5f, -0.5f)));
}

#endif // BILINEAR_FILTERING_SUPPORTED

TEST_F(PixelTest, YUV3PlaneImagesAreLinearlyInterpolated) {
// Tests that three plane YUV images are bilinearly interpolated.
scoped_refptr<Image> image = MakeI420Image(GetResourceProvider(), Size(8, 8));
Expand Down
1 change: 0 additions & 1 deletion cobalt/site/docs/reference/starboard/gn-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ Book: /youtube/cobalt/_book.yaml
| **`starboard_level_final_executable_type`**<br><br>The default value is `"executable"`. |
| **`starboard_level_gtest_target_type`**<br><br>The default value is `"executable"`. |
| **`static_library_configs`**<br><br> Target-specific configurations for static_library targets.<br><br>The default value is `[]`. |
| **`use_skia_next`**<br><br> Flag to use a future version of Skia, currently not available.<br><br>The default value is `false`. |
| **`use_thin_archive`**<br><br> Whether or not to link with thin archives.<br><br>The default value is `true`. |
| **`v8_enable_pointer_compression_override`**<br><br> Set to true to enable pointer compression for v8.<br><br>The default value is `true`. |
| **`v8_enable_webassembly`**<br><br> Enable WASM and install WebAssembly global.<br><br>The default value is `false`. |
3 changes: 0 additions & 3 deletions starboard/build/config/base_configuration.gni
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,6 @@ declare_args() {
# Enables an NPLB audit of C++17 support.
sb_enable_cpp17_audit = true

# Flag to use a future version of Skia, currently not available.
use_skia_next = false

# Enable when using clang 16.
is_clang_16 = false

Expand Down
22 changes: 22 additions & 0 deletions starboard/extension/extension_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "starboard/extension/ifa.h"
#include "starboard/extension/installation_manager.h"
#include "starboard/extension/javascript_cache.h"
#include "starboard/extension/loader_app_metrics.h"
#include "starboard/extension/media_session.h"
#include "starboard/extension/memory_mapped_file.h"
#include "starboard/extension/platform_info.h"
Expand Down Expand Up @@ -503,5 +504,26 @@ TEST(ExtensionTest, PlayerSetMaxVideoInputSize) {
<< "Extension struct should be a singleton";
}

TEST(ExtensionTest, LoaderAppMetrics) {
typedef StarboardExtensionLoaderAppMetricsApi ExtensionApi;
const char* kExtensionName = kStarboardExtensionLoaderAppMetricsName;

const ExtensionApi* extension_api =
static_cast<const ExtensionApi*>(SbSystemGetExtension(kExtensionName));
if (!extension_api) {
return;
}

EXPECT_STREQ(extension_api->name, kExtensionName);
EXPECT_EQ(extension_api->version, 1u);
EXPECT_NE(extension_api->SetCrashpadInstallationStatus, nullptr);
EXPECT_NE(extension_api->GetCrashpadInstallationStatus, nullptr);

const ExtensionApi* second_extension_api =
static_cast<const ExtensionApi*>(SbSystemGetExtension(kExtensionName));
EXPECT_EQ(second_extension_api, extension_api)
<< "Extension struct should be a singleton";
}

} // namespace extension
} // namespace starboard
64 changes: 64 additions & 0 deletions starboard/extension/loader_app_metrics.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// 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 STARBOARD_EXTENSION_LOADER_APP_METRICS_H_
#define STARBOARD_EXTENSION_LOADER_APP_METRICS_H_

#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

#define kStarboardExtensionLoaderAppMetricsName \
"dev.cobalt.extension.LoaderAppMetrics"

// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused. Must be kept in sync with the
// corresponding definition in
// tools/metrics/histograms/metadata/cobalt/enums.xml.
typedef enum CrashpadInstallationStatus {
// The enumerators below this point were added in version 1 or later.
kUnknown = 0,
kSucceeded = 1,
kFailedCrashpadHandlerBinaryNotFound = 2,
kFailedDatabaseInitializationFailed = 3,
kFailedSignalHandlerInstallationFailed = 4,
kMaxValue = kFailedSignalHandlerInstallationFailed
} CrashpadInstallationStatus;

typedef struct StarboardExtensionLoaderAppMetricsApi {
// Name should be the string |kStarboardExtensionLoaderAppMetricsName|.
// This helps to validate that the extension API is correct.
const char* name;

// This specifies the version of the API that is implemented.
uint32_t version;

// The fields below this point were added in version 1 or later.

// The accessors and mutators below are assumed to be called from the same
// thread: Cobalt's application thread.

void (*SetCrashpadInstallationStatus)(CrashpadInstallationStatus status);

CrashpadInstallationStatus (*GetCrashpadInstallationStatus)();

} StarboardExtensionLoaderAppMetricsApi;

#ifdef __cplusplus
} // extern "C"
#endif

#endif // STARBOARD_EXTENSION_LOADER_APP_METRICS_H_
2 changes: 2 additions & 0 deletions starboard/linux/shared/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@ static_library("starboard_platform_sources") {
"//starboard/shared/starboard/file_storage/storage_get_record_size.cc",
"//starboard/shared/starboard/file_storage/storage_open_record.cc",
"//starboard/shared/starboard/file_storage/storage_read_record.cc",
"//starboard/shared/starboard/loader_app_metrics.cc",
"//starboard/shared/starboard/loader_app_metrics.h",
"//starboard/shared/starboard/log_mutex.cc",
"//starboard/shared/starboard/log_mutex.h",
"//starboard/shared/starboard/log_raw_dump_stack.cc",
Expand Down
7 changes: 0 additions & 7 deletions starboard/linux/shared/configuration_public.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,6 @@
// the current linking unit.
#define SB_IMPORT_PLATFORM

// --- Graphics Configuration ------------------------------------------------

// Indicates whether or not the given platform supports bilinear filtering.
// This can be checked to enable/disable renderer tests that verify that this is
// working properly.
#define SB_HAS_BILINEAR_FILTERING_SUPPORT 1

// --- I/O Configuration -----------------------------------------------------

// Whether the current platform has speech synthesis.
Expand Down
5 changes: 5 additions & 0 deletions starboard/linux/shared/system_get_extensions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "starboard/extension/enhanced_audio.h"
#include "starboard/extension/free_space.h"
#include "starboard/extension/ifa.h"
#include "starboard/extension/loader_app_metrics.h"
#include "starboard/extension/memory_mapped_file.h"
#include "starboard/extension/platform_service.h"
#include "starboard/extension/time_zone.h"
Expand All @@ -33,6 +34,7 @@
#include "starboard/shared/posix/memory_mapped_file.h"
#include "starboard/shared/starboard/application.h"
#include "starboard/shared/starboard/crash_handler.h"
#include "starboard/shared/starboard/loader_app_metrics.h"
#if SB_IS(EVERGREEN_COMPATIBLE)
#include "starboard/elf_loader/evergreen_config.h"
#endif
Expand Down Expand Up @@ -86,5 +88,8 @@ const void* SbSystemGetExtension(const char* name) {
return starboard::shared::GetIfaApi();
}
#endif // SB_API_VERSION < 14
if (strcmp(name, kStarboardExtensionLoaderAppMetricsName) == 0) {
return starboard::shared::starboard::GetLoaderAppMetricsApi();
}
return NULL;
}
Loading

0 comments on commit 1fc3580

Please sign in to comment.