Commit 38f08f4e authored by Khushal's avatar Khushal Committed by Commit Bot

content: Fix MojoUkmRecorder setup for compositor UKMs.

The binding of the mojo interface used for recording UKMs by the
compositor is incorrect, the interface needs to be bound to a service
using the service connector to start the connection.

Clone the Connector and pass it to the factory used on the compositor
thread to do the binding. Its necessary to clone it for the connector
access to be thread-safe.

R=piman@chromium.org

Change-Id: I1e20e64a6a6500e9c548599f4893d70a028574a7
Reviewed-on: https://chromium-review.googlesource.com/798538Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Commit-Queue: Khushal <khushalsagar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#520709}
parent 9c334c65
...@@ -443,22 +443,18 @@ class RendererLocalSurfaceIdProvider : public viz::LocalSurfaceIdProvider { ...@@ -443,22 +443,18 @@ class RendererLocalSurfaceIdProvider : public viz::LocalSurfaceIdProvider {
// thread. // thread.
class UkmRecorderFactoryImpl : public cc::UkmRecorderFactory { class UkmRecorderFactoryImpl : public cc::UkmRecorderFactory {
public: public:
UkmRecorderFactoryImpl(ukm::mojom::UkmRecorderInterfacePtrInfo info) UkmRecorderFactoryImpl(std::unique_ptr<service_manager::Connector> connector)
: info_(std::move(info)) { : connector_(std::move(connector)) {
DCHECK(info_.is_valid()); DCHECK(connector_);
} }
~UkmRecorderFactoryImpl() override = default; ~UkmRecorderFactoryImpl() override = default;
std::unique_ptr<ukm::UkmRecorder> CreateRecorder() override { std::unique_ptr<ukm::UkmRecorder> CreateRecorder() override {
DCHECK(info_.is_valid()); return ukm::MojoUkmRecorder::Create(connector_.get());
ukm::mojom::UkmRecorderInterfacePtr recorder;
recorder.Bind(std::move(info_));
return std::make_unique<ukm::MojoUkmRecorder>(std::move(recorder));
} }
private: private:
ukm::mojom::UkmRecorderInterfacePtrInfo info_; std::unique_ptr<service_manager::Connector> connector_;
}; };
} // namespace } // namespace
...@@ -1707,9 +1703,7 @@ bool RenderThreadImpl::IsScrollAnimatorEnabled() { ...@@ -1707,9 +1703,7 @@ bool RenderThreadImpl::IsScrollAnimatorEnabled() {
std::unique_ptr<cc::UkmRecorderFactory> std::unique_ptr<cc::UkmRecorderFactory>
RenderThreadImpl::CreateUkmRecorderFactory() { RenderThreadImpl::CreateUkmRecorderFactory() {
ukm::mojom::UkmRecorderInterfacePtrInfo info; return std::make_unique<UkmRecorderFactoryImpl>(GetConnector()->Clone());
mojo::MakeRequest(&info);
return std::make_unique<UkmRecorderFactoryImpl>(std::move(info));
} }
void RenderThreadImpl::OnRAILModeChanged(v8::RAILMode rail_mode) { void RenderThreadImpl::OnRAILModeChanged(v8::RAILMode rail_mode) {
......
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