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

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

Issue 2658643003: Refactor GvrDelegate ownership into GvrDelegateProvider and fix more threading violations. (Closed)
Patch Set: Address comments Created 3 years, 10 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
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 "device/gamepad/gamepad_data_fetcher.h" 10 #include "device/gamepad/gamepad_data_fetcher.h"
11 #include "device/vr/vr_export.h"
11 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/ gvr_controller.h" 12 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/ gvr_controller.h"
12 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/ gvr_types.h" 13 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/ gvr_types.h"
13 14
14 namespace device { 15 namespace device {
15 16
16 class GvrDelegate; 17 class DEVICE_VR_EXPORT GvrGamepadDataFetcher : public GamepadDataFetcher {
17
18 class GvrGamepadDataFetcher : public GamepadDataFetcher {
19 public: 18 public:
20 class Factory : public GamepadDataFetcherFactory { 19 class Factory : public GamepadDataFetcherFactory {
21 public: 20 public:
22 Factory(GvrDelegate* delegate, unsigned int display_id); 21 Factory(gvr_context* context, unsigned int display_id);
23 ~Factory() override; 22 ~Factory() override;
24 std::unique_ptr<GamepadDataFetcher> CreateDataFetcher() override; 23 std::unique_ptr<GamepadDataFetcher> CreateDataFetcher() override;
25 GamepadSource source() override; 24 GamepadSource source() override;
26 25
27 private: 26 private:
28 GvrDelegate* delegate_; 27 gvr_context* context_;
29 unsigned int display_id_; 28 unsigned int display_id_;
30 }; 29 };
31 30
32 GvrGamepadDataFetcher(GvrDelegate* delegate, unsigned int display_id); 31 GvrGamepadDataFetcher(gvr_context* context, unsigned int display_id);
33 ~GvrGamepadDataFetcher() override; 32 ~GvrGamepadDataFetcher() override;
34 33
35 GamepadSource source() override; 34 GamepadSource source() override;
36 35
37 void GetGamepadData(bool devices_changed_hint) override; 36 void GetGamepadData(bool devices_changed_hint) override;
38 void PauseHint(bool paused) override; 37 void PauseHint(bool paused) override;
39 void OnAddedToProvider() override; 38 void OnAddedToProvider() override;
40 39
41 private: 40 private:
42 std::unique_ptr<gvr::ControllerApi> controller_api_; 41 std::unique_ptr<gvr::ControllerApi> controller_api_;
43 gvr::ControllerState controller_state_; 42 gvr::ControllerState controller_state_;
44 gvr::ControllerHandedness handedness_; 43 gvr::ControllerHandedness handedness_;
45 unsigned int display_id_; 44 unsigned int display_id_;
46 45
47 DISALLOW_COPY_AND_ASSIGN(GvrGamepadDataFetcher); 46 DISALLOW_COPY_AND_ASSIGN(GvrGamepadDataFetcher);
48 }; 47 };
49 48
50 } // namespace device 49 } // namespace device
51 #endif // DEVICE_VR_ANDROID_GVR_GAMEPAD_DATA_FETCHER_H_ 50 #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