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

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

Issue 11428091: Migrate the Android compositor to cc::Layer classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 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 | Annotate | Revision Log
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/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "cc/layer_tree_host_client.h"
12 #include "content/common/content_export.h" 13 #include "content/common/content_export.h"
13 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" 14 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
14 #include "content/public/browser/android/compositor.h" 15 #include "content/public/browser/android/compositor.h"
15 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h"
16 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeView.h"
17 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeViewCli ent.h"
18 16
19 struct ANativeWindow; 17 struct ANativeWindow;
20 18
21 namespace webkit { 19 namespace cc {
22 class WebCompositorSupportImpl; 20 class FontAtlas;
21 class InputHandler;
22 class Layer;
23 class LayerTreeHost;
23 } 24 }
24 25
25 namespace content { 26 namespace content {
26 class GraphicsContext; 27 class GraphicsContext;
27 28
28 // ----------------------------------------------------------------------------- 29 // -----------------------------------------------------------------------------
29 // Browser-side compositor that manages a tree of content and UI layers. 30 // Browser-side compositor that manages a tree of content and UI layers.
30 // ----------------------------------------------------------------------------- 31 // -----------------------------------------------------------------------------
31 class CONTENT_EXPORT CompositorImpl 32 class CONTENT_EXPORT CompositorImpl
32 : public Compositor, 33 : public Compositor,
33 public WebKit::WebLayerTreeViewClient, 34 public cc::LayerTreeHostClient,
34 public WebGraphicsContext3DSwapBuffersClient { 35 public WebGraphicsContext3DSwapBuffersClient {
35 public: 36 public:
36 explicit CompositorImpl(Compositor::Client* client); 37 explicit CompositorImpl(Compositor::Client* client);
37 virtual ~CompositorImpl(); 38 virtual ~CompositorImpl();
38 39
39 static webkit::WebCompositorSupportImpl* CompositorSupport();
40 static bool IsInitialized(); 40 static bool IsInitialized();
41 static bool IsThreadingEnabled();
41 42
42 // Returns true if initialized with DIRECT_CONTEXT_ON_DRAW_THREAD. 43 // Returns true if initialized with DIRECT_CONTEXT_ON_DRAW_THREAD.
43 static bool UsesDirectGL(); 44 static bool UsesDirectGL();
44 45
45 // Compositor implementation. 46 // Compositor implementation.
46 virtual void SetRootLayer(WebKit::WebLayer* root) OVERRIDE; 47 virtual void SetRootLayer(scoped_refptr<cc::Layer> root) OVERRIDE;
47 virtual void SetWindowSurface(ANativeWindow* window) OVERRIDE; 48 virtual void SetWindowSurface(ANativeWindow* window) OVERRIDE;
48 virtual void SetVisible(bool visible) OVERRIDE; 49 virtual void SetVisible(bool visible) OVERRIDE;
49 virtual void SetWindowBounds(const gfx::Size& size) OVERRIDE; 50 virtual void SetWindowBounds(const gfx::Size& size) OVERRIDE;
50 virtual bool CompositeAndReadback( 51 virtual bool CompositeAndReadback(
51 void *pixels, const gfx::Rect& rect) OVERRIDE; 52 void *pixels, const gfx::Rect& rect) OVERRIDE;
52 virtual void Composite() OVERRIDE; 53 virtual void Composite() OVERRIDE;
53 virtual WebKit::WebGLId GenerateTexture(gfx::JavaBitmap& bitmap) OVERRIDE; 54 virtual WebKit::WebGLId GenerateTexture(gfx::JavaBitmap& bitmap) OVERRIDE;
54 virtual WebKit::WebGLId GenerateCompressedTexture( 55 virtual WebKit::WebGLId GenerateCompressedTexture(
55 gfx::Size& size, int data_size, void* data) OVERRIDE; 56 gfx::Size& size, int data_size, void* data) OVERRIDE;
56 virtual void DeleteTexture(WebKit::WebGLId texture_id) OVERRIDE; 57 virtual void DeleteTexture(WebKit::WebGLId texture_id) OVERRIDE;
57 virtual void CopyTextureToBitmap(WebKit::WebGLId texture_id, 58 virtual void CopyTextureToBitmap(WebKit::WebGLId texture_id,
58 gfx::JavaBitmap& bitmap) OVERRIDE; 59 gfx::JavaBitmap& bitmap) OVERRIDE;
59 60
60 // WebLayerTreeViewClient implementation. 61 // LayerTreeHostClient implementation.
61 virtual void updateAnimations(double frameBeginTime) OVERRIDE; 62 virtual void willBeginFrame() OVERRIDE {}
63 virtual void didBeginFrame() OVERRIDE {}
64 virtual void animate(double monotonicFrameBeginTime) OVERRIDE;
62 virtual void layout() OVERRIDE; 65 virtual void layout() OVERRIDE;
63 virtual void applyScrollAndScale(const WebKit::WebSize& scrollDelta, 66 virtual void applyScrollAndScale(gfx::Vector2d scrollDelta,
64 float scaleFactor) OVERRIDE; 67 float pageScale) OVERRIDE;
65 virtual WebKit::WebCompositorOutputSurface* createOutputSurface() OVERRIDE; 68 virtual scoped_ptr<WebKit::WebCompositorOutputSurface> createOutputSurface()
69 OVERRIDE;
70 virtual scoped_ptr<cc::InputHandler> createInputHandler() OVERRIDE;
66 virtual void didRecreateOutputSurface(bool success) OVERRIDE; 71 virtual void didRecreateOutputSurface(bool success) OVERRIDE;
72 virtual void willCommit() OVERRIDE {}
67 virtual void didCommit() OVERRIDE; 73 virtual void didCommit() OVERRIDE;
68 virtual void didCommitAndDrawFrame() OVERRIDE; 74 virtual void didCommitAndDrawFrame() OVERRIDE;
69 virtual void didCompleteSwapBuffers() OVERRIDE; 75 virtual void didCompleteSwapBuffers() OVERRIDE;
70 virtual void scheduleComposite() OVERRIDE; 76 virtual void scheduleComposite() OVERRIDE;
77 virtual scoped_ptr<cc::FontAtlas> createFontAtlas() OVERRIDE;
71 78
72 // WebGraphicsContext3DSwapBuffersClient implementation. 79 // WebGraphicsContext3DSwapBuffersClient implementation.
73 virtual void OnViewContextSwapBuffersPosted() OVERRIDE; 80 virtual void OnViewContextSwapBuffersPosted() OVERRIDE;
74 virtual void OnViewContextSwapBuffersComplete() OVERRIDE; 81 virtual void OnViewContextSwapBuffersComplete() OVERRIDE;
75 virtual void OnViewContextSwapBuffersAborted() OVERRIDE; 82 virtual void OnViewContextSwapBuffersAborted() OVERRIDE;
76 83
77 private: 84 private:
78 WebKit::WebGLId BuildBasicTexture(); 85 WebKit::WebGLId BuildBasicTexture();
79 WebKit::WGC3Denum GetGLFormatForBitmap(gfx::JavaBitmap& bitmap); 86 WebKit::WGC3Denum GetGLFormatForBitmap(gfx::JavaBitmap& bitmap);
80 WebKit::WGC3Denum GetGLTypeForBitmap(gfx::JavaBitmap& bitmap); 87 WebKit::WGC3Denum GetGLTypeForBitmap(gfx::JavaBitmap& bitmap);
81 88
82 scoped_ptr<WebKit::WebLayer> root_layer_; 89 scoped_refptr<cc::Layer> root_layer_;
83 scoped_ptr<WebKit::WebLayerTreeView> host_; 90 scoped_ptr<cc::LayerTreeHost> host_;
84 91
85 gfx::Size size_; 92 gfx::Size size_;
86 93
87 ANativeWindow* window_; 94 ANativeWindow* window_;
88 int surface_id_; 95 int surface_id_;
89 96
90 Compositor::Client* client_; 97 Compositor::Client* client_;
91 base::WeakPtrFactory<CompositorImpl> weak_factory_; 98 base::WeakPtrFactory<CompositorImpl> weak_factory_;
92 99
93 DISALLOW_COPY_AND_ASSIGN(CompositorImpl); 100 DISALLOW_COPY_AND_ASSIGN(CompositorImpl);
94 }; 101 };
95 102
96 } // namespace content 103 } // namespace content
97 104
98 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ 105 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_
OLDNEW
« no previous file with comments | « content/browser/android/content_view_render_view.cc ('k') | content/browser/renderer_host/compositor_impl_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698