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

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: Plumb compositor provider through instead of compositor Created 7 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/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/observer_list.h"
12 #include "cc/resources/ui_resource_client.h" 13 #include "cc/resources/ui_resource_client.h"
13 #include "cc/trees/layer_tree_host_client.h" 14 #include "cc/trees/layer_tree_host_client.h"
14 #include "cc/trees/layer_tree_host_single_thread_client.h" 15 #include "cc/trees/layer_tree_host_single_thread_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 cc::LayerTreeHostSingleThreadClient, 41 public cc::LayerTreeHostSingleThreadClient,
40 public ImageTransportFactoryAndroidObserver { 42 public ImageTransportFactoryAndroidObserver {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 virtual void WillBeginMainFrame() OVERRIDE {} 76 virtual void WillBeginMainFrame() OVERRIDE {}
75 virtual void DidBeginMainFrame() OVERRIDE {} 77 virtual void DidBeginMainFrame() OVERRIDE {}
76 virtual void Animate(double frame_begin_time) OVERRIDE {} 78 virtual void Animate(double frame_begin_time) OVERRIDE {}
77 virtual void Layout() OVERRIDE {} 79 virtual void Layout() OVERRIDE {}
78 virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta, 80 virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta,
79 float page_scale) OVERRIDE {} 81 float page_scale) OVERRIDE {}
80 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(bool fallback) 82 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(bool fallback)
81 OVERRIDE; 83 OVERRIDE;
82 virtual void DidInitializeOutputSurface(bool success) OVERRIDE {} 84 virtual void DidInitializeOutputSurface(bool success) OVERRIDE {}
83 virtual void WillCommit() OVERRIDE {} 85 virtual void WillCommit() OVERRIDE {}
84 virtual void DidCommit() OVERRIDE {} 86 virtual void DidCommit() OVERRIDE;
85 virtual void DidCommitAndDrawFrame() OVERRIDE {} 87 virtual void DidCommitAndDrawFrame() OVERRIDE {}
86 virtual void DidCompleteSwapBuffers() OVERRIDE; 88 virtual void DidCompleteSwapBuffers() OVERRIDE;
87 virtual scoped_refptr<cc::ContextProvider> 89 virtual scoped_refptr<cc::ContextProvider>
88 OffscreenContextProvider() OVERRIDE; 90 OffscreenContextProvider() OVERRIDE;
89 91
90 // LayerTreeHostSingleThreadClient implementation. 92 // LayerTreeHostSingleThreadClient implementation.
91 virtual void ScheduleComposite() OVERRIDE; 93 virtual void ScheduleComposite() OVERRIDE;
92 virtual void DidPostSwapBuffers() OVERRIDE; 94 virtual void DidPostSwapBuffers() OVERRIDE;
93 virtual void DidAbortSwapBuffers() OVERRIDE; 95 virtual void DidAbortSwapBuffers() OVERRIDE;
94 96
95 // ImageTransportFactoryAndroidObserver implementation. 97 // ImageTransportFactoryAndroidObserver implementation.
96 virtual void OnLostResources() OVERRIDE; 98 virtual void OnLostResources() OVERRIDE;
97 99
100 // Compositor does not own observers. It is the responsibility of the
101 // observer to remove itself when it is done observing.
102 virtual void AddObserver(CompositorObserver* observer) OVERRIDE;
103 virtual void RemoveObserver(CompositorObserver* observer) OVERRIDE;
104 virtual bool HasObserver(CompositorObserver* observer) OVERRIDE;
105
98 private: 106 private:
99 blink::WebGLId BuildBasicTexture(); 107 blink::WebGLId BuildBasicTexture();
100 blink::WGC3Denum GetGLFormatForBitmap(gfx::JavaBitmap& bitmap); 108 blink::WGC3Denum GetGLFormatForBitmap(gfx::JavaBitmap& bitmap);
101 blink::WGC3Denum GetGLTypeForBitmap(gfx::JavaBitmap& bitmap); 109 blink::WGC3Denum GetGLTypeForBitmap(gfx::JavaBitmap& bitmap);
102 110
103 scoped_refptr<cc::Layer> root_layer_; 111 scoped_refptr<cc::Layer> root_layer_;
104 scoped_ptr<cc::LayerTreeHost> host_; 112 scoped_ptr<cc::LayerTreeHost> host_;
105 113
106 gfx::Size size_; 114 gfx::Size size_;
107 bool has_transparent_background_; 115 bool has_transparent_background_;
108 116
109 ANativeWindow* window_; 117 ANativeWindow* window_;
110 int surface_id_; 118 int surface_id_;
111 119
112 CompositorClient* client_; 120 CompositorClient* client_;
113 121
114 scoped_refptr<cc::ContextProvider> null_offscreen_context_provider_; 122 scoped_refptr<cc::ContextProvider> null_offscreen_context_provider_;
115 123
116 typedef base::ScopedPtrHashMap<cc::UIResourceId, cc::ScopedUIResource> 124 typedef base::ScopedPtrHashMap<cc::UIResourceId, cc::ScopedUIResource>
117 UIResourceMap; 125 UIResourceMap;
118 UIResourceMap ui_resource_map_; 126 UIResourceMap ui_resource_map_;
119 127
128 ObserverList<CompositorObserver> observer_list_;
129
120 DISALLOW_COPY_AND_ASSIGN(CompositorImpl); 130 DISALLOW_COPY_AND_ASSIGN(CompositorImpl);
121 }; 131 };
122 132
123 } // namespace content 133 } // namespace content
124 134
125 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ 135 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698