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

Side by Side Diff: cc/trees/single_thread_proxy.h

Issue 619843002: cc: Make separate interface for BeginFrame ipc from OutputSurface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 CC_TREES_SINGLE_THREAD_PROXY_H_ 5 #ifndef CC_TREES_SINGLE_THREAD_PROXY_H_
6 #define CC_TREES_SINGLE_THREAD_PROXY_H_ 6 #define CC_TREES_SINGLE_THREAD_PROXY_H_
7 7
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/cancelable_callback.h" 10 #include "base/cancelable_callback.h"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "cc/animation/animation_events.h" 12 #include "cc/animation/animation_events.h"
13 #include "cc/output/begin_frame_args.h" 13 #include "cc/output/begin_frame_args.h"
14 #include "cc/scheduler/scheduler.h" 14 #include "cc/scheduler/scheduler.h"
15 #include "cc/trees/blocking_task_runner.h" 15 #include "cc/trees/blocking_task_runner.h"
16 #include "cc/trees/layer_tree_host_impl.h" 16 #include "cc/trees/layer_tree_host_impl.h"
17 #include "cc/trees/proxy.h" 17 #include "cc/trees/proxy.h"
18 #include "cc/trees/proxy_timing_history.h" 18 #include "cc/trees/proxy_timing_history.h"
19 19
20 namespace cc { 20 namespace cc {
21 21
22 class BeginFrameSource;
22 class ContextProvider; 23 class ContextProvider;
23 class LayerTreeHost; 24 class LayerTreeHost;
24 class LayerTreeHostSingleThreadClient; 25 class LayerTreeHostSingleThreadClient;
25 26
26 class CC_EXPORT SingleThreadProxy : public Proxy, 27 class CC_EXPORT SingleThreadProxy : public Proxy,
27 NON_EXPORTED_BASE(LayerTreeHostImplClient), 28 NON_EXPORTED_BASE(LayerTreeHostImplClient),
28 SchedulerClient { 29 SchedulerClient {
29 public: 30 public:
30 static scoped_ptr<Proxy> Create( 31 static scoped_ptr<Proxy> Create(
31 LayerTreeHost* layer_tree_host, 32 LayerTreeHost* layer_tree_host,
32 LayerTreeHostSingleThreadClient* client, 33 LayerTreeHostSingleThreadClient* client,
33 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner); 34 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
35 scoped_ptr<BeginFrameSource> external_begin_frame_source);
34 ~SingleThreadProxy() override; 36 ~SingleThreadProxy() override;
35 37
36 // Proxy implementation 38 // Proxy implementation
37 void FinishAllRendering() override; 39 void FinishAllRendering() override;
38 bool IsStarted() const override; 40 bool IsStarted() const override;
39 void SetOutputSurface(scoped_ptr<OutputSurface>) override; 41 void SetOutputSurface(scoped_ptr<OutputSurface>) override;
40 void SetLayerTreeHostClientReady() override; 42 void SetLayerTreeHostClientReady() override;
41 void SetVisible(bool visible) override; 43 void SetVisible(bool visible) override;
42 const RendererCapabilities& GetRendererCapabilities() const override; 44 const RendererCapabilities& GetRendererCapabilities() const override;
43 void SetNeedsAnimate() override; 45 void SetNeedsAnimate() override;
44 void SetNeedsUpdateLayers() override; 46 void SetNeedsUpdateLayers() override;
45 void SetNeedsCommit() override; 47 void SetNeedsCommit() override;
46 void SetNeedsRedraw(const gfx::Rect& damage_rect) override; 48 void SetNeedsRedraw(const gfx::Rect& damage_rect) override;
47 void SetNextCommitWaitsForActivation() override; 49 void SetNextCommitWaitsForActivation() override;
48 void NotifyInputThrottledUntilCommit() override {} 50 void NotifyInputThrottledUntilCommit() override {}
49 void SetDeferCommits(bool defer_commits) override; 51 void SetDeferCommits(bool defer_commits) override;
50 bool CommitRequested() const override; 52 bool CommitRequested() const override;
51 bool BeginMainFrameRequested() const override; 53 bool BeginMainFrameRequested() const override;
52 void MainThreadHasStoppedFlinging() override {} 54 void MainThreadHasStoppedFlinging() override {}
53 void Start() override; 55 void Start() override;
54 void Stop() override; 56 void Stop() override;
55 size_t MaxPartialTextureUpdates() const override; 57 size_t MaxPartialTextureUpdates() const override;
56 void ForceSerializeOnSwapBuffers() override; 58 void ForceSerializeOnSwapBuffers() override;
57 bool SupportsImplScrolling() const override; 59 bool SupportsImplScrolling() const override;
58 void AsValueInto(base::debug::TracedValue* state) const override; 60 void AsValueInto(base::debug::TracedValue* state) const override;
59 bool MainFrameWillHappenForTesting() override; 61 bool MainFrameWillHappenForTesting() override;
60 62
61 // SchedulerClient implementation 63 // SchedulerClient implementation
62 BeginFrameSource* ExternalBeginFrameSource() override;
63 void WillBeginImplFrame(const BeginFrameArgs& args) override; 64 void WillBeginImplFrame(const BeginFrameArgs& args) override;
64 void ScheduledActionSendBeginMainFrame() override; 65 void ScheduledActionSendBeginMainFrame() override;
65 DrawResult ScheduledActionDrawAndSwapIfPossible() override; 66 DrawResult ScheduledActionDrawAndSwapIfPossible() override;
66 DrawResult ScheduledActionDrawAndSwapForced() override; 67 DrawResult ScheduledActionDrawAndSwapForced() override;
67 void ScheduledActionCommit() override; 68 void ScheduledActionCommit() override;
68 void ScheduledActionAnimate() override; 69 void ScheduledActionAnimate() override;
69 void ScheduledActionUpdateVisibleTiles() override; 70 void ScheduledActionUpdateVisibleTiles() override;
70 void ScheduledActionActivateSyncTree() override; 71 void ScheduledActionActivateSyncTree() override;
71 void ScheduledActionBeginOutputSurfaceCreation() override; 72 void ScheduledActionBeginOutputSurfaceCreation() override;
72 void ScheduledActionManageTiles() override; 73 void ScheduledActionManageTiles() override;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 108
108 void RequestNewOutputSurface(); 109 void RequestNewOutputSurface();
109 110
110 // Called by the legacy path where RenderWidget does the scheduling. 111 // Called by the legacy path where RenderWidget does the scheduling.
111 void CompositeImmediately(base::TimeTicks frame_begin_time); 112 void CompositeImmediately(base::TimeTicks frame_begin_time);
112 113
113 private: 114 private:
114 SingleThreadProxy( 115 SingleThreadProxy(
115 LayerTreeHost* layer_tree_host, 116 LayerTreeHost* layer_tree_host,
116 LayerTreeHostSingleThreadClient* client, 117 LayerTreeHostSingleThreadClient* client,
117 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner); 118 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
119 scoped_ptr<BeginFrameSource> external_begin_frame_source);
118 120
119 void BeginMainFrame(); 121 void BeginMainFrame();
120 void BeginMainFrameAbortedOnImplThread(); 122 void BeginMainFrameAbortedOnImplThread();
121 void DoBeginMainFrame(const BeginFrameArgs& begin_frame_args); 123 void DoBeginMainFrame(const BeginFrameArgs& begin_frame_args);
122 void DoCommit(); 124 void DoCommit();
123 DrawResult DoComposite(base::TimeTicks frame_begin_time, 125 DrawResult DoComposite(base::TimeTicks frame_begin_time,
124 LayerTreeHostImpl::FrameData* frame); 126 LayerTreeHostImpl::FrameData* frame);
125 void DoSwap(); 127 void DoSwap();
126 void DidCommitAndDrawFrame(); 128 void DidCommitAndDrawFrame();
127 void CommitComplete(); 129 void CommitComplete();
(...skipping 24 matching lines...) Expand all
152 bool commit_was_deferred_; 154 bool commit_was_deferred_;
153 bool commit_requested_; 155 bool commit_requested_;
154 156
155 // True if a request to the LayerTreeHostClient to create an output surface 157 // True if a request to the LayerTreeHostClient to create an output surface
156 // is still outstanding. 158 // is still outstanding.
157 bool output_surface_creation_requested_; 159 bool output_surface_creation_requested_;
158 160
159 // This is the callback for the scheduled RequestNewOutputSurface. 161 // This is the callback for the scheduled RequestNewOutputSurface.
160 base::CancelableClosure output_surface_creation_callback_; 162 base::CancelableClosure output_surface_creation_callback_;
161 163
164 scoped_ptr<BeginFrameSource> external_begin_frame_source_;
165
162 base::WeakPtrFactory<SingleThreadProxy> weak_factory_; 166 base::WeakPtrFactory<SingleThreadProxy> weak_factory_;
163 167
164 DISALLOW_COPY_AND_ASSIGN(SingleThreadProxy); 168 DISALLOW_COPY_AND_ASSIGN(SingleThreadProxy);
165 }; 169 };
166 170
167 // For use in the single-threaded case. In debug builds, it pretends that the 171 // For use in the single-threaded case. In debug builds, it pretends that the
168 // code is running on the impl thread to satisfy assertion checks. 172 // code is running on the impl thread to satisfy assertion checks.
169 class DebugScopedSetImplThread { 173 class DebugScopedSetImplThread {
170 public: 174 public:
171 explicit DebugScopedSetImplThread(Proxy* proxy) : proxy_(proxy) { 175 explicit DebugScopedSetImplThread(Proxy* proxy) : proxy_(proxy) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 private: 225 private:
222 DebugScopedSetImplThread impl_thread_; 226 DebugScopedSetImplThread impl_thread_;
223 DebugScopedSetMainThreadBlocked main_thread_blocked_; 227 DebugScopedSetMainThreadBlocked main_thread_blocked_;
224 228
225 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetImplThreadAndMainThreadBlocked); 229 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetImplThreadAndMainThreadBlocked);
226 }; 230 };
227 231
228 } // namespace cc 232 } // namespace cc
229 233
230 #endif // CC_TREES_SINGLE_THREAD_PROXY_H_ 234 #endif // CC_TREES_SINGLE_THREAD_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698