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

Side by Side Diff: blimp/client/compositor/blimp_compositor.h

Issue 1295243003: Initial commit of the blimp/ folder and target (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 5 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 2015 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_COMPOSITOR_BLIMP_COMPOSITOR_H_
6 #define BLIMP_CLIENT_COMPOSITOR_BLIMP_COMPOSITOR_H_
7
8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "cc/trees/layer_tree_host_client.h"
12 #include "cc/trees/layer_tree_settings.h"
13 #include "ui/gfx/geometry/size.h"
14 #include "ui/gfx/native_widget_types.h"
15
16 namespace base {
17 class CommandLine;
18 class SingleThreadTaskRunner;
19 class Thread;
20 }
21
22 namespace cc {
23 class LayerTreeHost;
24 }
25
26 namespace blimp {
27
28 // BlimpCompositor provides the basic framework and setup to host a
29 // LayerTreeHost (compositor). The rendering surface this compositor draws to
30 // is defined by the gfx::AcceleratedWidget returned by
31 // BlimpCompositor::GetWindow().
32 class BlimpCompositor : public cc::LayerTreeHostClient {
33 public:
34 ~BlimpCompositor() override;
35
36 void SetVisible(bool visible);
37 void SetSize(const gfx::Size& size);
38
39 // LayerTreeHostClient implementation
40 void WillBeginMainFrame() override;
41 void DidBeginMainFrame() override;
42 void BeginMainFrame(const cc::BeginFrameArgs& args) override;
43 void BeginMainFrameNotExpectedSoon() override;
44 void Layout() override;
45 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta,
46 const gfx::Vector2dF& outer_delta,
47 const gfx::Vector2dF& elastic_overscroll_delta,
48 float page_scale,
49 float top_controls_delta) override;
50 void RequestNewOutputSurface() override;
51 void DidInitializeOutputSurface() override;
52 void DidFailToInitializeOutputSurface() override;
53 void WillCommit() override;
54 void DidCommit() override;
55 void DidCommitAndDrawFrame() override;
56 void DidCompleteSwapBuffers() override;
57 void DidCompletePageScaleAnimation() override;
58 void RecordFrameTimingEvents(
59 scoped_ptr<cc::FrameTimingTracker::CompositeTimingSet> composite_events,
60 scoped_ptr<cc::FrameTimingTracker::MainFrameTimingSet> main_frame_events)
61 override;
62
63 protected:
64 explicit BlimpCompositor(float device_scale_factor);
65
66 // Returns a widget for use in constructing this compositor's OutputSurface.
67 // Will only ever be called while this compositor is visible.
68 virtual gfx::AcceleratedWidget GetWindow() = 0;
69
70 // Populates the cc::LayerTreeSettings used by the cc::LayerTreeHost. Can be
71 // overridden to provide custom settings parameters.
72 virtual void GenerateLayerTreeSettings(cc::LayerTreeSettings* settings,
73 const base::CommandLine& cmd);
74
75 private:
76 // Creates (if necessary) and returns a TaskRunner for a thread meant to run
77 // compositor rendering.
78 scoped_refptr<base::SingleThreadTaskRunner> GetCompositorTaskRunner();
79
80 gfx::Size viewport_size_;
81
82 // The scale factor used to convert dp units (device independent pixels) to
83 // pixels.
84 float device_scale_factor_;
85 scoped_ptr<cc::LayerTreeHost> host_;
86 scoped_ptr<cc::LayerTreeSettings> settings_;
87
88 // A lazily created thread that will run the compositor rendering tasks.
Wez 2015/09/03 00:49:27 nit: No need for "A", I don't think.
David Trainor- moved to gerrit 2015/09/03 06:33:21 Done.
89 scoped_ptr<base::Thread> compositor_thread_;
90
91 DISALLOW_COPY_AND_ASSIGN(BlimpCompositor);
92 };
93
94 } // namespace blimp
95
96 #endif // BLIMP_CLIENT_COMPOSITOR_BLIMP_COMPOSITOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698