Commit 6de7d4c5 authored by Minoru Chikamune's avatar Minoru Chikamune Committed by Commit Bot

Reland "Migrate SensorProviderProxy to use GC mojo wrappers."

This reverts commit d0b13ee1.

Reason for reland: crbug.com/1067937 reported me that the original CL made a surprising impact to rendering.mobile/queueing_durations. So I reverted the original CL. But even if I revert it, the measurement wasn't changed at all. So I think my CL isn't related to the Issue. I reland this CL.

Bug: 1067937
Change-Id: I1187a09b1f609d2023fa4a1b9c2fd845a80f4b1c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2143787Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarKouhei Ueno <kouhei@chromium.org>
Commit-Queue: Minoru Chikamune <chikamune@chromium.org>
Cr-Commit-Position: refs/heads/master@{#758126}
parent a0a24617
......@@ -13,14 +13,17 @@ namespace blink {
// SensorProviderProxy
SensorProviderProxy::SensorProviderProxy(Document& document)
: Supplement<Document>(document), inspector_mode_(false) {}
: Supplement<Document>(document),
sensor_provider_(document.ToExecutionContext()),
inspector_mode_(false) {}
void SensorProviderProxy::InitializeIfNeeded() {
if (IsInitialized())
return;
GetSupplementable()->GetBrowserInterfaceBroker().GetInterface(
sensor_provider_.BindNewPipeAndPassReceiver());
sensor_provider_.BindNewPipeAndPassReceiver(
GetSupplementable()->GetTaskRunner(TaskType::kSensor)));
sensor_provider_.set_disconnect_handler(
WTF::Bind(&SensorProviderProxy::OnSensorProviderConnectionError,
WrapWeakPersistent(this)));
......@@ -46,6 +49,7 @@ SensorProviderProxy::~SensorProviderProxy() = default;
void SensorProviderProxy::Trace(Visitor* visitor) {
visitor->Trace(sensor_proxies_);
visitor->Trace(sensor_provider_);
Supplement<Document>::Trace(visitor);
}
......
......@@ -6,12 +6,13 @@
#define THIRD_PARTY_BLINK_RENDERER_MODULES_SENSOR_SENSOR_PROVIDER_PROXY_H_
#include "base/macros.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "services/device/public/mojom/sensor.mojom-blink-forward.h"
#include "services/device/public/mojom/sensor_provider.mojom-blink.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/modules/modules_export.h"
#include "third_party/blink/renderer/platform/heap/handle.h"
#include "third_party/blink/renderer/platform/mojo/heap_mojo_remote.h"
#include "third_party/blink/renderer/platform/mojo/heap_mojo_wrapper_mode.h"
#include "third_party/blink/renderer/platform/supplementable.h"
namespace blink {
......@@ -58,7 +59,9 @@ class MODULES_EXPORT SensorProviderProxy final
void OnSensorProviderConnectionError();
SensorsSet sensor_proxies_;
mojo::Remote<device::mojom::blink::SensorProvider> sensor_provider_;
HeapMojoRemote<device::mojom::blink::SensorProvider,
HeapMojoWrapperMode::kWithoutContextObserver>
sensor_provider_;
bool inspector_mode_;
DISALLOW_COPY_AND_ASSIGN(SensorProviderProxy);
......
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