| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 BLIMP_CLIENT_APP_COMPOSITOR_BROWSER_COMPOSITOR_H_ | 5 #ifndef BLIMP_CLIENT_APP_COMPOSITOR_BROWSER_COMPOSITOR_H_ |
| 6 #define BLIMP_CLIENT_APP_COMPOSITOR_BROWSER_COMPOSITOR_H_ | 6 #define BLIMP_CLIENT_APP_COMPOSITOR_BROWSER_COMPOSITOR_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/memory/weak_ptr.h" |
| 10 #include "cc/trees/layer_tree_host_client.h" | 11 #include "cc/trees/layer_tree_host_client.h" |
| 11 #include "cc/trees/layer_tree_host_single_thread_client.h" | 12 #include "cc/trees/layer_tree_host_single_thread_client.h" |
| 12 #include "ui/gfx/geometry/size.h" | 13 #include "ui/gfx/geometry/size.h" |
| 13 #include "ui/gfx/native_widget_types.h" | 14 #include "ui/gfx/native_widget_types.h" |
| 14 | 15 |
| 15 namespace cc { | 16 namespace cc { |
| 16 class Display; | 17 class Display; |
| 17 class Layer; | 18 class Layer; |
| 18 class LayerTreeHost; | 19 class LayerTreeHost; |
| 19 class SurfaceIdAllocator; | 20 class SurfaceIdAllocator; |
| 20 class SurfaceManager; | 21 class SurfaceManager; |
| 21 } // namespace cc | 22 } // namespace cc |
| 22 | 23 |
| 23 namespace blimp { | 24 namespace blimp { |
| 24 namespace client { | 25 namespace client { |
| 25 class BlimpGpuMemoryBufferManager; | 26 class CompositorDependencies; |
| 26 | 27 |
| 27 // The parent compositor that embeds the content from the BlimpCompositor for | 28 // The parent compositor that embeds the content from the BlimpCompositor for |
| 28 // the current page. | 29 // the current page. |
| 29 class BrowserCompositor : public cc::LayerTreeHostClient, | 30 class BrowserCompositor : public cc::LayerTreeHostClient, |
| 30 public cc::LayerTreeHostSingleThreadClient { | 31 public cc::LayerTreeHostSingleThreadClient { |
| 31 public: | 32 public: |
| 32 // TODO(dtrainor): Move these to the CompositorDeps and share them with the | 33 explicit BrowserCompositor(CompositorDependencies* compositor_dependencies); |
| 33 // BlimpCompositor. | |
| 34 static cc::SurfaceManager* GetSurfaceManager(); | |
| 35 static BlimpGpuMemoryBufferManager* GetGpuMemoryBufferManager(); | |
| 36 static uint32_t AllocateSurfaceClientId(); | |
| 37 | |
| 38 BrowserCompositor(); | |
| 39 ~BrowserCompositor() override; | 34 ~BrowserCompositor() override; |
| 40 | 35 |
| 41 // Sets the layer with the content from the renderer compositor. | 36 // Sets the layer with the content from the renderer compositor. |
| 42 void SetContentLayer(scoped_refptr<cc::Layer> content_layer); | 37 void SetContentLayer(scoped_refptr<cc::Layer> content_layer); |
| 43 | 38 |
| 44 // Sets the size for the display. Should be in physical pixels. | 39 // Sets the size for the display. Should be in physical pixels. |
| 45 void SetSize(const gfx::Size& size_in_px); | 40 void SetSize(const gfx::Size& size_in_px); |
| 46 | 41 |
| 47 // Sets the widget that the |cc::Display| draws to. On proving it the widget, | 42 // Sets the widget that the |cc::Display| draws to. On proving it the widget, |
| 48 // the compositor will become visible and start drawing to the widget. When | 43 // the compositor will become visible and start drawing to the widget. When |
| (...skipping 26 matching lines...) Expand all Loading... |
| 75 void DidCommitAndDrawFrame() override {} | 70 void DidCommitAndDrawFrame() override {} |
| 76 void DidCompleteSwapBuffers() override; | 71 void DidCompleteSwapBuffers() override; |
| 77 void DidCompletePageScaleAnimation() override {} | 72 void DidCompletePageScaleAnimation() override {} |
| 78 | 73 |
| 79 // LayerTreeHostSingleThreadClient implementation. | 74 // LayerTreeHostSingleThreadClient implementation. |
| 80 void DidPostSwapBuffers() override {} | 75 void DidPostSwapBuffers() override {} |
| 81 void DidAbortSwapBuffers() override {} | 76 void DidAbortSwapBuffers() override {} |
| 82 | 77 |
| 83 void HandlePendingOutputSurfaceRequest(); | 78 void HandlePendingOutputSurfaceRequest(); |
| 84 | 79 |
| 80 CompositorDependencies* compositor_dependencies_; |
| 81 |
| 85 std::unique_ptr<cc::SurfaceIdAllocator> surface_id_allocator_; | 82 std::unique_ptr<cc::SurfaceIdAllocator> surface_id_allocator_; |
| 86 gfx::AcceleratedWidget widget_; | 83 gfx::AcceleratedWidget widget_; |
| 87 bool output_surface_request_pending_; | 84 bool output_surface_request_pending_; |
| 88 std::unique_ptr<cc::Display> display_; | 85 std::unique_ptr<cc::Display> display_; |
| 89 | 86 |
| 90 gfx::Size viewport_size_in_px_; | 87 gfx::Size viewport_size_in_px_; |
| 91 | 88 |
| 92 std::unique_ptr<cc::LayerTreeHost> host_; | 89 std::unique_ptr<cc::LayerTreeHost> host_; |
| 93 scoped_refptr<cc::Layer> root_layer_; | 90 scoped_refptr<cc::Layer> root_layer_; |
| 94 | 91 |
| 95 base::Closure did_complete_swap_buffers_; | 92 base::Closure did_complete_swap_buffers_; |
| 96 | 93 |
| 97 DISALLOW_COPY_AND_ASSIGN(BrowserCompositor); | 94 DISALLOW_COPY_AND_ASSIGN(BrowserCompositor); |
| 98 }; | 95 }; |
| 99 | 96 |
| 100 } // namespace client | 97 } // namespace client |
| 101 } // namespace blimp | 98 } // namespace blimp |
| 102 | 99 |
| 103 #endif // BLIMP_CLIENT_APP_COMPOSITOR_BROWSER_COMPOSITOR_H_ | 100 #endif // BLIMP_CLIENT_APP_COMPOSITOR_BROWSER_COMPOSITOR_H_ |
| OLD | NEW |