OLD | NEW |
---|---|
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 "content/public/browser/android/compositor.h" | 11 #include "content/public/browser/android/compositor.h" |
12 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h" | 12 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h" |
13 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeView.h" | 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeView.h" |
14 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeViewCli ent.h" | 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeViewCli ent.h" |
15 | 15 |
16 struct ANativeWindow; | 16 struct ANativeWindow; |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 class GraphicsContext; | 19 class GraphicsContext; |
20 | 20 |
21 // ----------------------------------------------------------------------------- | 21 // ----------------------------------------------------------------------------- |
22 // Browser-side compositor that manages a tree of content and UI layers. | 22 // Browser-side compositor that manages a tree of content and UI layers. |
23 // ----------------------------------------------------------------------------- | 23 // ----------------------------------------------------------------------------- |
24 class CompositorImpl : public Compositor, | 24 class CompositorImpl : public Compositor, |
25 public WebKit::WebLayerTreeViewClient { | 25 public WebKit::WebLayerTreeViewClient { |
26 public: | 26 public: |
27 CompositorImpl(); | 27 CompositorImpl(Compositor::Client* client); |
piman
2012/10/12 20:53:06
nit: explicit
no sievers
2012/10/12 22:33:51
Done.
| |
28 virtual ~CompositorImpl(); | 28 virtual ~CompositorImpl(); |
29 | 29 |
30 static bool IsInitialized(); | 30 static bool IsInitialized(); |
31 | 31 |
32 // Compositor implementation. | 32 // Compositor implementation. |
33 virtual void SetRootLayer(WebKit::WebLayer* root) OVERRIDE; | 33 virtual void SetRootLayer(WebKit::WebLayer* root) OVERRIDE; |
34 virtual void SetWindowSurface(ANativeWindow* window) OVERRIDE; | 34 virtual void SetWindowSurface(ANativeWindow* window) OVERRIDE; |
35 virtual void SetWindowBounds(const gfx::Size& size) OVERRIDE; | 35 virtual void SetWindowBounds(const gfx::Size& size) OVERRIDE; |
36 virtual bool CompositeAndReadback( | 36 virtual bool CompositeAndReadback( |
37 void *pixels, const gfx::Rect& rect) OVERRIDE; | 37 void *pixels, const gfx::Rect& rect) OVERRIDE; |
38 virtual void OnSurfaceUpdated( | 38 virtual void Composite() OVERRIDE; |
39 const SurfacePresentedCallback& callback) OVERRIDE; | |
40 | 39 |
41 // WebLayerTreeViewClient implementation. | 40 // WebLayerTreeViewClient implementation. |
42 virtual void updateAnimations(double frameBeginTime) OVERRIDE; | 41 virtual void updateAnimations(double frameBeginTime) OVERRIDE; |
43 virtual void layout() OVERRIDE; | 42 virtual void layout() OVERRIDE; |
44 virtual void applyScrollAndScale(const WebKit::WebSize& scrollDelta, | 43 virtual void applyScrollAndScale(const WebKit::WebSize& scrollDelta, |
45 float scaleFactor) OVERRIDE; | 44 float scaleFactor) OVERRIDE; |
46 virtual WebKit::WebCompositorOutputSurface* createOutputSurface() OVERRIDE; | 45 virtual WebKit::WebCompositorOutputSurface* createOutputSurface() OVERRIDE; |
47 virtual void didRecreateOutputSurface(bool success) OVERRIDE; | 46 virtual void didRecreateOutputSurface(bool success) OVERRIDE; |
48 virtual void didCommit() OVERRIDE; | 47 virtual void didCommit() OVERRIDE; |
49 virtual void didCommitAndDrawFrame() OVERRIDE; | 48 virtual void didCommitAndDrawFrame() OVERRIDE; |
50 virtual void didCompleteSwapBuffers() OVERRIDE; | 49 virtual void didCompleteSwapBuffers() OVERRIDE; |
51 virtual void scheduleComposite() OVERRIDE; | 50 virtual void scheduleComposite() OVERRIDE; |
52 | 51 |
53 private: | 52 private: |
54 scoped_ptr<WebKit::WebLayer> root_layer_; | 53 scoped_ptr<WebKit::WebLayer> root_layer_; |
55 scoped_ptr<WebKit::WebLayerTreeView> host_; | 54 scoped_ptr<WebKit::WebLayerTreeView> host_; |
56 | 55 |
57 gfx::Size size_; | 56 gfx::Size size_; |
58 | 57 |
59 ANativeWindow* window_; | 58 ANativeWindow* window_; |
60 int surface_id_; | 59 int surface_id_; |
61 | 60 |
61 Compositor::Client* client_; | |
62 | |
62 DISALLOW_COPY_AND_ASSIGN(CompositorImpl); | 63 DISALLOW_COPY_AND_ASSIGN(CompositorImpl); |
63 }; | 64 }; |
64 | 65 |
65 } // namespace content | 66 } // namespace content |
66 | 67 |
67 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ | 68 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ |
OLD | NEW |