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

Side by Side Diff: content/browser/renderer_host/compositor_impl_android.h

Issue 2595263002: Introduce ViewRoot forwarding input/view events to native (Closed)
Patch Set: unittest Created 3 years, 11 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 22 matching lines...) Expand all
33 33
34 namespace cc { 34 namespace cc {
35 class AnimationHost; 35 class AnimationHost;
36 class Display; 36 class Display;
37 class Layer; 37 class Layer;
38 class LayerTreeHost; 38 class LayerTreeHost;
39 class OutputSurface; 39 class OutputSurface;
40 class VulkanContextProvider; 40 class VulkanContextProvider;
41 } 41 }
42 42
43 namespace ui {
44 class ViewRoot;
45 }
46
43 namespace content { 47 namespace content {
44 class CompositorClient; 48 class CompositorClient;
45 49
46 // ----------------------------------------------------------------------------- 50 // -----------------------------------------------------------------------------
47 // Browser-side compositor that manages a tree of content and UI layers. 51 // Browser-side compositor that manages a tree of content and UI layers.
48 // ----------------------------------------------------------------------------- 52 // -----------------------------------------------------------------------------
49 class CONTENT_EXPORT CompositorImpl 53 class CONTENT_EXPORT CompositorImpl
50 : public Compositor, 54 : public Compositor,
51 public cc::LayerTreeHostClient, 55 public cc::LayerTreeHostClient,
52 public cc::LayerTreeHostSingleThreadClient, 56 public cc::LayerTreeHostSingleThreadClient,
53 public ui::UIResourceProvider, 57 public ui::UIResourceProvider,
54 public ui::WindowAndroidCompositor { 58 public ui::WindowAndroidCompositor {
55 public: 59 public:
56 CompositorImpl(CompositorClient* client, gfx::NativeWindow root_window); 60 CompositorImpl(CompositorClient* client, ui::ViewRoot* view_root);
57 ~CompositorImpl() override; 61 ~CompositorImpl() override;
58 62
59 static bool IsInitialized(); 63 static bool IsInitialized();
60 64
61 // ui::ResourceProvider implementation. 65 // ui::ResourceProvider implementation.
62 cc::UIResourceId CreateUIResource(cc::UIResourceClient* client) override; 66 cc::UIResourceId CreateUIResource(cc::UIResourceClient* client) override;
63 void DeleteUIResource(cc::UIResourceId resource_id) override; 67 void DeleteUIResource(cc::UIResourceId resource_id) override;
64 bool SupportsETC1NonPowerOfTwo() const override; 68 bool SupportsETC1NonPowerOfTwo() const override;
65 69
66 private: 70 private:
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 void InitializeDisplay( 122 void InitializeDisplay(
119 std::unique_ptr<cc::OutputSurface> display_output_surface, 123 std::unique_ptr<cc::OutputSurface> display_output_surface,
120 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider, 124 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider,
121 scoped_refptr<cc::ContextProvider> context_provider); 125 scoped_refptr<cc::ContextProvider> context_provider);
122 126
123 bool HavePendingReadbacks(); 127 bool HavePendingReadbacks();
124 void SetBackgroundColor(int color); 128 void SetBackgroundColor(int color);
125 129
126 cc::FrameSinkId frame_sink_id_; 130 cc::FrameSinkId frame_sink_id_;
127 131
128 // root_layer_ is the persistent internal root layer, while subroot_layer_ 132 // Layer in |view_root_| is the persistent internal root layer,
129 // is the one attached by the compositor client. 133 // while subroot_layer_ is the one attached by the compositor client.
130 scoped_refptr<cc::Layer> subroot_layer_; 134 scoped_refptr<cc::Layer> subroot_layer_;
131 135
132 // Subtree for hidden layers with CopyOutputRequests on them. 136 // Subtree for hidden layers with CopyOutputRequests on them.
133 scoped_refptr<cc::Layer> readback_layer_tree_; 137 scoped_refptr<cc::Layer> readback_layer_tree_;
134 138
135 // Destruction order matters here: 139 // Destruction order matters here:
136 std::unique_ptr<cc::AnimationHost> animation_host_; 140 std::unique_ptr<cc::AnimationHost> animation_host_;
137 std::unique_ptr<cc::LayerTreeHost> host_; 141 std::unique_ptr<cc::LayerTreeHost> host_;
138 ui::ResourceManagerImpl resource_manager_; 142 ui::ResourceManagerImpl resource_manager_;
139 143
140 std::unique_ptr<cc::Display> display_; 144 std::unique_ptr<cc::Display> display_;
141 145
142 gfx::Size size_; 146 gfx::Size size_;
143 bool has_transparent_background_; 147 bool has_transparent_background_;
144 148
145 ANativeWindow* window_; 149 ANativeWindow* window_;
146 gpu::SurfaceHandle surface_handle_; 150 gpu::SurfaceHandle surface_handle_;
147 151
148 CompositorClient* client_; 152 CompositorClient* client_;
149 153
150 gfx::NativeWindow root_window_; 154 gfx::NativeWindow root_window_;
155 ui::ViewRoot* view_root_;
151 156
152 // Whether we need to update animations on the next composite. 157 // Whether we need to update animations on the next composite.
153 bool needs_animate_; 158 bool needs_animate_;
154 159
155 // The number of SwapBuffer calls that have not returned and ACK'd from 160 // The number of SwapBuffer calls that have not returned and ACK'd from
156 // the GPU thread. 161 // the GPU thread.
157 unsigned int pending_swapbuffers_; 162 unsigned int pending_swapbuffers_;
158 163
159 size_t num_successive_context_creation_failures_; 164 size_t num_successive_context_creation_failures_;
160 165
161 // Whether there is an CompositorFrameSink request pending from the current 166 // Whether there is an CompositorFrameSink request pending from the current
162 // |host_|. Becomes |true| if RequestNewCompositorFrameSink is called, and 167 // |host_|. Becomes |true| if RequestNewCompositorFrameSink is called, and
163 // |false| if |host_| is deleted or we succeed in creating *and* initializing 168 // |false| if |host_| is deleted or we succeed in creating *and* initializing
164 // a CompositorFrameSink (which is essentially the contract with cc). 169 // a CompositorFrameSink (which is essentially the contract with cc).
165 bool compositor_frame_sink_request_pending_; 170 bool compositor_frame_sink_request_pending_;
166 171
167 gpu::Capabilities gpu_capabilities_; 172 gpu::Capabilities gpu_capabilities_;
168 base::WeakPtrFactory<CompositorImpl> weak_factory_; 173 base::WeakPtrFactory<CompositorImpl> weak_factory_;
169 174
170 DISALLOW_COPY_AND_ASSIGN(CompositorImpl); 175 DISALLOW_COPY_AND_ASSIGN(CompositorImpl);
171 }; 176 };
172 177
173 } // namespace content 178 } // namespace content
174 179
175 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ 180 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_
OLDNEW
« no previous file with comments | « content/browser/android/content_view_render_view.cc ('k') | content/browser/renderer_host/compositor_impl_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698