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

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

Issue 2299613003: New Compositor and tab content
Patch Set: more clean up Created 4 years, 3 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 | « chrome/android/java_sources.gni ('k') | chrome/browser/android/vr_shell/vr_shell.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 CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_
6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 #include <memory> 9 #include <memory>
10 10
11 #include "base/android/jni_weak_ref.h" 11 #include "base/android/jni_weak_ref.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "third_party/gvr-android-sdk/src/ndk-beta/include/vr/gvr/capi/include/g vr.h" 13 #include "third_party/gvr-android-sdk/src/ndk-beta/include/vr/gvr/capi/include/g vr.h"
14 #include "third_party/gvr-android-sdk/src/ndk-beta/include/vr/gvr/capi/include/g vr_types.h" 14 #include "third_party/gvr-android-sdk/src/ndk-beta/include/vr/gvr/capi/include/g vr_types.h"
15 #include "base/memory/weak_ptr.h"
16 #include "cc/layers/layer_collections.h"
17 #include "cc/resources/ui_resource_client.h"
18 #include "content/public/browser/android/compositor_client.h"
19 #include "content/public/browser/browser_child_process_observer.h"
20 #include "third_party/skia/include/core/SkColor.h"
21
22 class DecorationBackground;
23 class DecorationCounter;
24 class SkBitmap;
25 class TabLayerContainer;
26
27 namespace cc {
28 class Layer;
29 class SolidColorLayer;
30 class TextureLayer;
31 class UIResourceBitmap;
32 }
33
34 namespace content {
35 class Compositor;
36 class RenderWidgetHostViewAndroid;
37 }
38
39 namespace ui {
40 class WindowAndroid;
41 class ResourceManager;
42 class UIResourceProvider;
43 class ViewAndroid;
44 }
45 namespace chrome {
46 namespace android {
47
48 class LayerTitleCache;
49 class SceneLayer;
50 class TabContentManager;
51 class ToolbarLayer;
52 }
53 }
15 54
16 namespace vr_shell { 55 namespace vr_shell {
17 56
18 class VrShellRenderer; 57 class VrShellRenderer;
19 58
20 class ContentRect { 59 class ContentRect {
21 public: 60 public:
22 ContentRect(); 61 ContentRect();
23 ~ContentRect(); 62 ~ContentRect();
24 void SetIdentity(); 63 void SetIdentity();
25 void Translate(float x, float y, float z); 64 void Translate(float x, float y, float z);
26 gvr::Mat4f transfrom_to_world; 65 gvr::Mat4f transfrom_to_world;
27 int content_texture_handle; 66 int content_texture_handle;
28 }; 67 };
29 68
30 class VrShell { 69 class VrShell : public content::CompositorClient,
70 public content::BrowserChildProcessObserver {
31 public: 71 public:
32 VrShell(JNIEnv* env, jobject obj); 72 VrShell(JNIEnv* env,
73 jobject obj,
74 jboolean low_mem_device,
75 ui::WindowAndroid* window_android);
33 76
34 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); 77 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj);
35 78
36 void GvrInit(JNIEnv* env, 79 void GvrInit(JNIEnv* env,
37 const base::android::JavaParamRef<jobject>& obj, 80 const base::android::JavaParamRef<jobject>& obj,
38 jlong native_gvr_api); 81 jlong native_gvr_api);
39 void InitializeGl(JNIEnv* env, 82 void InitializeGl(JNIEnv* env,
40 const base::android::JavaParamRef<jobject>& obj, 83 const base::android::JavaParamRef<jobject>& obj,
41 jint texture_data_handle); 84 jint texture_data_handle);
42 void DrawFrame(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); 85 void DrawFrame(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj);
43 void OnPause(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); 86 void OnPause(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj);
44 void OnResume(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); 87 void OnResume(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj);
45 88
89 // CompositorClient implementation:
90 void UpdateLayerTreeHost() override;
91 void OnSwapBuffersCompleted(int pending_swap_buffers) override;
92 ui::UIResourceProvider* GetUIResourceProvider();
93
94 void OnWebContentsReady(
95 JNIEnv* env,
96 const base::android::JavaParamRef<jobject>& object,
97 const base::android::JavaParamRef<jobject>& jweb_contents);
98
99 void SurfaceCreated(JNIEnv* env,
100 const base::android::JavaParamRef<jobject>& object);
101 void SurfaceDestroyed(JNIEnv* env,
102 const base::android::JavaParamRef<jobject>& object);
103 void SurfaceChanged(JNIEnv* env,
104 const base::android::JavaParamRef<jobject>& object,
105 jint format,
106 jint width,
107 jint height,
108 const base::android::JavaParamRef<jobject>& surface);
109 void SetNeedsComposite(JNIEnv* env,
110 const base::android::JavaParamRef<jobject>& object);
111
46 private: 112 private:
47 ~VrShell(); 113 ~VrShell() override;
48 114
49 void DrawEye(const gvr::Mat4f& view_matrix, 115 void DrawEye(const gvr::Mat4f& view_matrix,
50 const gvr::BufferViewport& params); 116 const gvr::BufferViewport& params);
51 void DrawContentRect(); 117 void DrawContentRect();
52 118
119 void AddContentLayer();
120
121 // content::BrowserChildProcessObserver implementation:
122 void BrowserChildProcessHostDisconnected(
123 const content::ChildProcessData& data) override;
124 void BrowserChildProcessCrashed(const content::ChildProcessData& data,
125 int exit_code) override;
126
53 std::unique_ptr<ContentRect> content_rect_; 127 std::unique_ptr<ContentRect> content_rect_;
54 std::unique_ptr<gvr::GvrApi> gvr_api_; 128 std::unique_ptr<gvr::GvrApi> gvr_api_;
55 std::unique_ptr<gvr::BufferViewportList> buffer_viewport_list_; 129 std::unique_ptr<gvr::BufferViewportList> buffer_viewport_list_;
56 std::unique_ptr<gvr::BufferViewport> buffer_viewport_; 130 std::unique_ptr<gvr::BufferViewport> buffer_viewport_;
57 std::unique_ptr<gvr::SwapChain> swap_chain_; 131 std::unique_ptr<gvr::SwapChain> swap_chain_;
58 132
59 gvr::Mat4f view_matrix_; 133 gvr::Mat4f view_matrix_;
60 gvr::Mat4f projection_matrix_; 134 gvr::Mat4f projection_matrix_;
61 135
62 gvr::Mat4f head_pose_; 136 gvr::Mat4f head_pose_;
63 137
64 gvr::Sizei render_size_; 138 gvr::Sizei render_size_;
65 139
66 std::unique_ptr<VrShellRenderer> vr_shell_renderer_; 140 std::unique_ptr<VrShellRenderer> vr_shell_renderer_;
67 141
68 base::android::ScopedJavaGlobalRef<jobject> j_vr_shell_; 142 base::android::ScopedJavaGlobalRef<jobject> j_vr_shell_;
143 std::unique_ptr<content::Compositor> compositor_;
144
145 scoped_refptr<cc::SolidColorLayer> root_layer_;
146
147 int current_surface_format_;
148 int content_width_;
149 int content_height_;
150
151 base::WeakPtrFactory<VrShell> weak_factory_;
69 152
70 DISALLOW_COPY_AND_ASSIGN(VrShell); 153 DISALLOW_COPY_AND_ASSIGN(VrShell);
71 }; 154 };
72 155
73 bool RegisterVrShell(JNIEnv* env); 156 bool RegisterVrShell(JNIEnv* env);
74 157
75 } // namespace vr_shell 158 } // namespace vr_shell
76 159
77 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ 160 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_
OLDNEW
« no previous file with comments | « chrome/android/java_sources.gni ('k') | chrome/browser/android/vr_shell/vr_shell.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698