Commit d3cb4640 authored by Miyoung Shin's avatar Miyoung Shin Committed by Commit Bot

Convert ReportingServiceProxy to new Mojo types

This CL converts ReportingServiceProxyPtr in blink and
ReportingServiceProxyRequest in content to the new Mojo types.

Bug: 955171, 978694
Change-Id: Ied46648763bb6557220fd74f2c12440ab27bbad7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1776143Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Reviewed-by: default avatarAdam Langley <agl@chromium.org>
Reviewed-by: default avatarOksana Zhuravlova <oksamyt@chromium.org>
Commit-Queue: Miyoung Shin <myid.shin@igalia.com>
Cr-Commit-Position: refs/heads/master@{#692314}
parent 659ebcff
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include "content/public/browser/render_process_host.h" #include "content/public/browser/render_process_host.h"
#include "content/public/browser/site_instance.h" #include "content/public/browser/site_instance.h"
#include "content/public/browser/storage_partition.h" #include "content/public/browser/storage_partition.h"
#include "mojo/public/cpp/bindings/strong_binding.h" #include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "net/reporting/reporting_report.h" #include "net/reporting/reporting_report.h"
#include "net/reporting/reporting_service.h" #include "net/reporting/reporting_service.h"
#include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context.h"
...@@ -152,12 +152,12 @@ class ReportingServiceProxyImpl : public blink::mojom::ReportingServiceProxy { ...@@ -152,12 +152,12 @@ class ReportingServiceProxyImpl : public blink::mojom::ReportingServiceProxy {
// static // static
void CreateReportingServiceProxy( void CreateReportingServiceProxy(
int render_process_id, int render_process_id,
blink::mojom::ReportingServiceProxyRequest request) { mojo::PendingReceiver<blink::mojom::ReportingServiceProxy> receiver) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
mojo::MakeStrongBinding( mojo::MakeSelfOwnedReceiver(
std::make_unique<ReportingServiceProxyImpl>(render_process_id), std::make_unique<ReportingServiceProxyImpl>(render_process_id),
std::move(request)); std::move(receiver));
} }
} // namespace content } // namespace content
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#ifndef CONTENT_BROWSER_NET_REPORTING_SERVICE_PROXY_H_ #ifndef CONTENT_BROWSER_NET_REPORTING_SERVICE_PROXY_H_
#define CONTENT_BROWSER_NET_REPORTING_SERVICE_PROXY_H_ #define CONTENT_BROWSER_NET_REPORTING_SERVICE_PROXY_H_
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "third_party/blink/public/mojom/reporting/reporting.mojom.h" #include "third_party/blink/public/mojom/reporting/reporting.mojom.h"
namespace content { namespace content {
...@@ -13,7 +14,7 @@ namespace content { ...@@ -13,7 +14,7 @@ namespace content {
// |render_process_id|'s NetworkContext. This must be called on the UI thread. // |render_process_id|'s NetworkContext. This must be called on the UI thread.
void CreateReportingServiceProxy( void CreateReportingServiceProxy(
int render_process_id, int render_process_id,
blink::mojom::ReportingServiceProxyRequest request); mojo::PendingReceiver<blink::mojom::ReportingServiceProxy> receiver);
} // namespace content } // namespace content
......
...@@ -1544,11 +1544,11 @@ void LocalFrame::UpdateActiveSchedulerTrackedFeatures(uint64_t features_mask) { ...@@ -1544,11 +1544,11 @@ void LocalFrame::UpdateActiveSchedulerTrackedFeatures(uint64_t features_mask) {
Client()->DidChangeActiveSchedulerTrackedFeatures(features_mask); Client()->DidChangeActiveSchedulerTrackedFeatures(features_mask);
} }
const mojom::blink::ReportingServiceProxyPtr& LocalFrame::GetReportingService() const mojo::Remote<mojom::blink::ReportingServiceProxy>&
const { LocalFrame::GetReportingService() const {
if (!reporting_service_) { if (!reporting_service_) {
Platform::Current()->GetBrowserInterfaceBrokerProxy()->GetInterface( Platform::Current()->GetBrowserInterfaceBrokerProxy()->GetInterface(
mojo::MakeRequest(&reporting_service_)); reporting_service_.BindNewPipeAndPassReceiver());
} }
return reporting_service_; return reporting_service_;
} }
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/time/default_tick_clock.h" #include "base/time/default_tick_clock.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/bindings/strong_binding_set.h" #include "mojo/public/cpp/bindings/strong_binding_set.h"
#include "third_party/blink/public/common/frame/occlusion_state.h" #include "third_party/blink/public/common/frame/occlusion_state.h"
#include "third_party/blink/public/mojom/ad_tagging/ad_frame.mojom-blink.h" #include "third_party/blink/public/mojom/ad_tagging/ad_frame.mojom-blink.h"
...@@ -414,7 +415,8 @@ class CORE_EXPORT LocalFrame final : public Frame, ...@@ -414,7 +415,8 @@ class CORE_EXPORT LocalFrame final : public Frame,
SmoothScrollSequencer& GetSmoothScrollSequencer(); SmoothScrollSequencer& GetSmoothScrollSequencer();
const mojom::blink::ReportingServiceProxyPtr& GetReportingService() const; const mojo::Remote<mojom::blink::ReportingServiceProxy>& GetReportingService()
const;
// Overlays a color on top of this LocalFrameView if it is associated with // Overlays a color on top of this LocalFrameView if it is associated with
// the main frame. Should not have multiple consumers. // the main frame. Should not have multiple consumers.
...@@ -567,7 +569,7 @@ class CORE_EXPORT LocalFrame final : public Frame, ...@@ -567,7 +569,7 @@ class CORE_EXPORT LocalFrame final : public Frame,
InterfaceRegistry* const interface_registry_; InterfaceRegistry* const interface_registry_;
// This is declared mutable so that the service endpoint can be cached by // This is declared mutable so that the service endpoint can be cached by
// const methods. // const methods.
mutable mojom::blink::ReportingServiceProxyPtr reporting_service_; mutable mojo::Remote<mojom::blink::ReportingServiceProxy> reporting_service_;
IntRect remote_viewport_intersection_; IntRect remote_viewport_intersection_;
FrameOcclusionState occlusion_state_ = FrameOcclusionState::kUnknown; FrameOcclusionState occlusion_state_ = FrameOcclusionState::kUnknown;
......
...@@ -103,11 +103,11 @@ void ReportingContext::CountReport(Report* report) { ...@@ -103,11 +103,11 @@ void ReportingContext::CountReport(Report* report) {
UseCounter::Count(execution_context_, feature); UseCounter::Count(execution_context_, feature);
} }
const mojom::blink::ReportingServiceProxyPtr& const mojo::Remote<mojom::blink::ReportingServiceProxy>&
ReportingContext::GetReportingService() const { ReportingContext::GetReportingService() const {
if (!reporting_service_) { if (!reporting_service_) {
Platform::Current()->GetBrowserInterfaceBrokerProxy()->GetInterface( Platform::Current()->GetBrowserInterfaceBrokerProxy()->GetInterface(
mojo::MakeRequest(&reporting_service_)); reporting_service_.BindNewPipeAndPassReceiver());
} }
return reporting_service_; return reporting_service_;
} }
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_REPORTING_CONTEXT_H_ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_REPORTING_CONTEXT_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_REPORTING_CONTEXT_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_REPORTING_CONTEXT_H_
#include "mojo/public/cpp/bindings/remote.h"
#include "third_party/blink/public/mojom/reporting/reporting.mojom-blink.h" #include "third_party/blink/public/mojom/reporting/reporting.mojom-blink.h"
#include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/core/execution_context/execution_context.h"
...@@ -48,7 +49,8 @@ class CORE_EXPORT ReportingContext final ...@@ -48,7 +49,8 @@ class CORE_EXPORT ReportingContext final
// Counts the use of a report type via UseCounter. // Counts the use of a report type via UseCounter.
void CountReport(Report*); void CountReport(Report*);
const mojom::blink::ReportingServiceProxyPtr& GetReportingService() const; const mojo::Remote<mojom::blink::ReportingServiceProxy>& GetReportingService()
const;
// Send |report| via the Reporting API to |endpoint|. // Send |report| via the Reporting API to |endpoint|.
void SendToReportingAPI(Report* report, const String& endpoint) const; void SendToReportingAPI(Report* report, const String& endpoint) const;
...@@ -59,7 +61,7 @@ class CORE_EXPORT ReportingContext final ...@@ -59,7 +61,7 @@ class CORE_EXPORT ReportingContext final
// This is declared mutable so that the service endpoint can be cached by // This is declared mutable so that the service endpoint can be cached by
// const methods. // const methods.
mutable mojom::blink::ReportingServiceProxyPtr reporting_service_; mutable mojo::Remote<mojom::blink::ReportingServiceProxy> reporting_service_;
}; };
} // namespace blink } // namespace blink
......
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