OLD | NEW |
---|---|
(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_ANDROID_COMPOSITOR_BLIMP_COMPOSITOR_H_ | |
6 #define BLIMP_CLIENT_ANDROID_COMPOSITOR_BLIMP_COMPOSITOR_H_ | |
7 | |
8 #include "base/android/jni_android.h" | |
9 #include "base/macros.h" | |
10 #include "base/memory/weak_ptr.h" | |
11 #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_settings.h" | |
14 #include "ui/gfx/geometry/size.h" | |
15 | |
16 struct ANativeWindow; | |
17 | |
18 namespace base { | |
19 class SingleThreadTaskRunner; | |
20 class Thread; | |
21 } | |
22 | |
23 namespace cc { | |
24 class LayerTreeHost; | |
25 } | |
26 | |
27 namespace blimp { | |
28 | |
29 class BlimpCompositor : public cc::LayerTreeHostClient, | |
nyquist
2015/08/19 07:48:06
Nit: A little class comment might be helpful here.
David Trainor- moved to gerrit
2015/08/21 00:49:46
Done.
| |
30 public cc::LayerTreeHostSingleThreadClient { | |
31 public: | |
32 static scoped_ptr<BlimpCompositor> Create(const gfx::Size& physical_size, | |
33 const gfx::Size& display_size, | |
34 float device_scale_factor); | |
35 | |
36 ~BlimpCompositor() override; | |
37 | |
38 void SetSurface(JNIEnv* env, jobject jsurface); | |
nyquist
2015/08/19 07:48:06
Like you mentioned yourself, it'd be great to have
David Trainor- moved to gerrit
2015/08/21 00:49:46
Done.
| |
39 void SetVisible(bool visible); | |
40 void SetSize(const gfx::Size& size); | |
41 | |
42 // LayerTreeHostClient Implementation ---------------------------------------- | |
43 void WillBeginMainFrame() override {} | |
44 void DidBeginMainFrame() override {} | |
45 void BeginMainFrame(const cc::BeginFrameArgs& args) override {} | |
46 void BeginMainFrameNotExpectedSoon() override {} | |
47 void Layout() override; | |
48 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta, | |
49 const gfx::Vector2dF& outer_delta, | |
50 const gfx::Vector2dF& elastic_overscroll_delta, | |
51 float page_scale, | |
52 float top_controls_delta) override {} | |
53 void RequestNewOutputSurface() override; | |
54 void DidInitializeOutputSurface() override; | |
55 void DidFailToInitializeOutputSurface() override; | |
56 void WillCommit() override {} | |
57 void DidCommit() override; | |
58 void DidCommitAndDrawFrame() override {} | |
59 void DidCompleteSwapBuffers() override; | |
60 void DidCompletePageScaleAnimation() override {} | |
61 void RecordFrameTimingEvents( | |
62 scoped_ptr<cc::FrameTimingTracker::CompositeTimingSet> composite_events, | |
63 scoped_ptr<cc::FrameTimingTracker::MainFrameTimingSet> main_frame_events) | |
64 override {} | |
65 | |
66 // LayerTreeHostSingleThreadClient Implementation ---------------------------- | |
67 void ScheduleComposite() override; | |
68 void ScheduleAnimation() override; | |
69 void DidPostSwapBuffers() override; | |
70 void DidAbortSwapBuffers() override; | |
71 | |
72 protected: | |
73 BlimpCompositor(const gfx::Size& physical_size, | |
74 const gfx::Size& display_size, | |
75 float device_scale_factor); | |
76 | |
77 private: | |
78 scoped_refptr<base::SingleThreadTaskRunner> GetCompositorTaskRunner(); | |
79 | |
80 gfx::Size viewport_size_; | |
81 float device_scale_factor_; | |
82 | |
83 cc::LayerTreeSettings settings_; | |
84 | |
85 ANativeWindow* window_; | |
86 scoped_ptr<cc::LayerTreeHost> host_; | |
87 scoped_ptr<base::Thread> compositor_thread_; | |
88 | |
89 base::WeakPtrFactory<BlimpCompositor> weak_factory_; | |
90 | |
91 DISALLOW_COPY_AND_ASSIGN(BlimpCompositor); | |
92 }; | |
93 | |
94 } // namespace blimp | |
95 | |
96 #endif // BLIMP_CLIENT_ANDROID_COMPOSITOR_BLIMP_COMPOSITOR_H_ | |
OLD | NEW |