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

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

Issue 731133002: Upstream ResourceManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add generated enum class to BUILD.gn Created 6 years, 1 month 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/resource_manager_impl.h"
15 #include "content/browser/android/ui_resource_provider_impl.h" 16 #include "content/browser/android/ui_resource_provider_impl.h"
16 #include "content/browser/renderer_host/image_transport_factory_android.h" 17 #include "content/browser/renderer_host/image_transport_factory_android.h"
17 #include "content/common/content_export.h" 18 #include "content/common/content_export.h"
18 #include "content/common/gpu/client/context_provider_command_buffer.h" 19 #include "content/common/gpu/client/context_provider_command_buffer.h"
19 #include "content/public/browser/android/compositor.h" 20 #include "content/public/browser/android/compositor.h"
20 #include "gpu/command_buffer/common/capabilities.h" 21 #include "gpu/command_buffer/common/capabilities.h"
21 #include "third_party/khronos/GLES2/gl2.h" 22 #include "third_party/khronos/GLES2/gl2.h"
22 #include "ui/base/android/system_ui_resource_manager.h" 23 #include "ui/base/android/system_ui_resource_manager.h"
23 #include "ui/base/android/window_android_compositor.h" 24 #include "ui/base/android/window_android_compositor.h"
24 25
25 class SkBitmap; 26 class SkBitmap;
26 struct ANativeWindow; 27 struct ANativeWindow;
27 28
28 namespace cc { 29 namespace cc {
29 class Layer; 30 class Layer;
30 class LayerTreeHost; 31 class LayerTreeHost;
31 } 32 }
32 33
33 namespace content { 34 namespace content {
34 class CompositorClient; 35 class CompositorClient;
36 class ResourceManager;
35 class UIResourceProvider; 37 class UIResourceProvider;
36 38
37 // ----------------------------------------------------------------------------- 39 // -----------------------------------------------------------------------------
38 // Browser-side compositor that manages a tree of content and UI layers. 40 // Browser-side compositor that manages a tree of content and UI layers.
39 // ----------------------------------------------------------------------------- 41 // -----------------------------------------------------------------------------
40 class CONTENT_EXPORT CompositorImpl 42 class CONTENT_EXPORT CompositorImpl
41 : public Compositor, 43 : public Compositor,
42 public cc::LayerTreeHostClient, 44 public cc::LayerTreeHostClient,
43 public cc::LayerTreeHostSingleThreadClient, 45 public cc::LayerTreeHostSingleThreadClient,
44 public ImageTransportFactoryAndroidObserver, 46 public ImageTransportFactoryAndroidObserver,
45 public ui::WindowAndroidCompositor { 47 public ui::WindowAndroidCompositor {
46 public: 48 public:
47 CompositorImpl(CompositorClient* client, gfx::NativeWindow root_window); 49 CompositorImpl(CompositorClient* client, gfx::NativeWindow root_window);
48 virtual ~CompositorImpl(); 50 virtual ~CompositorImpl();
49 51
50 static bool IsInitialized(); 52 static bool IsInitialized();
51 53
52 void PopulateGpuCapabilities(gpu::Capabilities gpu_capabilities); 54 void PopulateGpuCapabilities(gpu::Capabilities gpu_capabilities);
53 55
54 private: 56 private:
55 // Compositor implementation. 57 // Compositor implementation.
56 virtual void SetRootLayer(scoped_refptr<cc::Layer> root) override; 58 virtual void SetRootLayer(scoped_refptr<cc::Layer> root) override;
57 virtual void SetSurface(jobject surface) override; 59 virtual void SetSurface(jobject surface) override;
58 virtual void SetVisible(bool visible) override; 60 virtual void SetVisible(bool visible) override;
59 virtual void setDeviceScaleFactor(float factor) override; 61 virtual void setDeviceScaleFactor(float factor) override;
60 virtual void SetWindowBounds(const gfx::Size& size) override; 62 virtual void SetWindowBounds(const gfx::Size& size) override;
61 virtual void SetHasTransparentBackground(bool flag) override; 63 virtual void SetHasTransparentBackground(bool flag) override;
62 virtual void SetNeedsComposite() override; 64 virtual void SetNeedsComposite() override;
63 virtual UIResourceProvider& GetUIResourceProvider() override; 65 virtual UIResourceProvider& GetUIResourceProvider() override;
66 virtual ResourceManager* GetResourceManager() override;
64 67
65 // LayerTreeHostClient implementation. 68 // LayerTreeHostClient implementation.
66 virtual void WillBeginMainFrame(int frame_id) override {} 69 virtual void WillBeginMainFrame(int frame_id) override {}
67 virtual void DidBeginMainFrame() override {} 70 virtual void DidBeginMainFrame() override {}
68 virtual void BeginMainFrame(const cc::BeginFrameArgs& args) override {} 71 virtual void BeginMainFrame(const cc::BeginFrameArgs& args) override {}
69 virtual void Layout() override; 72 virtual void Layout() override;
70 virtual void ApplyViewportDeltas( 73 virtual void ApplyViewportDeltas(
71 const gfx::Vector2d& inner_delta, 74 const gfx::Vector2d& inner_delta,
72 const gfx::Vector2d& outer_delta, 75 const gfx::Vector2d& outer_delta,
73 float page_scale, 76 float page_scale,
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 } 137 }
135 void OnGpuChannelEstablished(); 138 void OnGpuChannelEstablished();
136 139
137 // root_layer_ is the persistent internal root layer, while subroot_layer_ 140 // root_layer_ is the persistent internal root layer, while subroot_layer_
138 // is the one attached by the compositor client. 141 // is the one attached by the compositor client.
139 scoped_refptr<cc::Layer> root_layer_; 142 scoped_refptr<cc::Layer> root_layer_;
140 scoped_refptr<cc::Layer> subroot_layer_; 143 scoped_refptr<cc::Layer> subroot_layer_;
141 144
142 scoped_ptr<cc::LayerTreeHost> host_; 145 scoped_ptr<cc::LayerTreeHost> host_;
143 content::UIResourceProviderImpl ui_resource_provider_; 146 content::UIResourceProviderImpl ui_resource_provider_;
147 scoped_ptr<content::ResourceManagerImpl> resource_manager_;
144 148
145 gfx::Size size_; 149 gfx::Size size_;
146 bool has_transparent_background_; 150 bool has_transparent_background_;
147 float device_scale_factor_; 151 float device_scale_factor_;
148 152
149 ANativeWindow* window_; 153 ANativeWindow* window_;
150 int surface_id_; 154 int surface_id_;
151 155
152 CompositorClient* client_; 156 CompositorClient* client_;
153 157
(...skipping 30 matching lines...) Expand all
184 base::TimeTicks last_vsync_; 188 base::TimeTicks last_vsync_;
185 189
186 base::WeakPtrFactory<CompositorImpl> weak_factory_; 190 base::WeakPtrFactory<CompositorImpl> weak_factory_;
187 191
188 DISALLOW_COPY_AND_ASSIGN(CompositorImpl); 192 DISALLOW_COPY_AND_ASSIGN(CompositorImpl);
189 }; 193 };
190 194
191 } // namespace content 195 } // namespace content
192 196
193 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ 197 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698