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

Side by Side Diff: chrome/browser/android/vr_shell/vr_gl_thread.h

Issue 2833773005: Pause drawing webvr when the App button is pressed (Closed)
Patch Set: make UiBrowserInterface a raw ptr Created 3 years, 7 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 CHROME_BROWSER_ANDROID_VR_SHELL_VR_GL_THREAD_H_ 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_VR_GL_THREAD_H_
6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_GL_THREAD_H_ 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_GL_THREAD_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
13 #include "base/threading/thread.h" 13 #include "base/threading/thread.h"
14 #include "chrome/browser/android/vr_shell/vr_browser_interface.h"
14 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/ gvr_types.h" 15 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/ gvr_types.h"
15 16
16 namespace vr_shell { 17 namespace vr_shell {
17 18
18 class UiScene; 19 class UiScene;
19 class UiSceneManager; 20 class UiSceneManager;
20 class VrShell; 21 class VrShell;
21 class VrShellGl; 22 class VrShellGl;
22 23
23 class VrGLThread : public base::Thread { 24 class VrGLThread : public VrBrowserInterface, public base::Thread {
24 public: 25 public:
25 VrGLThread( 26 VrGLThread(
26 const base::WeakPtr<VrShell>& weak_vr_shell, 27 const base::WeakPtr<VrShell>& weak_vr_shell,
27 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner, 28 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner,
28 gvr_context* gvr_api, 29 gvr_context* gvr_api,
29 bool initially_web_vr, 30 bool initially_web_vr,
30 bool reprojected_rendering); 31 bool reprojected_rendering);
31 32
32 ~VrGLThread() override; 33 ~VrGLThread() override;
33 base::WeakPtr<VrShellGl> GetVrShellGl() { return weak_vr_shell_gl_; } 34 base::WeakPtr<VrShellGl> GetVrShellGl() { return weak_vr_shell_gl_; }
34 base::WeakPtr<UiSceneManager> GetSceneManager() { 35 base::WeakPtr<UiSceneManager> GetSceneManager() {
35 return weak_scene_manager_; 36 return weak_scene_manager_;
36 } 37 }
37 38
39 // VrBrowserInterface implementation.
40 void ContentSurfaceChanged(jobject surface) override;
41 void GvrDelegateReady() override;
42 void UpdateGamepadData(device::GvrGamepadData) override;
43 void AppButtonGesturePerformed(UiInterface::Direction direction) override;
44 void OnAppButtonClicked() override;
45 void ProcessContentGesture(
46 std::unique_ptr<blink::WebInputEvent> event) override;
47 void ForceExitVr() override;
48 void RunVRDisplayInfoCallback(
49 const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback,
50 device::mojom::VRDisplayInfoPtr* info) override;
51 void OnContentPaused(bool enabled) override;
52
38 protected: 53 protected:
39 void Init() override; 54 void Init() override;
40 void CleanUp() override; 55 void CleanUp() override;
41 56
42 private: 57 private:
43 // Created on GL thread. 58 // Created on GL thread.
44 std::unique_ptr<UiScene> scene_; 59 std::unique_ptr<UiScene> scene_;
45 std::unique_ptr<UiSceneManager> scene_manager_; 60 std::unique_ptr<UiSceneManager> scene_manager_;
46 base::WeakPtr<UiSceneManager> weak_scene_manager_; 61 base::WeakPtr<UiSceneManager> weak_scene_manager_;
47 std::unique_ptr<VrShellGl> vr_shell_gl_; 62 std::unique_ptr<VrShellGl> vr_shell_gl_;
48 base::WeakPtr<VrShellGl> weak_vr_shell_gl_; 63 base::WeakPtr<VrShellGl> weak_vr_shell_gl_;
49 64
50 // This state is used for initializing vr_shell_gl_. 65 // This state is used for initializing vr_shell_gl_.
51 base::WeakPtr<VrShell> weak_vr_shell_; 66 base::WeakPtr<VrShell> weak_vr_shell_;
52 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; 67 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
53 gvr_context* gvr_api_; 68 gvr_context* gvr_api_;
54 bool initially_web_vr_; 69 bool initially_web_vr_;
55 bool reprojected_rendering_; 70 bool reprojected_rendering_;
56 71
57 DISALLOW_COPY_AND_ASSIGN(VrGLThread); 72 DISALLOW_COPY_AND_ASSIGN(VrGLThread);
58 }; 73 };
59 74
60 } // namespace vr_shell 75 } // namespace vr_shell
61 76
62 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_GL_THREAD_H_ 77 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_GL_THREAD_H_
OLDNEW
« no previous file with comments | « chrome/browser/android/vr_shell/vr_browser_interface.h ('k') | chrome/browser/android/vr_shell/vr_gl_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698