Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move impl to CobaltContentRendererClient
Browse files Browse the repository at this point in the history
sideb0ard committed Jan 9, 2025
1 parent a0563c7 commit 1da2f31
Showing 5 changed files with 19 additions and 9 deletions.
1 change: 1 addition & 0 deletions cobalt/renderer/BUILD.gn
Original file line number Diff line number Diff line change
@@ -26,6 +26,7 @@ source_set("renderer") {
"//content/public/renderer",
"//content/test:content_test_mojo_bindings",
"//media/mojo:buildflags",
"//media/starboard:webaudio",
"//starboard:starboard_headers_only",
"//v8",
]
9 changes: 8 additions & 1 deletion cobalt/renderer/cobalt_content_renderer_client.cc
Original file line number Diff line number Diff line change
@@ -89,7 +89,14 @@ class CobaltContentRendererUrlLoaderThrottleProvider

} // namespace

CobaltContentRendererClient::CobaltContentRendererClient() {}
CobaltContentRendererClient::CobaltContentRendererClient() {
#if BUILDFLAG(USE_STARBOARD_MEDIA)
// Registers a custom content::AudioDeviceFactory
starboard_audio_device_factory_ =
std::make_unique<media::StarboardAudioDeviceFactory>();
#endif // BUILDFLAG(USE_STARBOARD_MEDIA)
}

CobaltContentRendererClient::~CobaltContentRendererClient() {}

void CobaltContentRendererClient::RenderThreadStarted() {
9 changes: 9 additions & 0 deletions cobalt/renderer/cobalt_content_renderer_client.h
Original file line number Diff line number Diff line change
@@ -16,6 +16,10 @@
// For BUILDFLAG(USE_STARBOARD_MEDIA)
#include "build/build_config.h"

#if BUILDFLAG(USE_STARBOARD_MEDIA)
#include "media/starboard/starboard_audio_device_factory.h"
#endif // BUILDFLAG(USE_STARBOARD_MEDIA)

namespace blink {
class URLLoaderThrottleProvider;
enum class URLLoaderThrottleProviderType;
@@ -72,6 +76,11 @@ class CobaltContentRendererClient : public content::ContentRendererClient {

private:
std::unique_ptr<web_cache::WebCacheImpl> web_cache_impl_;

#if BUILDFLAG(USE_STARBOARD_MEDIA)
std::unique_ptr<media::StarboardAudioDeviceFactory>
starboard_audio_device_factory_;
#endif // BUILDFLAG(USE_STARBOARD_MEDIA)
};

} // namespace cobalt
1 change: 0 additions & 1 deletion content/shell/BUILD.gn
Original file line number Diff line number Diff line change
@@ -446,7 +446,6 @@ static_library("content_shell_lib") {
if (is_cobalt && use_starboard_media) {
deps += [
"//starboard($starboard_toolchain)",
"//media/starboard:webaudio($starboard_toolchain)",
]
}
}
8 changes: 1 addition & 7 deletions content/shell/renderer/shell_content_renderer_client.cc
Original file line number Diff line number Diff line change
@@ -186,13 +186,7 @@ void CreateRendererTestService(

} // namespace

ShellContentRendererClient::ShellContentRendererClient() {
#if BUILDFLAG(USE_STARBOARD_MEDIA)
// Registers a custom content::AudioDeviceFactory
starboard_audio_device_factory_ =
std::make_unique<media::StarboardAudioDeviceFactory>();
#endif // BUILDFLAG(USE_STARBOARD_MEDIA)
}
ShellContentRendererClient::ShellContentRendererClient() {}

ShellContentRendererClient::~ShellContentRendererClient() {
}

0 comments on commit 1da2f31

Please sign in to comment.