Commit 95e7ce2e authored by Oksana Zhuravlova's avatar Oksana Zhuravlova Committed by Commit Bot

[mojo] Convert AudioContext to use DocumentInterfaceBroker

This change replaces the usage of InterfaceProvider with
DocumentInterfaceBroker in AudioContext.

Bug: 936482
Change-Id: Ic3d3ad8f92e5a7554742bdaea07ae13e8fd9887c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1497378Reviewed-by: default avatarHongchan Choi <hongchan@chromium.org>
Reviewed-by: default avatarAlex Moshchuk <alexmos@chromium.org>
Reviewed-by: default avatarTom Sepez <tsepez@chromium.org>
Commit-Queue: Oksana Zhuravlova <oksamyt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#637778}
parent f133fe9f
......@@ -4122,9 +4122,6 @@ void RenderFrameHostImpl::RegisterMojoInterfaces() {
registry_->AddInterface(
base::BindRepeating(&FileChooserImpl::Create, base::Unretained(this)));
registry_->AddInterface(base::BindRepeating(&AudioContextManagerImpl::Create,
base::Unretained(this)));
registry_->AddInterface(base::BindRepeating(&WakeLockServiceImpl::Create,
base::Unretained(this)));
......@@ -5764,6 +5761,11 @@ void RenderFrameHostImpl::GetFrameHostTestInterface(
std::move(request));
}
void RenderFrameHostImpl::GetAudioContextManager(
blink::mojom::AudioContextManagerRequest request) {
AudioContextManagerImpl::Create(this, std::move(request));
}
std::unique_ptr<NavigationRequest>
RenderFrameHostImpl::TakeNavigationRequestForSameDocumentCommit(
const FrameHostMsg_DidCommitProvisionalLoad_Params& params) {
......
......@@ -1310,6 +1310,8 @@ class CONTENT_EXPORT RenderFrameHostImpl
// blink::mojom::DocumentInterfaceBroker:
void GetFrameHostTestInterface(
blink::mojom::FrameHostTestInterfaceRequest request) override;
void GetAudioContextManager(
blink::mojom::AudioContextManagerRequest request) override;
// Allows tests to disable the swapout event timer to simulate bugs that
// happen before it fires (to avoid flakiness).
......
......@@ -865,6 +865,8 @@ class TestSimpleDocumentInterfaceBrokerImpl
blink::mojom::FrameHostTestInterfaceRequest request) override {
binder_callback_.Run(std::move(request));
}
void GetAudioContextManager(
blink::mojom::AudioContextManagerRequest) override {}
mojo::Binding<blink::mojom::DocumentInterfaceBroker> binding_;
BinderCallback binder_callback_;
......
......@@ -5,9 +5,11 @@
module blink.mojom;
import "third_party/blink/public/mojom/frame/frame_host_test_interface.mojom";
import "third_party/blink/public/mojom/webaudio/audio_context_manager.mojom";
// An interface through which the renderer may request document-scoped
// interfaces from the browser.
interface DocumentInterfaceBroker {
GetFrameHostTestInterface(blink.mojom.FrameHostTestInterface& request);
GetAudioContextManager(blink.mojom.AudioContextManager& request);
};
......@@ -7,7 +7,7 @@
#include "build/build_config.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_recorder.h"
#include "services/service_manager/public/cpp/interface_provider.h"
#include "third_party/blink/public/mojom/frame/document_interface_broker.mojom-blink.h"
#include "third_party/blink/public/platform/web_audio_latency_hint.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h"
#include "third_party/blink/renderer/core/dom/dom_exception.h"
......@@ -642,8 +642,10 @@ void AudioContext::EnsureAudioContextManagerService() {
if (audio_context_manager_ || !GetDocument())
return;
GetDocument()->GetFrame()->GetInterfaceProvider().GetInterface(
mojo::MakeRequest(&audio_context_manager_));
GetDocument()
->GetFrame()
->GetDocumentInterfaceBroker()
.GetAudioContextManager(mojo::MakeRequest(&audio_context_manager_));
audio_context_manager_.set_connection_error_handler(
WTF::Bind(&AudioContext::OnAudioContextManagerServiceConnectionError,
WrapWeakPersistent(this)));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment