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

Side by Side Diff: blimp/client/support/compositor/display_compositor.h

Issue 2320923002: Add a full Blimp integration test. (Closed)
Patch Set: Fixed this a bit more. Still some thread violations :(. Created 4 years, 3 months 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 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_SUPPORT_COMPOSITOR_DISPLAY_COMPOSITOR_H_
6 #define BLIMP_CLIENT_APP_COMPOSITOR_BROWSER_COMPOSITOR_H_ 6 #define BLIMP_CLIENT_SUPPORT_COMPOSITOR_DISPLAY_COMPOSITOR_H_
7 7
8 #include "base/callback.h"
8 #include "base/macros.h" 9 #include "base/macros.h"
9 #include "base/callback.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "cc/layers/layer.h"
11 #include "cc/trees/layer_tree_host_client.h" 12 #include "cc/trees/layer_tree_host_client.h"
12 #include "cc/trees/layer_tree_host_single_thread_client.h" 13 #include "cc/trees/layer_tree_host_single_thread_client.h"
13 #include "ui/gfx/geometry/size.h" 14 #include "ui/gfx/geometry/size.h"
14 #include "ui/gfx/native_widget_types.h"
15 15
16 namespace cc { 16 namespace cc {
17 class Display; 17 class Display;
18 class Layer;
19 class LayerTreeHost; 18 class LayerTreeHost;
20 class SurfaceIdAllocator; 19 class SurfaceIdAllocator;
21 class SurfaceManager; 20 class SurfaceManager;
22 } // namespace cc 21 } // namespace cc
23 22
24 namespace blimp { 23 namespace blimp {
25 namespace client { 24 namespace client {
26 class CompositorDependencies; 25 class CompositorDependencies;
27 26
28 // The parent compositor that embeds the content from the BlimpCompositor for 27 // The parent compositor that embeds the content from the BlimpCompositor for
29 // the current page. 28 // the current page and draws it to a display.
30 class BrowserCompositor : public cc::LayerTreeHostClient, 29 class DisplayCompositor : public cc::LayerTreeHostClient,
Khushal 2016/09/13 04:47:24 I'd suggest naming this as Parent/Root compositor
David Trainor- moved to gerrit 2016/09/13 06:18:05 Sigh but sadly this is a compositor for the displa
31 public cc::LayerTreeHostSingleThreadClient { 30 public cc::LayerTreeHostSingleThreadClient {
32 public: 31 public:
33 explicit BrowserCompositor(CompositorDependencies* compositor_dependencies); 32 explicit DisplayCompositor(CompositorDependencies* compositor_dependencies);
34 ~BrowserCompositor() override; 33 ~DisplayCompositor() override;
35 34
36 // Sets the layer with the content from the renderer compositor. 35 // Sets the layer with the content from the renderer compositor.
37 void SetContentLayer(scoped_refptr<cc::Layer> content_layer); 36 void SetContentLayer(scoped_refptr<cc::Layer> content_layer);
38 37
39 // Sets the size for the display. Should be in physical pixels. 38 // Sets the size for the display. Should be in physical pixels.
40 void SetSize(const gfx::Size& size_in_px); 39 void SetSize(const gfx::Size& size_in_px);
41 40
42 // Sets the widget that the |cc::Display| draws to. On proving it the widget, 41 protected:
43 // the compositor will become visible and start drawing to the widget. When 42 void SetContextProvider(scoped_refptr<cc::ContextProvider> context_provider);
44 // the widget goes away, we become invisible and drop all resources being
45 // used to draw to the screen.
46 void SetAcceleratedWidget(gfx::AcceleratedWidget widget);
47 43
48 // A callback to get notifed when the compositor performs a successful swap. 44 scoped_refptr<cc::Layer> root_layer() { return root_layer_; }
49 void set_did_complete_swap_buffers_callback(base::Closure callback) { 45 CompositorDependencies* compositor_dependencies() {
50 did_complete_swap_buffers_ = callback; 46 return compositor_dependencies_;
51 } 47 }
52 48
53 private:
54 // LayerTreeHostClient implementation. 49 // LayerTreeHostClient implementation.
55 void WillBeginMainFrame() override {} 50 void WillBeginMainFrame() override {}
56 void DidBeginMainFrame() override {} 51 void DidBeginMainFrame() override {}
57 void BeginMainFrame(const cc::BeginFrameArgs& args) override {} 52 void BeginMainFrame(const cc::BeginFrameArgs& args) override {}
58 void BeginMainFrameNotExpectedSoon() override {} 53 void BeginMainFrameNotExpectedSoon() override {}
59 void UpdateLayerTreeHost() override {} 54 void UpdateLayerTreeHost() override {}
60 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta, 55 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta,
61 const gfx::Vector2dF& outer_delta, 56 const gfx::Vector2dF& outer_delta,
62 const gfx::Vector2dF& elastic_overscroll_delta, 57 const gfx::Vector2dF& elastic_overscroll_delta,
63 float page_scale, 58 float page_scale,
64 float top_controls_delta) override {} 59 float top_controls_delta) override {}
65 void RequestNewOutputSurface() override; 60 void RequestNewOutputSurface() override;
66 void DidInitializeOutputSurface() override; 61 void DidInitializeOutputSurface() override;
67 void DidFailToInitializeOutputSurface() override; 62 void DidFailToInitializeOutputSurface() override;
68 void WillCommit() override {} 63 void WillCommit() override {}
69 void DidCommit() override {} 64 void DidCommit() override {}
70 void DidCommitAndDrawFrame() override {} 65 void DidCommitAndDrawFrame() override {}
71 void DidCompleteSwapBuffers() override; 66 void DidCompleteSwapBuffers() override {}
72 void DidCompletePageScaleAnimation() override {} 67 void DidCompletePageScaleAnimation() override {}
73 68
74 // LayerTreeHostSingleThreadClient implementation. 69 // LayerTreeHostSingleThreadClient implementation.
75 void DidPostSwapBuffers() override {} 70 void DidPostSwapBuffers() override {}
76 void DidAbortSwapBuffers() override {} 71 void DidAbortSwapBuffers() override {}
77 72
73 private:
78 void HandlePendingOutputSurfaceRequest(); 74 void HandlePendingOutputSurfaceRequest();
79 75
80 CompositorDependencies* compositor_dependencies_; 76 CompositorDependencies* compositor_dependencies_;
81 77
78 scoped_refptr<cc::ContextProvider> context_provider_;
79
82 std::unique_ptr<cc::SurfaceIdAllocator> surface_id_allocator_; 80 std::unique_ptr<cc::SurfaceIdAllocator> surface_id_allocator_;
83 gfx::AcceleratedWidget widget_;
84 bool output_surface_request_pending_; 81 bool output_surface_request_pending_;
85 std::unique_ptr<cc::Display> display_; 82 std::unique_ptr<cc::Display> display_;
86 83
87 gfx::Size viewport_size_in_px_; 84 gfx::Size viewport_size_in_px_;
88 85
89 std::unique_ptr<cc::LayerTreeHost> host_; 86 std::unique_ptr<cc::LayerTreeHost> host_;
90 scoped_refptr<cc::Layer> root_layer_; 87 scoped_refptr<cc::Layer> root_layer_;
91 88
92 base::Closure did_complete_swap_buffers_; 89 base::Closure did_complete_swap_buffers_;
93 90
94 DISALLOW_COPY_AND_ASSIGN(BrowserCompositor); 91 DISALLOW_COPY_AND_ASSIGN(DisplayCompositor);
95 }; 92 };
96 93
97 } // namespace client 94 } // namespace client
98 } // namespace blimp 95 } // namespace blimp
99 96
100 #endif // BLIMP_CLIENT_APP_COMPOSITOR_BROWSER_COMPOSITOR_H_ 97 #endif // BLIMP_CLIENT_SUPPORT_COMPOSITOR_DISPLAY_COMPOSITOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698