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

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

Issue 755643004: Replace SystemUIResourceManager with ResourceManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add unittest Created 6 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 (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 "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/cancelable_callback.h" 9 #include "base/cancelable_callback.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "cc/trees/layer_tree_host_client.h" 13 #include "cc/trees/layer_tree_host_client.h"
14 #include "cc/trees/layer_tree_host_single_thread_client.h" 14 #include "cc/trees/layer_tree_host_single_thread_client.h"
15 #include "content/browser/android/ui_resource_provider_impl.h"
16 #include "content/common/content_export.h" 15 #include "content/common/content_export.h"
17 #include "content/common/gpu/client/context_provider_command_buffer.h" 16 #include "content/common/gpu/client/context_provider_command_buffer.h"
18 #include "content/public/browser/android/compositor.h" 17 #include "content/public/browser/android/compositor.h"
19 #include "gpu/command_buffer/common/capabilities.h" 18 #include "gpu/command_buffer/common/capabilities.h"
20 #include "third_party/khronos/GLES2/gl2.h" 19 #include "third_party/khronos/GLES2/gl2.h"
21 #include "ui/android/resources/resource_manager.h" 20 #include "ui/android/resources/resource_manager.h"
21 #include "ui/android/resources/ui_resource_provider.h"
22 #include "ui/base/android/system_ui_resource_manager.h" 22 #include "ui/base/android/system_ui_resource_manager.h"
23 #include "ui/base/android/window_android_compositor.h" 23 #include "ui/base/android/window_android_compositor.h"
24 24
25 class SkBitmap; 25 class SkBitmap;
26 struct ANativeWindow; 26 struct ANativeWindow;
27 27
28 namespace cc { 28 namespace cc {
29 class Layer; 29 class Layer;
30 class LayerTreeHost; 30 class LayerTreeHost;
31 class SurfaceIdAllocator; 31 class SurfaceIdAllocator;
32 } 32 }
33 33
34 namespace content { 34 namespace content {
35 class CompositorClient; 35 class CompositorClient;
36 class OnscreenDisplayClient; 36 class OnscreenDisplayClient;
37 class UIResourceProvider;
38 37
39 // ----------------------------------------------------------------------------- 38 // -----------------------------------------------------------------------------
40 // Browser-side compositor that manages a tree of content and UI layers. 39 // Browser-side compositor that manages a tree of content and UI layers.
41 // ----------------------------------------------------------------------------- 40 // -----------------------------------------------------------------------------
42 class CONTENT_EXPORT CompositorImpl 41 class CONTENT_EXPORT CompositorImpl
43 : public Compositor, 42 : public Compositor,
44 public cc::LayerTreeHostClient, 43 public cc::LayerTreeHostClient,
45 public cc::LayerTreeHostSingleThreadClient, 44 public cc::LayerTreeHostSingleThreadClient,
46 public ui::WindowAndroidCompositor { 45 public ui::WindowAndroidCompositor {
47 public: 46 public:
48 CompositorImpl(CompositorClient* client, gfx::NativeWindow root_window); 47 CompositorImpl(CompositorClient* client, gfx::NativeWindow root_window);
49 virtual ~CompositorImpl(); 48 virtual ~CompositorImpl();
50 49
51 static bool IsInitialized(); 50 static bool IsInitialized();
52 51
53 void PopulateGpuCapabilities(gpu::Capabilities gpu_capabilities); 52 void PopulateGpuCapabilities(gpu::Capabilities gpu_capabilities);
54 53
55 private: 54 private:
56 // Compositor implementation. 55 // Compositor implementation.
57 virtual void SetRootLayer(scoped_refptr<cc::Layer> root) override; 56 virtual void SetRootLayer(scoped_refptr<cc::Layer> root) override;
58 virtual void SetSurface(jobject surface) override; 57 virtual void SetSurface(jobject surface) override;
59 virtual void SetVisible(bool visible) override; 58 virtual void SetVisible(bool visible) override;
60 virtual void setDeviceScaleFactor(float factor) override; 59 virtual void setDeviceScaleFactor(float factor) override;
61 virtual void SetWindowBounds(const gfx::Size& size) override; 60 virtual void SetWindowBounds(const gfx::Size& size) override;
62 virtual void SetHasTransparentBackground(bool flag) override; 61 virtual void SetHasTransparentBackground(bool flag) override;
63 virtual void SetNeedsComposite() override; 62 virtual void SetNeedsComposite() override;
64 virtual UIResourceProvider& GetUIResourceProvider() override; 63 virtual ui::UIResourceProvider& GetUIResourceProvider() override;
65 virtual ui::ResourceManager& GetResourceManager() override; 64 virtual ui::ResourceManager& GetResourceManager() override;
66 65
67 // LayerTreeHostClient implementation. 66 // LayerTreeHostClient implementation.
68 virtual void WillBeginMainFrame(int frame_id) override {} 67 virtual void WillBeginMainFrame(int frame_id) override {}
69 virtual void DidBeginMainFrame() override {} 68 virtual void DidBeginMainFrame() override {}
70 virtual void BeginMainFrame(const cc::BeginFrameArgs& args) override {} 69 virtual void BeginMainFrame(const cc::BeginFrameArgs& args) override {}
71 virtual void Layout() override; 70 virtual void Layout() override;
72 virtual void ApplyViewportDeltas( 71 virtual void ApplyViewportDeltas(
73 const gfx::Vector2d& inner_delta, 72 const gfx::Vector2d& inner_delta,
74 const gfx::Vector2d& outer_delta, 73 const gfx::Vector2d& outer_delta,
(...skipping 16 matching lines...) Expand all
91 virtual void DidPostSwapBuffers() override; 90 virtual void DidPostSwapBuffers() override;
92 virtual void DidAbortSwapBuffers() override; 91 virtual void DidAbortSwapBuffers() override;
93 92
94 // WindowAndroidCompositor implementation. 93 // WindowAndroidCompositor implementation.
95 virtual void AttachLayerForReadback(scoped_refptr<cc::Layer> layer) override; 94 virtual void AttachLayerForReadback(scoped_refptr<cc::Layer> layer) override;
96 virtual void RequestCopyOfOutputOnRootLayer( 95 virtual void RequestCopyOfOutputOnRootLayer(
97 scoped_ptr<cc::CopyOutputRequest> request) override; 96 scoped_ptr<cc::CopyOutputRequest> request) override;
98 virtual void OnVSync(base::TimeTicks frame_time, 97 virtual void OnVSync(base::TimeTicks frame_time,
99 base::TimeDelta vsync_period) override; 98 base::TimeDelta vsync_period) override;
100 virtual void SetNeedsAnimate() override; 99 virtual void SetNeedsAnimate() override;
101 virtual ui::SystemUIResourceManager& GetSystemUIResourceManager() override; 100 virtual ui::SystemUIResourceManager& GetSystemUIResourceManager() override;
jdduke (slow) 2014/12/09 16:11:07 It's a little unclear why GetSystemUIResourceManag
Jaekyun Seok (inactive) 2014/12/09 23:35:22 I will remove SystemUIResourceManager and add GetR
102 101
103 void SetWindowSurface(ANativeWindow* window); 102 void SetWindowSurface(ANativeWindow* window);
104 103
105 enum CompositingTrigger { 104 enum CompositingTrigger {
106 DO_NOT_COMPOSITE, 105 DO_NOT_COMPOSITE,
107 COMPOSITE_IMMEDIATELY, 106 COMPOSITE_IMMEDIATELY,
108 COMPOSITE_EVENTUALLY, 107 COMPOSITE_EVENTUALLY,
109 }; 108 };
110 void PostComposite(CompositingTrigger trigger); 109 void PostComposite(CompositingTrigger trigger);
111 void Composite(CompositingTrigger trigger); 110 void Composite(CompositingTrigger trigger);
(...skipping 22 matching lines...) Expand all
134 } 133 }
135 void CreateLayerTreeHost(); 134 void CreateLayerTreeHost();
136 void OnGpuChannelEstablished(); 135 void OnGpuChannelEstablished();
137 136
138 // root_layer_ is the persistent internal root layer, while subroot_layer_ 137 // root_layer_ is the persistent internal root layer, while subroot_layer_
139 // is the one attached by the compositor client. 138 // is the one attached by the compositor client.
140 scoped_refptr<cc::Layer> root_layer_; 139 scoped_refptr<cc::Layer> root_layer_;
141 scoped_refptr<cc::Layer> subroot_layer_; 140 scoped_refptr<cc::Layer> subroot_layer_;
142 141
143 scoped_ptr<cc::LayerTreeHost> host_; 142 scoped_ptr<cc::LayerTreeHost> host_;
144 content::UIResourceProviderImpl ui_resource_provider_; 143 ui::UIResourceProvider ui_resource_provider_;
145 ui::ResourceManager resource_manager_; 144 ui::ResourceManager resource_manager_;
146 145
147 scoped_ptr<OnscreenDisplayClient> display_client_; 146 scoped_ptr<OnscreenDisplayClient> display_client_;
148 scoped_ptr<cc::SurfaceIdAllocator> surface_id_allocator_; 147 scoped_ptr<cc::SurfaceIdAllocator> surface_id_allocator_;
149 148
150 gfx::Size size_; 149 gfx::Size size_;
151 bool has_transparent_background_; 150 bool has_transparent_background_;
152 float device_scale_factor_; 151 float device_scale_factor_;
153 152
154 ANativeWindow* window_; 153 ANativeWindow* window_;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 base::TimeTicks last_vsync_; 193 base::TimeTicks last_vsync_;
195 194
196 base::WeakPtrFactory<CompositorImpl> weak_factory_; 195 base::WeakPtrFactory<CompositorImpl> weak_factory_;
197 196
198 DISALLOW_COPY_AND_ASSIGN(CompositorImpl); 197 DISALLOW_COPY_AND_ASSIGN(CompositorImpl);
199 }; 198 };
200 199
201 } // namespace content 200 } // namespace content
202 201
203 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ 202 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698