Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ | |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/compiler_specific.h" | |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "content/public/browser/android/compositor.h" | |
| 12 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h" | |
| 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeView.h" | |
| 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeViewCli ent.h" | |
| 15 | |
| 16 struct ANativeWindow; | |
| 17 | |
| 18 namespace content { | |
| 19 class GraphicsContext; | |
| 20 class RenderWidgetHostView; | |
| 21 | |
| 22 // ----------------------------------------------------------------------------- | |
| 23 // Browser-side compositor that manages a tree of content and UI layers. | |
| 24 // ----------------------------------------------------------------------------- | |
| 25 class CompositorImpl : public Compositor, | |
| 26 public WebKit::WebLayerTreeViewClient { | |
| 27 public: | |
| 28 CompositorImpl(); | |
| 29 virtual ~CompositorImpl(); | |
| 30 | |
| 31 static CompositorImpl* GetInstance(); | |
|
klobag.chromium
2012/08/23 02:08:12
I agree with Alex. I don't think it is a good idea
| |
| 32 | |
| 33 // Compositor implementation. | |
| 34 virtual void SetRootLayer(const WebKit::WebLayer& root) OVERRIDE; | |
| 35 virtual void SetWindowSurface(ANativeWindow* window) OVERRIDE; | |
| 36 virtual void SetWindowBounds(const gfx::Size& size) OVERRIDE; | |
| 37 | |
| 38 // WebLayerTreeViewClient implementation. | |
| 39 virtual void updateAnimations(double frameBeginTime) OVERRIDE; | |
| 40 virtual void layout() OVERRIDE; | |
| 41 virtual void applyScrollAndScale(const WebKit::WebSize& scrollDelta, | |
| 42 float scaleFactor) OVERRIDE; | |
| 43 virtual WebKit::WebGraphicsContext3D* createContext3D() OVERRIDE; | |
| 44 virtual void didRebindGraphicsContext(bool success) OVERRIDE; | |
| 45 virtual void didCommit() OVERRIDE; | |
| 46 virtual void didCommitAndDrawFrame() OVERRIDE; | |
| 47 virtual void didCompleteSwapBuffers() OVERRIDE; | |
| 48 virtual void scheduleComposite() OVERRIDE; | |
| 49 | |
| 50 // Callback to be run after the frame has been drawn. It passes back | |
| 51 // a synchronization point identifier. | |
| 52 typedef base::Callback<void(uint32)> SurfacePresentedCallback; | |
| 53 | |
| 54 void SurfaceUpdated(const SurfacePresentedCallback& callback); | |
| 55 void SetCompositorSurface(gfx::GLSurfaceHandle handle) { handle_ = handle; } | |
| 56 gfx::Size GetWindowBounds() { return size_; } | |
| 57 gfx::GLSurfaceHandle GetCompositorSurface() { return handle_; } | |
| 58 | |
| 59 private: | |
| 60 WebKit::WebLayer root_layer_; | |
| 61 WebKit::WebLayerTreeView host_; | |
| 62 | |
| 63 scoped_ptr<GraphicsContext> context_; | |
| 64 | |
| 65 gfx::GLSurfaceHandle handle_; | |
| 66 gfx::Size size_; | |
| 67 | |
| 68 DISALLOW_COPY_AND_ASSIGN(CompositorImpl); | |
| 69 }; | |
| 70 | |
| 71 } // namespace content | |
| 72 | |
| 73 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ | |
| OLD | NEW |