| Index: device/vr/vr_service_impl.cc
|
| diff --git a/device/vr/vr_service_impl.cc b/device/vr/vr_service_impl.cc
|
| index 49ddde0482efb074ec3eb3977ea272730a3a817e..0dd7e7fa43b87563767962c45228c48d3a810c4d 100644
|
| --- a/device/vr/vr_service_impl.cc
|
| +++ b/device/vr/vr_service_impl.cc
|
| @@ -9,25 +9,25 @@
|
| #include "base/bind.h"
|
| #include "device/vr/vr_device.h"
|
| #include "device/vr/vr_device_manager.h"
|
| +#include "mojo/public/cpp/bindings/strong_binding.h"
|
|
|
| namespace device {
|
|
|
| VRServiceImpl::VRServiceImpl() : listening_for_activate_(false) {}
|
|
|
| VRServiceImpl::~VRServiceImpl() {
|
| - RemoveFromDeviceManager();
|
| + VRDeviceManager::GetInstance()->RemoveService(this);
|
| }
|
|
|
| -void VRServiceImpl::BindRequest(
|
| - mojo::InterfaceRequest<mojom::VRService> request) {
|
| - VRServiceImpl* service = new VRServiceImpl();
|
| - service->Bind(std::move(request));
|
| +void VRServiceImpl::Create(mojo::InterfaceRequest<mojom::VRService> request) {
|
| + mojo::MakeStrongBinding(base::MakeUnique<VRServiceImpl>(),
|
| + std::move(request));
|
| }
|
|
|
| // Gets a VRDisplayPtr unique to this service so that the associated page can
|
| // communicate with the VRDevice.
|
| VRDisplayImpl* VRServiceImpl::GetVRDisplayImpl(VRDevice* device) {
|
| - DisplayImplMap::iterator it = displays_.find(device);
|
| + auto it = displays_.find(device);
|
| if (it != displays_.end())
|
| return it->second.get();
|
|
|
| @@ -36,19 +36,6 @@ VRDisplayImpl* VRServiceImpl::GetVRDisplayImpl(VRDevice* device) {
|
| return display_impl;
|
| }
|
|
|
| -void VRServiceImpl::Bind(mojo::InterfaceRequest<mojom::VRService> request) {
|
| - // TODO(shaobo.yan@intel.com) : Keep one binding_ and use close and rebind.
|
| - binding_.reset(new mojo::Binding<mojom::VRService>(this, std::move(request)));
|
| - binding_->set_connection_error_handler(base::Bind(
|
| - &VRServiceImpl::RemoveFromDeviceManager, base::Unretained(this)));
|
| -}
|
| -
|
| -void VRServiceImpl::RemoveFromDeviceManager() {
|
| - displays_.clear();
|
| - VRDeviceManager* device_manager = VRDeviceManager::GetInstance();
|
| - device_manager->RemoveService(this);
|
| -}
|
| -
|
| void VRServiceImpl::RemoveDevice(VRDevice* device) {
|
| displays_.erase(device);
|
| }
|
|
|