Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: device/vr/vr_service_impl.h

Issue 2615723002: Revert of Fix leak in VRServiceImpl (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « device/vr/vr_display_impl.cc ('k') | device/vr/vr_service_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef DEVICE_VR_VR_SERVICE_IMPL_H 5 #ifndef DEVICE_VR_VR_SERVICE_IMPL_H
6 #define DEVICE_VR_VR_SERVICE_IMPL_H 6 #define DEVICE_VR_VR_SERVICE_IMPL_H
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 11
12 #include "device/vr/vr_device.h" 12 #include "device/vr/vr_device.h"
13 #include "device/vr/vr_display_impl.h" 13 #include "device/vr/vr_display_impl.h"
14 #include "device/vr/vr_export.h" 14 #include "device/vr/vr_export.h"
15 #include "device/vr/vr_service.mojom.h" 15 #include "device/vr/vr_service.mojom.h"
16 #include "mojo/public/cpp/bindings/binding.h" 16 #include "mojo/public/cpp/bindings/binding.h"
17 17
18 namespace device { 18 namespace device {
19 19
20 class VRServiceImpl : public mojom::VRService { 20 class VRServiceImpl : public mojom::VRService {
21 public: 21 public:
22 DEVICE_VR_EXPORT VRServiceImpl();
23 DEVICE_VR_EXPORT ~VRServiceImpl() override; 22 DEVICE_VR_EXPORT ~VRServiceImpl() override;
24 23
25 DEVICE_VR_EXPORT static void Create( 24 DEVICE_VR_EXPORT static void BindRequest(
26 mojo::InterfaceRequest<mojom::VRService> request); 25 mojo::InterfaceRequest<mojom::VRService> request);
27 26
28 mojom::VRServiceClient* client() { return client_.get(); } 27 mojom::VRServiceClient* client() { return client_.get(); }
29 28
30 VRDisplayImpl* GetVRDisplayImpl(VRDevice* device); 29 VRDisplayImpl* GetVRDisplayImpl(VRDevice* device);
31 30
32 bool listening_for_activate() { return listening_for_activate_; } 31 bool listening_for_activate() { return listening_for_activate_; }
33 32
34 private: 33 private:
35 friend class VRServiceTestBinding; 34 friend class VRServiceTestBinding;
36 friend class VRDeviceManagerTest; 35 friend class VRDeviceManagerTest;
37 friend class VRDisplayImpl; 36 friend class VRDisplayImpl;
38 37
38 DEVICE_VR_EXPORT VRServiceImpl();
39
40 // Mojo connection handling.
41 DEVICE_VR_EXPORT void Bind(mojo::InterfaceRequest<mojom::VRService> request);
42 void RemoveFromDeviceManager();
39 void RemoveDevice(VRDevice* device); 43 void RemoveDevice(VRDevice* device);
40 44
41 // mojom::VRService implementation 45 // mojom::VRService implementation
42 void SetClient(mojom::VRServiceClientPtr service_client, 46 void SetClient(mojom::VRServiceClientPtr service_client,
43 const SetClientCallback& callback) override; 47 const SetClientCallback& callback) override;
44 void SetListeningForActivate(bool listening) override; 48 void SetListeningForActivate(bool listening) override;
45 49
46 std::map<VRDevice*, std::unique_ptr<VRDisplayImpl>> displays_; 50 using DisplayImplMap = std::map<VRDevice*, std::unique_ptr<VRDisplayImpl>>;
51 DisplayImplMap displays_;
47 52
48 mojom::VRServiceClientPtr client_; 53 mojom::VRServiceClientPtr client_;
49 54
50 bool listening_for_activate_; 55 bool listening_for_activate_;
51 56
57 std::unique_ptr<mojo::Binding<mojom::VRService>> binding_;
58
52 DISALLOW_COPY_AND_ASSIGN(VRServiceImpl); 59 DISALLOW_COPY_AND_ASSIGN(VRServiceImpl);
53 }; 60 };
54 61
55 } // namespace device 62 } // namespace device
56 63
57 #endif // DEVICE_VR_VR_SERVICE_IMPL_H 64 #endif // DEVICE_VR_VR_SERVICE_IMPL_H
OLDNEW
« no previous file with comments | « device/vr/vr_display_impl.cc ('k') | device/vr/vr_service_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698