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

Side by Side Diff: blimp/client/app/compositor/browser_compositor.h

Issue 2266863003: blimp: Move BlimpCompositor to use delegated rendering. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef BLIMP_CLIENT_APP_COMPOSITOR_BROWSER_COMPOSITOR_H_
6 #define BLIMP_CLIENT_APP_COMPOSITOR_BROWSER_COMPOSITOR_H_
7
8 #include "base/macros.h"
9 #include "base/callback.h"
10 #include "cc/trees/layer_tree_host_client.h"
11 #include "cc/trees/layer_tree_host_single_thread_client.h"
12 #include "ui/gfx/geometry/size.h"
13 #include "ui/gfx/native_widget_types.h"
14
15 namespace cc {
16 class Display;
17 class Layer;
18 class LayerTreeHost;
19 class SurfaceIdAllocator;
20 class SurfaceManager;
21 } // namespace cc
22
23 namespace blimp {
24 namespace client {
25 class BlimpGpuMemoryBufferManager;
26
27 // The parent compositor that embeds the content from the BlimpCompositor for
28 // the current page.
29 class BrowserCompositor : public cc::LayerTreeHostClient,
30 public cc::LayerTreeHostSingleThreadClient {
31 public:
32 // Move to Compositor Deps thingy after David's patch.
David Trainor- moved to gerrit 2016/08/22 23:58:10 Do we need the deps provider here? I can add the
Khushal 2016/08/23 02:53:11 I just meant that these singletons should be moved
33 static cc::SurfaceManager* GetSurfaceManager();
34 static BlimpGpuMemoryBufferManager* GetGpuMemoryBufferManager();
35 static uint32_t AllocateSurfaceClientId();
36
37 BrowserCompositor();
38 ~BrowserCompositor() override;
39
40 // Sets the layer with the content from the renderer compositor.
41 void SetContentLayer(scoped_refptr<cc::Layer> content_layer);
42
43 // Sets the size for the display. Should be in physical pixels.
44 void SetSize(const gfx::Size& size_in_px);
45
46 // Sets the widget that the |cc::Display| draws to. On proving it the widget,
47 // the compositor will become visible and start drawing to the widget. When
48 // the widget goes away, we become invisible and drop all resources being
49 // used to draw to the screen.
50 void SetAcceleratedWidget(gfx::AcceleratedWidget widget);
51
52 // A callback to get notifed when the compositor performs a successful swap.
53 void set_did_complete_swap_buffers_callback(base::Closure callback) {
54 did_complete_swap_buffers_ = callback;
55 }
56
57 private:
58 // LayerTreeHostClient implementation.
59 void WillBeginMainFrame() override {}
60 void DidBeginMainFrame() override {}
61 void BeginMainFrame(const cc::BeginFrameArgs& args) override {}
62 void BeginMainFrameNotExpectedSoon() override {}
63 void UpdateLayerTreeHost() override {}
64 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta,
65 const gfx::Vector2dF& outer_delta,
66 const gfx::Vector2dF& elastic_overscroll_delta,
67 float page_scale,
68 float top_controls_delta) override {}
69 void RequestNewOutputSurface() override;
70 void DidInitializeOutputSurface() override;
71 void DidFailToInitializeOutputSurface() override;
72 void WillCommit() override {}
73 void DidCommit() override {}
74 void DidCommitAndDrawFrame() override {}
75 void DidCompleteSwapBuffers() override;
76 void DidCompletePageScaleAnimation() override {}
77
78 // LayerTreeHostSingleThreadClient implementation.
79 void DidPostSwapBuffers() override {}
80 void DidAbortSwapBuffers() override {}
81
82 void HandlePendingOutputSurfaceRequest();
83
84 std::unique_ptr<cc::SurfaceIdAllocator> surface_id_allocator_;
85 gfx::AcceleratedWidget widget_;
86 bool output_surface_request_pending_;
87 std::unique_ptr<cc::Display> display_;
88
89 gfx::Size viewport_size_in_px_;
90
91 std::unique_ptr<cc::LayerTreeHost> host_;
92 scoped_refptr<cc::Layer> root_layer_;
93
94 base::Closure did_complete_swap_buffers_;
95
96 DISALLOW_COPY_AND_ASSIGN(BrowserCompositor);
97 };
98
99 } // namespace client
100 } // namespace blimp
101
102 #endif // BLIMP_CLIENT_APP_COMPOSITOR_BROWSER_COMPOSITOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698