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

Side by Side Diff: cc/scheduler/begin_frame_source.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 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 <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
11 #include "base/debug/trace_event.h" 11 #include "base/debug/trace_event.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/memory/ref_counted.h"
13 #include "cc/output/begin_frame_args.h" 14 #include "cc/output/begin_frame_args.h"
14 #include "cc/output/vsync_parameter_observer.h" 15 #include "cc/output/vsync_parameter_observer.h"
15 #include "cc/scheduler/delay_based_time_source.h" 16 #include "cc/scheduler/delay_based_time_source.h"
16 17
17 namespace cc { 18 namespace cc {
18 19
19 // (Pure) Interface for observing BeginFrame messages from BeginFrameSource 20 // (Pure) Interface for observing BeginFrame messages from BeginFrameSource
20 // objects. 21 // objects.
21 class CC_EXPORT BeginFrameObserver { 22 class CC_EXPORT BeginFrameObserver {
22 public: 23 public:
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 // needs_begin_frames change. 156 // needs_begin_frames change.
156 virtual void OnNeedsBeginFramesChange(bool needs_begin_frames) {} 157 virtual void OnNeedsBeginFramesChange(bool needs_begin_frames) {}
157 158
158 BeginFrameObserver* observer_; 159 BeginFrameObserver* observer_;
159 bool needs_begin_frames_; 160 bool needs_begin_frames_;
160 161
161 private: 162 private:
162 bool inside_as_value_into_; 163 bool inside_as_value_into_;
163 }; 164 };
164 165
166 // A frame source that delivers BeginFrame from outside of cc.
167 // ExternalBeginFrameSource is ref-counted object because it could be used by
168 // outside of cc to deliver new BeginFrame.
169 class CC_EXPORT ExternalBeginFrameSource
170 : public BeginFrameSourceMixIn,
171 public base::RefCounted<ExternalBeginFrameSource>,
172 public NON_EXPORTED_BASE(base::NonThreadSafe) {
173 public:
174 ExternalBeginFrameSource() {}
175
176 // Tells the Source that client is ready to handle external BeginFrames.
177 virtual void SetClientReady() {}
178
179 protected:
180 friend class base::RefCounted<ExternalBeginFrameSource>;
181 virtual ~ExternalBeginFrameSource() {}
182
183 private:
184 DISALLOW_COPY_AND_ASSIGN(ExternalBeginFrameSource);
185 };
186
165 // A frame source which calls BeginFrame (at the next possible time) as soon as 187 // A frame source which calls BeginFrame (at the next possible time) as soon as
166 // remaining frames reaches zero. 188 // remaining frames reaches zero.
167 class CC_EXPORT BackToBackBeginFrameSource : public BeginFrameSourceMixIn { 189 class CC_EXPORT BackToBackBeginFrameSource : public BeginFrameSourceMixIn {
168 public: 190 public:
169 static scoped_ptr<BackToBackBeginFrameSource> Create( 191 static scoped_ptr<BackToBackBeginFrameSource> Create(
170 base::SingleThreadTaskRunner* task_runner); 192 base::SingleThreadTaskRunner* task_runner);
171 virtual ~BackToBackBeginFrameSource(); 193 virtual ~BackToBackBeginFrameSource();
172 194
173 // BeginFrameSource 195 // BeginFrameSource
174 virtual void DidFinishFrame(size_t remaining_frames) override; 196 virtual void DidFinishFrame(size_t remaining_frames) override;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 293
272 base::TimeDelta minimum_interval_; 294 base::TimeDelta minimum_interval_;
273 295
274 BeginFrameSource* active_source_; 296 BeginFrameSource* active_source_;
275 std::set<BeginFrameSource*> source_list_; 297 std::set<BeginFrameSource*> source_list_;
276 }; 298 };
277 299
278 } // namespace cc 300 } // namespace cc
279 301
280 #endif // CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_ 302 #endif // CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698