Commit 31f80161 authored by Will Cassella's avatar Will Cassella Committed by Commit Bot

Change const-ref-to-smart-pointer to pointer in WebXR

Passing a `mojo::StructPtr` by const-ref is basically just passing a
`std::unique_ptr` by const-ref, which is disallowed by the style guide.

https://google.github.io/styleguide/cppguide.html#Ownership_and_Smart_Pointers

It's also inefficient because it requires a double-indirection to access
any members of the pointee.

Change-Id: Ic579a5ae19dbc5ff871bd07e7ef5c92f410a83b7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1977396Reviewed-by: default avatarAlexander Cooper <alcooper@chromium.org>
Reviewed-by: default avatarKlaus Weidner <klausw@chromium.org>
Commit-Queue: Will Cassella <cassew@google.com>
Cr-Commit-Position: refs/heads/master@{#727081}
parent 47314dc0
......@@ -949,7 +949,7 @@ void XRSession::OnEnvironmentProviderError() {
}
void XRSession::ProcessAnchorsData(
const device::mojom::blink::XRAnchorsDataPtr& tracked_anchors_data,
const device::mojom::blink::XRAnchorsData* tracked_anchors_data,
double timestamp) {
TRACE_EVENT0("xr", __func__);
......@@ -1015,7 +1015,7 @@ void XRSession::CleanUpUnusedHitTestSources() {
}
void XRSession::ProcessHitTestData(
const device::mojom::blink::XRHitTestSubscriptionResultsDataPtr&
const device::mojom::blink::XRHitTestSubscriptionResultsData*
hit_test_subscriptions_data) {
DVLOG(2) << __func__;
......@@ -1413,9 +1413,9 @@ void XRSession::UpdateWorldUnderstandingStateForFrame(
// Update objects that might change on per-frame basis.
if (frame_data) {
world_information_->ProcessPlaneInformation(
frame_data->detected_planes_data, timestamp);
ProcessAnchorsData(frame_data->anchors_data, timestamp);
ProcessHitTestData(frame_data->hit_test_subscription_results);
frame_data->detected_planes_data.get(), timestamp);
ProcessAnchorsData(frame_data->anchors_data.get(), timestamp);
ProcessHitTestData(frame_data->hit_test_subscription_results.get());
} else {
world_information_->ProcessPlaneInformation(nullptr, timestamp);
ProcessAnchorsData(nullptr, timestamp);
......
......@@ -350,13 +350,13 @@ class XRSession final
void OnEnvironmentProviderError();
void ProcessAnchorsData(
const device::mojom::blink::XRAnchorsDataPtr& tracked_anchors_data,
const device::mojom::blink::XRAnchorsData* tracked_anchors_data,
double timestamp);
void CleanUpUnusedHitTestSources();
void ProcessHitTestData(
const device::mojom::blink::XRHitTestSubscriptionResultsDataPtr&
const device::mojom::blink::XRHitTestSubscriptionResultsData*
hit_test_data);
void HandleShutdown();
......
......@@ -34,7 +34,7 @@ XRPlaneSet* XRWorldInformation::detectedPlanes() const {
}
void XRWorldInformation::ProcessPlaneInformation(
const device::mojom::blink::XRPlaneDetectionDataPtr& detected_planes_data,
const device::mojom::blink::XRPlaneDetectionData* detected_planes_data,
double timestamp) {
TRACE_EVENT0("xr", __FUNCTION__);
......
......@@ -29,7 +29,7 @@ class XRWorldInformation : public ScriptWrappable {
// the received frame data. This will update the contents of
// plane_ids_to_planes_.
void ProcessPlaneInformation(
const device::mojom::blink::XRPlaneDetectionDataPtr& detected_planes_data,
const device::mojom::blink::XRPlaneDetectionData* detected_planes_data,
double timestamp);
private:
......
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