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

Side by Side Diff: blimp/engine/renderer/scheduler.h

Issue 2413063002: content/blimp: Set up hooks for enabling LTHRemote in the renderer. (Closed)
Patch Set: Rebase Created 4 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
(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 BLIMP_ENGINE_RENDERER_SCHEDULER_H_
6 #define BLIMP_ENGINE_RENDERER_SCHEDULER_H_
7
8 #include "base/macros.h"
9 #include "base/memory/weak_ptr.h"
10 #include "base/timer/timer.h"
11
12 namespace blimp {
13 namespace engine {
14
15 class SchedulerClient;
16
17 // Responsible for scheduling frame updates sent to the client.
18 class Scheduler {
19 public:
20 Scheduler(scoped_refptr<base::SingleThreadTaskRunner> task_runner,
21 SchedulerClient* client);
22 virtual ~Scheduler();
23
24 void SetNeedsMainFrame();
25 void DidSendFrameUpdateToClient();
26 void DidReceiveFrameUpdateAck();
27
28 base::TimeTicks next_frame_time() const { return next_frame_time_; }
29
30 protected:
31 // protected for testing.
32 Scheduler(base::TimeDelta frame_delay,
33 scoped_refptr<base::SingleThreadTaskRunner> task_runner,
34 SchedulerClient* client);
35
36 private:
37 void ScheduleMainFrameIfNecessary();
38 bool CanProduceMainFrames() const;
39 void StartMainFrame();
40
41 // Set to true if the |client_| has requested us to schedule main frames.
42 bool needs_main_frame_ = false;
43
44 // Set to true if a frame update was sent to the client and the ack is
45 // pending.
46 bool frame_ack_pending_ = false;
47
48 // The time at which the next main frame update can be run.
49 base::TimeTicks next_frame_time_;
50
51 // The delay to use between consecutive frames.
52 base::TimeDelta frame_delay_;
53
54 base::OneShotTimer frame_tick_timer_;
55
56 SchedulerClient* client_;
57
58 base::WeakPtrFactory<Scheduler> weak_ptr_factory_;
59
60 DISALLOW_COPY_AND_ASSIGN(Scheduler);
61 };
62
63 } // namespace engine
64 } // namespace blimp
65
66 #endif // BLIMP_ENGINE_RENDERER_SCHEDULER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698