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

Side by Side Diff: content/browser/compositor/gpu_vsync_begin_frame_source.h

Issue 2555173003: [Do not submit] D3DKMTWaitForVerticalBlankEvent VSync prototype (Closed)
Patch Set: Added command line switch and experiment support Created 3 years, 11 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 2016 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 CONTENT_BROWSER_COMPOSITOR_GPU_VSYNC_BEGIN_FRAME_SOURCE_H_
6 #define CONTENT_BROWSER_COMPOSITOR_GPU_VSYNC_BEGIN_FRAME_SOURCE_H_
7
8 #include "base/memory/weak_ptr.h"
9 #include "base/time/time.h"
10 #include "cc/scheduler/begin_frame_source.h"
11
12 namespace content {
13
14 class GpuVSyncControl {
15 public:
16 virtual void EnableVSync(bool enabled) = 0;
17 };
18
19 // TODO: this should derive from ExternalBeginFrameSource but existing
20 // implementation of gpu_process_transport_factory makes it difficult.
21 // Therefore the current solution is to duplicate some of
22 // ExternalBeginFrameSource implementation here.
23 class GpuVSyncBeginFrameSource : public cc::SyntheticBeginFrameSource {
24 public:
25 explicit GpuVSyncBeginFrameSource(GpuVSyncControl* vsync_control);
26 ~GpuVSyncBeginFrameSource() override;
27
28 // cc::BeginFrameSource implementation.
29 void AddObserver(cc::BeginFrameObserver* obs) override;
30 void RemoveObserver(cc::BeginFrameObserver* obs) override;
31 void DidFinishFrame(cc::BeginFrameObserver* obs,
32 const cc::BeginFrameAck& ack) override;
33 bool IsThrottled() const override;
34
35 // cc::SyntheticBeginFrameSource implementation.
36 void OnUpdateVSyncParameters(base::TimeTicks timebase,
37 base::TimeDelta interval) override;
38 void SetAuthoritativeVSyncInterval(base::TimeDelta interval) override;
39
40 private:
41 void OnBeginFrame(const cc::BeginFrameArgs& args);
42 static void OnBeginFrame(cc::BeginFrameObserver* obs,
43 const cc::BeginFrameArgs& args);
44 void EnableVSync(bool enabled);
45
46 GpuVSyncControl* const vsync_control_;
47 bool enabled_;
48 uint64_t next_sequence_number_;
49 cc::BeginFrameArgs previous_begin_frame_args_;
50 std::unordered_set<cc::BeginFrameObserver*> observers_;
51
52 DISALLOW_COPY_AND_ASSIGN(GpuVSyncBeginFrameSource);
53 };
54
55 } // namespace content
56
57 #endif // CONTENT_BROWSER_COMPOSITOR_GPU_VSYNC_BEGIN_FRAME_SOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698