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

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

Issue 2590883003: Fix leak in VRServiceImpl (Closed)
Patch Set: fix compile Created 4 years 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();
22 DEVICE_VR_EXPORT ~VRServiceImpl() override; 23 DEVICE_VR_EXPORT ~VRServiceImpl() override;
23 24
24 DEVICE_VR_EXPORT static void BindRequest( 25 DEVICE_VR_EXPORT static void Create(
25 mojo::InterfaceRequest<mojom::VRService> request); 26 mojo::InterfaceRequest<mojom::VRService> request);
26 27
27 mojom::VRServiceClient* client() { return client_.get(); } 28 mojom::VRServiceClient* client() { return client_.get(); }
28 29
29 VRDisplayImpl* GetVRDisplayImpl(VRDevice* device); 30 VRDisplayImpl* GetVRDisplayImpl(VRDevice* device);
30 31
31 bool listening_for_activate() { return listening_for_activate_; } 32 bool listening_for_activate() { return listening_for_activate_; }
32 33
33 private: 34 private:
34 friend class VRServiceTestBinding; 35 friend class VRServiceTestBinding;
35 friend class VRDeviceManagerTest; 36 friend class VRDeviceManagerTest;
36 friend class VRDisplayImpl; 37 friend class VRDisplayImpl;
37 38
38 DEVICE_VR_EXPORT VRServiceImpl();
39
40 // Mojo connection handling.
41 DEVICE_VR_EXPORT void Bind(mojo::InterfaceRequest<mojom::VRService> request);
42 void RemoveFromDeviceManager();
43 void RemoveDevice(VRDevice* device); 39 void RemoveDevice(VRDevice* device);
44 40
45 // mojom::VRService implementation 41 // mojom::VRService implementation
46 void SetClient(mojom::VRServiceClientPtr service_client, 42 void SetClient(mojom::VRServiceClientPtr service_client,
47 const SetClientCallback& callback) override; 43 const SetClientCallback& callback) override;
48 void SetListeningForActivate(bool listening) override; 44 void SetListeningForActivate(bool listening) override;
49 45
50 using DisplayImplMap = std::map<VRDevice*, std::unique_ptr<VRDisplayImpl>>; 46 std::map<VRDevice*, std::unique_ptr<VRDisplayImpl>> displays_;
51 DisplayImplMap displays_;
52 47
53 mojom::VRServiceClientPtr client_; 48 mojom::VRServiceClientPtr client_;
54 49
55 bool listening_for_activate_; 50 bool listening_for_activate_;
56 51
57 std::unique_ptr<mojo::Binding<mojom::VRService>> binding_;
58
59 DISALLOW_COPY_AND_ASSIGN(VRServiceImpl); 52 DISALLOW_COPY_AND_ASSIGN(VRServiceImpl);
60 }; 53 };
61 54
62 } // namespace device 55 } // namespace device
63 56
64 #endif // DEVICE_VR_VR_SERVICE_IMPL_H 57 #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