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

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: removed blank lines 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 virtual void WillBeginFrame() OVERRIDE {} 78 virtual void WillBeginFrame() OVERRIDE {}
77 virtual void DidBeginFrame() OVERRIDE {} 79 virtual void DidBeginFrame() OVERRIDE {}
78 virtual void Animate(double frame_begin_time) OVERRIDE {} 80 virtual void Animate(double frame_begin_time) OVERRIDE {}
79 virtual void Layout() OVERRIDE {} 81 virtual void Layout() OVERRIDE {}
80 virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta, 82 virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta,
81 float page_scale) OVERRIDE {} 83 float page_scale) OVERRIDE {}
82 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(bool fallback) 84 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(bool fallback)
83 OVERRIDE; 85 OVERRIDE;
84 virtual void DidInitializeOutputSurface(bool success) OVERRIDE {} 86 virtual void DidInitializeOutputSurface(bool success) OVERRIDE {}
85 virtual void WillCommit() OVERRIDE {} 87 virtual void WillCommit() OVERRIDE {}
86 virtual void DidCommit() OVERRIDE {} 88 virtual void DidCommit() OVERRIDE;
87 virtual void DidCommitAndDrawFrame() OVERRIDE {} 89 virtual void DidCommitAndDrawFrame() OVERRIDE {}
88 virtual void DidCompleteSwapBuffers() OVERRIDE; 90 virtual void DidCompleteSwapBuffers() OVERRIDE;
89 virtual void ScheduleComposite() OVERRIDE; 91 virtual void ScheduleComposite() OVERRIDE;
90 virtual scoped_refptr<cc::ContextProvider> 92 virtual scoped_refptr<cc::ContextProvider>
91 OffscreenContextProvider() OVERRIDE; 93 OffscreenContextProvider() OVERRIDE;
92 94
93 // WebGraphicsContext3DSwapBuffersClient implementation. 95 // WebGraphicsContext3DSwapBuffersClient implementation.
94 virtual void OnViewContextSwapBuffersPosted() OVERRIDE; 96 virtual void OnViewContextSwapBuffersPosted() OVERRIDE;
95 virtual void OnViewContextSwapBuffersComplete() OVERRIDE; 97 virtual void OnViewContextSwapBuffersComplete() OVERRIDE;
96 virtual void OnViewContextSwapBuffersAborted() OVERRIDE; 98 virtual void OnViewContextSwapBuffersAborted() OVERRIDE;
97 99
98 // ImageTransportFactoryAndroidObserver implementation. 100 // ImageTransportFactoryAndroidObserver implementation.
99 virtual void OnLostResources() OVERRIDE; 101 virtual void OnLostResources() OVERRIDE;
100 102
103 // Compositor does not own observers. It is the responsibility of the
104 // observer to remove itself when it is done observing.
105 virtual void AddObserver(CompositorObserver* observer) OVERRIDE;
106 virtual void RemoveObserver(CompositorObserver* observer) OVERRIDE;
107 virtual bool HasObserver(CompositorObserver* observer) OVERRIDE;
108
101 private: 109 private:
102 WebKit::WebGLId BuildBasicTexture(); 110 WebKit::WebGLId BuildBasicTexture();
103 WebKit::WGC3Denum GetGLFormatForBitmap(gfx::JavaBitmap& bitmap); 111 WebKit::WGC3Denum GetGLFormatForBitmap(gfx::JavaBitmap& bitmap);
104 WebKit::WGC3Denum GetGLTypeForBitmap(gfx::JavaBitmap& bitmap); 112 WebKit::WGC3Denum GetGLTypeForBitmap(gfx::JavaBitmap& bitmap);
105 113
106 scoped_refptr<cc::Layer> root_layer_; 114 scoped_refptr<cc::Layer> root_layer_;
107 scoped_ptr<cc::LayerTreeHost> host_; 115 scoped_ptr<cc::LayerTreeHost> host_;
108 116
109 gfx::Size size_; 117 gfx::Size size_;
110 bool has_transparent_background_; 118 bool has_transparent_background_;
111 119
112 ANativeWindow* window_; 120 ANativeWindow* window_;
113 int surface_id_; 121 int surface_id_;
114 122
115 CompositorClient* client_; 123 CompositorClient* client_;
116 base::WeakPtrFactory<CompositorImpl> weak_factory_; 124 base::WeakPtrFactory<CompositorImpl> weak_factory_;
117 125
118 scoped_refptr<cc::ContextProvider> null_offscreen_context_provider_; 126 scoped_refptr<cc::ContextProvider> null_offscreen_context_provider_;
119 127
120 typedef base::ScopedPtrHashMap<cc::UIResourceId, cc::ScopedUIResource> 128 typedef base::ScopedPtrHashMap<cc::UIResourceId, cc::ScopedUIResource>
121 UIResourceMap; 129 UIResourceMap;
122 UIResourceMap ui_resource_map_; 130 UIResourceMap ui_resource_map_;
123 131
132 ObserverList<CompositorObserver> observer_list_;
133
124 DISALLOW_COPY_AND_ASSIGN(CompositorImpl); 134 DISALLOW_COPY_AND_ASSIGN(CompositorImpl);
125 }; 135 };
126 136
127 } // namespace content 137 } // namespace content
128 138
129 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ 139 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698