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

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: make gn happy 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
(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 // TODO(dtrainor): Move these to the CompositorDeps and share them with the
33 // BlimpCompositor.
34 static cc::SurfaceManager* GetSurfaceManager();
35 static BlimpGpuMemoryBufferManager* GetGpuMemoryBufferManager();
36 static uint32_t AllocateSurfaceClientId();
37
38 BrowserCompositor();
39 ~BrowserCompositor() override;
40
41 // Sets the layer with the content from the renderer compositor.
42 void SetContentLayer(scoped_refptr<cc::Layer> content_layer);
43
44 // Sets the size for the display. Should be in physical pixels.
45 void SetSize(const gfx::Size& size_in_px);
46
47 // 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
49 // the widget goes away, we become invisible and drop all resources being
50 // used to draw to the screen.
51 void SetAcceleratedWidget(gfx::AcceleratedWidget widget);
52
53 // A callback to get notifed when the compositor performs a successful swap.
54 void set_did_complete_swap_buffers_callback(base::Closure callback) {
55 did_complete_swap_buffers_ = callback;
56 }
57
58 private:
59 // LayerTreeHostClient implementation.
60 void WillBeginMainFrame() override {}
61 void DidBeginMainFrame() override {}
62 void BeginMainFrame(const cc::BeginFrameArgs& args) override {}
63 void BeginMainFrameNotExpectedSoon() override {}
64 void UpdateLayerTreeHost() override {}
65 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta,
66 const gfx::Vector2dF& outer_delta,
67 const gfx::Vector2dF& elastic_overscroll_delta,
68 float page_scale,
69 float top_controls_delta) override {}
70 void RequestNewOutputSurface() override;
71 void DidInitializeOutputSurface() override;
72 void DidFailToInitializeOutputSurface() override;
73 void WillCommit() override {}
74 void DidCommit() override {}
75 void DidCommitAndDrawFrame() override {}
76 void DidCompleteSwapBuffers() override;
77 void DidCompletePageScaleAnimation() override {}
78
79 // LayerTreeHostSingleThreadClient implementation.
80 void DidPostSwapBuffers() override {}
81 void DidAbortSwapBuffers() override {}
82
83 void HandlePendingOutputSurfaceRequest();
84
85 std::unique_ptr<cc::SurfaceIdAllocator> surface_id_allocator_;
86 gfx::AcceleratedWidget widget_;
87 bool output_surface_request_pending_;
88 std::unique_ptr<cc::Display> display_;
89
90 gfx::Size viewport_size_in_px_;
91
92 std::unique_ptr<cc::LayerTreeHost> host_;
93 scoped_refptr<cc::Layer> root_layer_;
94
95 base::Closure did_complete_swap_buffers_;
96
97 DISALLOW_COPY_AND_ASSIGN(BrowserCompositor);
98 };
99
100 } // namespace client
101 } // namespace blimp
102
103 #endif // BLIMP_CLIENT_APP_COMPOSITOR_BROWSER_COMPOSITOR_H_
OLDNEW
« no previous file with comments | « blimp/client/app/android/java/src/org/chromium/blimp/BlimpView.java ('k') | blimp/client/app/compositor/browser_compositor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698