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

Side by Side Diff: device/vr/android/gvr/gvr_gamepad_data_fetcher.h

Issue 2570553004: Clean up some VrShell threading issues and remove unnecessary WeakPtr types. (Closed)
Patch Set: rebase 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
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_ANDROID_GVR_GAMEPAD_DATA_FETCHER_H_ 5 #ifndef DEVICE_VR_ANDROID_GVR_GAMEPAD_DATA_FETCHER_H_
6 #define DEVICE_VR_ANDROID_GVR_GAMEPAD_DATA_FETCHER_H_ 6 #define DEVICE_VR_ANDROID_GVR_GAMEPAD_DATA_FETCHER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/weak_ptr.h"
11 #include "device/gamepad/gamepad_data_fetcher.h" 10 #include "device/gamepad/gamepad_data_fetcher.h"
12 #include "third_party/gvr-android-sdk/src/ndk/include/vr/gvr/capi/include/gvr_co ntroller.h" 11 #include "third_party/gvr-android-sdk/src/ndk/include/vr/gvr/capi/include/gvr_co ntroller.h"
13 #include "third_party/gvr-android-sdk/src/ndk/include/vr/gvr/capi/include/gvr_ty pes.h" 12 #include "third_party/gvr-android-sdk/src/ndk/include/vr/gvr/capi/include/gvr_ty pes.h"
14 13
15 namespace device { 14 namespace device {
16 15
17 class GvrDelegate; 16 class GvrDelegate;
18 17
19 class GvrGamepadDataFetcher : public GamepadDataFetcher { 18 class GvrGamepadDataFetcher : public GamepadDataFetcher {
20 public: 19 public:
21 class Factory : public GamepadDataFetcherFactory { 20 class Factory : public GamepadDataFetcherFactory {
22 public: 21 public:
23 Factory(const base::WeakPtr<GvrDelegate>& delegate, 22 Factory(GvrDelegate* delegate, unsigned int display_id);
24 unsigned int display_id);
25 ~Factory() override; 23 ~Factory() override;
26 std::unique_ptr<GamepadDataFetcher> CreateDataFetcher() override; 24 std::unique_ptr<GamepadDataFetcher> CreateDataFetcher() override;
27 GamepadSource source() override; 25 GamepadSource source() override;
28 26
29 private: 27 private:
30 base::WeakPtr<GvrDelegate> delegate_; 28 GvrDelegate* delegate_;
31 unsigned int display_id_; 29 unsigned int display_id_;
32 }; 30 };
33 31
34 GvrGamepadDataFetcher(GvrDelegate* delegate, unsigned int display_id); 32 GvrGamepadDataFetcher(GvrDelegate* delegate, unsigned int display_id);
35 ~GvrGamepadDataFetcher() override; 33 ~GvrGamepadDataFetcher() override;
36 34
37 GamepadSource source() override; 35 GamepadSource source() override;
38 36
39 void GetGamepadData(bool devices_changed_hint) override; 37 void GetGamepadData(bool devices_changed_hint) override;
40 void PauseHint(bool paused) override; 38 void PauseHint(bool paused) override;
41 void OnAddedToProvider() override; 39 void OnAddedToProvider() override;
42 40
43 private: 41 private:
44 std::unique_ptr<gvr::ControllerApi> controller_api_; 42 std::unique_ptr<gvr::ControllerApi> controller_api_;
45 gvr::ControllerState controller_state_; 43 gvr::ControllerState controller_state_;
46 gvr::ControllerHandedness handedness_; 44 gvr::ControllerHandedness handedness_;
47 unsigned int display_id_; 45 unsigned int display_id_;
48 46
49 DISALLOW_COPY_AND_ASSIGN(GvrGamepadDataFetcher); 47 DISALLOW_COPY_AND_ASSIGN(GvrGamepadDataFetcher);
50 }; 48 };
51 49
52 } // namespace device 50 } // namespace device
53 #endif // DEVICE_VR_ANDROID_GVR_GAMEPAD_DATA_FETCHER_H_ 51 #endif // DEVICE_VR_ANDROID_GVR_GAMEPAD_DATA_FETCHER_H_
OLDNEW
« no previous file with comments | « device/vr/android/gvr/gvr_device_provider.cc ('k') | device/vr/android/gvr/gvr_gamepad_data_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698