Commit 5dd47550 authored by Gyuyoung Kim's avatar Gyuyoung Kim Committed by Commit Bot

Migrate CameraService interface to the new Mojo types

This CL converts the uses of CameraService interface as below,

  - Convert CameraServicePtr to mojo::Remote
  - Convert CameraServicePtrInfo to mojo::PendingRemote

Bug: 955171
Change-Id: I5200a2773dfa9ef121de645bedb73d5238a823f4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2222087
Commit-Queue: Gyuyoung Kim <gyuyoung@igalia.com>
Reviewed-by: default avatarHidehiko Abe <hidehiko@chromium.org>
Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Reviewed-by: default avatarKen Rockot <rockot@google.com>
Cr-Commit-Position: refs/heads/master@{#773975}
parent 59332fa9
......@@ -16,6 +16,7 @@
#include "components/arc/session/arc_bridge_service.h"
#include "crypto/random.h"
#include "media/capture/video/chromeos/camera_hal_dispatcher_impl.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/platform/platform_channel.h"
#include "mojo/public/cpp/system/invitation.h"
#include "mojo/public/cpp/system/platform_handle.h"
......@@ -53,9 +54,10 @@ class ArcCameraBridge::PendingStartCameraServiceResult {
mojo::ScopedMessagePipeHandle pipe,
ArcCameraBridge::StartCameraServiceCallback callback)
: owner_(owner),
service_(mojom::CameraServicePtrInfo(std::move(pipe), 0u)),
service_(
mojo::PendingRemote<mojom::CameraService>(std::move(pipe), 0u)),
callback_(std::move(callback)) {
service_.set_connection_error_handler(
service_.set_disconnect_handler(
base::BindOnce(&PendingStartCameraServiceResult::OnError,
weak_ptr_factory_.GetWeakPtr()));
service_.QueryVersion(
......@@ -78,13 +80,13 @@ class ArcCameraBridge::PendingStartCameraServiceResult {
// Runs the callback and removes this object from the owner.
void Finish() {
DCHECK(callback_);
std::move(callback_).Run(std::move(service_));
std::move(callback_).Run(service_.Unbind());
// Destructs |this|.
owner_->pending_start_camera_service_results_.erase(this);
}
ArcCameraBridge* const owner_;
mojom::CameraServicePtr service_;
mojo::Remote<mojom::CameraService> service_;
ArcCameraBridge::StartCameraServiceCallback callback_;
base::WeakPtrFactory<PendingStartCameraServiceResult> weak_ptr_factory_{this};
......
......@@ -96,7 +96,7 @@ interface CameraService {
interface CameraHost {
// Notifies Chrome that CameraService is requested and returns an interface
// pointer bound to a newly created service. Used by camera HAL v1.
StartCameraService@0() => (CameraService service);
StartCameraService@0() => (pending_remote<CameraService> service);
// Registers the camera HAL client. Used by camera HAL v3.
[MinVersion=2] RegisterCameraHalClient@1(
......
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