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

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

Issue 26753005: Adding compositor callbacks to RenderWidgetHostViewAndroid (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change RWHVA to add itself to the compositor as per sievers@ comment Created 7 years, 2 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 "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/containers/scoped_ptr_hash_map.h" 10 #include "base/containers/scoped_ptr_hash_map.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 "base/observer_list.h"
13 #include "cc/resources/ui_resource_client.h" 14 #include "cc/resources/ui_resource_client.h"
14 #include "cc/trees/layer_tree_host_client.h" 15 #include "cc/trees/layer_tree_host_client.h"
15 #include "content/browser/renderer_host/image_transport_factory_android.h" 16 #include "content/browser/renderer_host/image_transport_factory_android.h"
16 #include "content/common/content_export.h" 17 #include "content/common/content_export.h"
17 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" 18 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
18 #include "content/public/browser/android/compositor.h" 19 #include "content/public/browser/android/compositor.h"
19 20
20 struct ANativeWindow; 21 struct ANativeWindow;
21 22
22 namespace cc { 23 namespace cc {
23 class InputHandlerClient; 24 class InputHandlerClient;
24 class Layer; 25 class Layer;
25 class LayerTreeHost; 26 class LayerTreeHost;
26 class ScopedUIResource; 27 class ScopedUIResource;
27 } 28 }
28 29
29 namespace content { 30 namespace content {
30 class CompositorClient; 31 class CompositorClient;
32 class CompositorObserver;
31 class GraphicsContext; 33 class GraphicsContext;
32 34
33 // ----------------------------------------------------------------------------- 35 // -----------------------------------------------------------------------------
34 // Browser-side compositor that manages a tree of content and UI layers. 36 // Browser-side compositor that manages a tree of content and UI layers.
35 // ----------------------------------------------------------------------------- 37 // -----------------------------------------------------------------------------
36 class CONTENT_EXPORT CompositorImpl 38 class CONTENT_EXPORT CompositorImpl
37 : public Compositor, 39 : public Compositor,
38 public cc::LayerTreeHostClient, 40 public cc::LayerTreeHostClient,
39 public WebGraphicsContext3DSwapBuffersClient, 41 public WebGraphicsContext3DSwapBuffersClient,
40 public ImageTransportFactoryAndroidObserver { 42 public ImageTransportFactoryAndroidObserver {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 virtual void WillBeginFrame() OVERRIDE {} 77 virtual void WillBeginFrame() OVERRIDE {}
76 virtual void DidBeginFrame() OVERRIDE {} 78 virtual void DidBeginFrame() OVERRIDE {}
77 virtual void Animate(double frame_begin_time) OVERRIDE {} 79 virtual void Animate(double frame_begin_time) OVERRIDE {}
78 virtual void Layout() OVERRIDE {} 80 virtual void Layout() OVERRIDE {}
79 virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta, 81 virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta,
80 float page_scale) OVERRIDE {} 82 float page_scale) OVERRIDE {}
81 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(bool fallback) 83 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(bool fallback)
82 OVERRIDE; 84 OVERRIDE;
83 virtual void DidInitializeOutputSurface(bool success) OVERRIDE {} 85 virtual void DidInitializeOutputSurface(bool success) OVERRIDE {}
84 virtual void WillCommit() OVERRIDE {} 86 virtual void WillCommit() OVERRIDE {}
85 virtual void DidCommit() OVERRIDE {} 87 virtual void DidCommit() OVERRIDE;
86 virtual void DidCommitAndDrawFrame() OVERRIDE {} 88 virtual void DidCommitAndDrawFrame() OVERRIDE {}
87 virtual void DidCompleteSwapBuffers() OVERRIDE; 89 virtual void DidCompleteSwapBuffers() OVERRIDE;
88 virtual void ScheduleComposite() OVERRIDE; 90 virtual void ScheduleComposite() OVERRIDE;
89 virtual scoped_refptr<cc::ContextProvider> 91 virtual scoped_refptr<cc::ContextProvider>
90 OffscreenContextProvider() OVERRIDE; 92 OffscreenContextProvider() OVERRIDE;
91 93
92 // WebGraphicsContext3DSwapBuffersClient implementation. 94 // WebGraphicsContext3DSwapBuffersClient implementation.
93 virtual void OnViewContextSwapBuffersPosted() OVERRIDE; 95 virtual void OnViewContextSwapBuffersPosted() OVERRIDE;
94 virtual void OnViewContextSwapBuffersComplete() OVERRIDE; 96 virtual void OnViewContextSwapBuffersComplete() OVERRIDE;
95 virtual void OnViewContextSwapBuffersAborted() OVERRIDE; 97 virtual void OnViewContextSwapBuffersAborted() OVERRIDE;
96 98
97 // ImageTransportFactoryAndroidObserver implementation. 99 // ImageTransportFactoryAndroidObserver implementation.
98 virtual void OnLostResources() OVERRIDE; 100 virtual void OnLostResources() OVERRIDE;
99 101
102 // Compositor does not own observers. It is the responsibility of the
103 // observer to remove itself when it is done observing.
104 virtual void AddObserver(CompositorObserver* observer) OVERRIDE;
105 virtual void RemoveObserver(CompositorObserver* observer) OVERRIDE;
106 virtual bool HasObserver(CompositorObserver* observer) OVERRIDE;
107
100 private: 108 private:
101 WebKit::WebGLId BuildBasicTexture(); 109 WebKit::WebGLId BuildBasicTexture();
102 WebKit::WGC3Denum GetGLFormatForBitmap(gfx::JavaBitmap& bitmap); 110 WebKit::WGC3Denum GetGLFormatForBitmap(gfx::JavaBitmap& bitmap);
103 WebKit::WGC3Denum GetGLTypeForBitmap(gfx::JavaBitmap& bitmap); 111 WebKit::WGC3Denum GetGLTypeForBitmap(gfx::JavaBitmap& bitmap);
104 112
105 scoped_refptr<cc::Layer> root_layer_; 113 scoped_refptr<cc::Layer> root_layer_;
106 scoped_ptr<cc::LayerTreeHost> host_; 114 scoped_ptr<cc::LayerTreeHost> host_;
107 115
108 gfx::Size size_; 116 gfx::Size size_;
109 bool has_transparent_background_; 117 bool has_transparent_background_;
110 118
111 ANativeWindow* window_; 119 ANativeWindow* window_;
112 int surface_id_; 120 int surface_id_;
113 121
114 CompositorClient* client_; 122 CompositorClient* client_;
115 base::WeakPtrFactory<CompositorImpl> weak_factory_; 123 base::WeakPtrFactory<CompositorImpl> weak_factory_;
116 124
117 scoped_refptr<cc::ContextProvider> null_offscreen_context_provider_; 125 scoped_refptr<cc::ContextProvider> null_offscreen_context_provider_;
118 126
119 typedef base::ScopedPtrHashMap<cc::UIResourceId, cc::ScopedUIResource> 127 typedef base::ScopedPtrHashMap<cc::UIResourceId, cc::ScopedUIResource>
120 UIResourceMap; 128 UIResourceMap;
121 UIResourceMap ui_resource_map_; 129 UIResourceMap ui_resource_map_;
122 130
131 ObserverList<CompositorObserver> observer_list_;
132
123 DISALLOW_COPY_AND_ASSIGN(CompositorImpl); 133 DISALLOW_COPY_AND_ASSIGN(CompositorImpl);
124 }; 134 };
125 135
126 } // namespace content 136 } // namespace content
127 137
128 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ 138 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698