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

Side by Side Diff: cc/scheduler/begin_frame_source.h

Issue 2511273002: Decouple BrowserCompositorOutputSurface from BeginFrameSource. (Closed)
Patch Set: Another attempt to fix the crash Created 4 years, 1 month 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_SCHEDULER_BEGIN_FRAME_SOURCE_H_ 5 #ifndef CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_
6 #define CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_ 6 #define CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <set> 11 #include <set>
12 #include <string> 12 #include <string>
13 13
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/trace_event/trace_event.h" 16 #include "base/trace_event/trace_event.h"
17 #include "cc/output/begin_frame_args.h" 17 #include "cc/output/begin_frame_args.h"
18 #include "cc/scheduler/delay_based_time_source.h" 18 #include "cc/scheduler/delay_based_time_source.h"
19 #include "cc/scheduler/vsync_observer.h"
19 20
20 namespace cc { 21 namespace cc {
21 22
22 // (Pure) Interface for observing BeginFrame messages from BeginFrameSource 23 // (Pure) Interface for observing BeginFrame messages from BeginFrameSource
23 // objects. 24 // objects.
24 class CC_EXPORT BeginFrameObserver { 25 class CC_EXPORT BeginFrameObserver {
25 public: 26 public:
26 virtual ~BeginFrameObserver() {} 27 virtual ~BeginFrameObserver() {}
27 28
28 // The |args| given to OnBeginFrame is guaranteed to have 29 // The |args| given to OnBeginFrame is guaranteed to have
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 class CC_EXPORT StubBeginFrameSource : public BeginFrameSource { 123 class CC_EXPORT StubBeginFrameSource : public BeginFrameSource {
123 public: 124 public:
124 void DidFinishFrame(BeginFrameObserver* obs, 125 void DidFinishFrame(BeginFrameObserver* obs,
125 size_t remaining_frames) override {} 126 size_t remaining_frames) override {}
126 void AddObserver(BeginFrameObserver* obs) override {} 127 void AddObserver(BeginFrameObserver* obs) override {}
127 void RemoveObserver(BeginFrameObserver* obs) override {} 128 void RemoveObserver(BeginFrameObserver* obs) override {}
128 bool IsThrottled() const override; 129 bool IsThrottled() const override;
129 }; 130 };
130 131
131 // A frame source which ticks itself independently. 132 // A frame source which ticks itself independently.
132 class CC_EXPORT SyntheticBeginFrameSource : public BeginFrameSource { 133 class CC_EXPORT SyntheticBeginFrameSource : public BeginFrameSource,
134 public VSyncObserver {
133 public: 135 public:
134 ~SyntheticBeginFrameSource() override; 136 ~SyntheticBeginFrameSource() override;
135 137
136 virtual void OnUpdateVSyncParameters(base::TimeTicks timebase,
137 base::TimeDelta interval) = 0;
138 // This overrides any past or future interval from updating vsync parameters. 138 // This overrides any past or future interval from updating vsync parameters.
139 virtual void SetAuthoritativeVSyncInterval(base::TimeDelta interval) = 0; 139 virtual void SetAuthoritativeVSyncInterval(base::TimeDelta interval) = 0;
140 }; 140 };
141 141
142 // A frame source which calls BeginFrame (at the next possible time) as soon as 142 // A frame source which calls BeginFrame (at the next possible time) as soon as
143 // remaining frames reaches zero. 143 // remaining frames reaches zero.
144 class CC_EXPORT BackToBackBeginFrameSource : public SyntheticBeginFrameSource, 144 class CC_EXPORT BackToBackBeginFrameSource : public SyntheticBeginFrameSource,
145 public DelayBasedTimeSourceClient { 145 public DelayBasedTimeSourceClient {
146 public: 146 public:
147 explicit BackToBackBeginFrameSource( 147 explicit BackToBackBeginFrameSource(
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 ExternalBeginFrameSourceClient* client_; 240 ExternalBeginFrameSourceClient* client_;
241 bool paused_ = false; 241 bool paused_ = false;
242 242
243 private: 243 private:
244 DISALLOW_COPY_AND_ASSIGN(ExternalBeginFrameSource); 244 DISALLOW_COPY_AND_ASSIGN(ExternalBeginFrameSource);
245 }; 245 };
246 246
247 } // namespace cc 247 } // namespace cc
248 248
249 #endif // CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_ 249 #endif // CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698