Skip to content

Commit

Permalink
CastCore: CastRuntimeService: Add API to request CastWebService
Browse files Browse the repository at this point in the history
Add a method to request a pointer to CastWebService instance.
This is required to provide access to CastWebService::* methods
in underlying classes, such as
    CastWebService::GetURLLoaderThrottleDelegateForSession()
can be needed in
    ContentBrowserClient::CreateURLLoaderThrottles().

Bug: b/203010197(internal)
Test: N/A
Signed-off-by: Volodymyr Riazantsev <riazantsevv@google.com>
Change-Id: I9124762b817767f834b281eb18afbeb840d70bc3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3230239
Reviewed-by: Ryan Keane <rwkeane@google.com>
Cr-Commit-Position: refs/heads/main@{#933552}
  • Loading branch information
riazantsev authored and Chromium LUCI CQ committed Oct 20, 2021
1 parent c528eae commit cc22b28
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions chromecast/cast_core/cast_runtime_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ receiver::MediaManager* CastRuntimeService::GetMediaManager() {
return nullptr;
}

CastWebService* CastRuntimeService::GetCastWebService() {
return nullptr;
}

void CastRuntimeService::InitializeInternal() {}

void CastRuntimeService::FinalizeInternal() {}
Expand Down
4 changes: 4 additions & 0 deletions chromecast/cast_core/cast_runtime_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ namespace chromecast {

class CastWindowManager;
class WebCryptoServer;
class CastWebService;

namespace media {
class MediaPipelineBackendManager;
Expand Down Expand Up @@ -66,6 +67,9 @@ class CastRuntimeService

virtual WebCryptoServer* GetWebCryptoServer();
virtual receiver::MediaManager* GetMediaManager();
// Returns a pointer to CastWebService object with lifespan
// equal to CastRuntimeService main object.
virtual CastWebService* GetCastWebService();

// CastService overrides.
void InitializeInternal() override;
Expand Down
4 changes: 4 additions & 0 deletions chromecast/cast_core/cast_runtime_service_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,8 @@ const std::string& CastRuntimeServiceImpl::GetAudioChannelEndpoint() {
return app_dispatcher_.GetCastMediaServiceGrpcEndpoint();
}

CastWebService* CastRuntimeServiceImpl::GetCastWebService() {
return app_dispatcher_.GetCastWebService();
}

} // namespace chromecast
1 change: 1 addition & 0 deletions chromecast/cast_core/cast_runtime_service_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class CastRuntimeServiceImpl
void StartInternal() override;
void StopInternal() override;
const std::string& GetAudioChannelEndpoint() override;
CastWebService* GetCastWebService() override;

protected:
// CastRuntimeMetricsRecorder::EventBuilderFactory overrides.
Expand Down
1 change: 1 addition & 0 deletions chromecast/cast_core/runtime_application_dispatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class RuntimeApplicationDispatcher final : public GrpcServer,
GrpcMethod* callback) override;

const std::string& GetCastMediaServiceGrpcEndpoint() const;
CastWebService* GetCastWebService() const { return web_service_.get(); }

private:
// This class handles asynchronously calling MetricsRecorderService->Record
Expand Down

0 comments on commit cc22b28

Please sign in to comment.