Reenable NullOpenerRedirectForksProcess, as the offending patch has been reverted
[chromium-blink-merge.git] / cc / scheduler.h
blobffe03cf215d2628a959735791e06474c8c652a48
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
3 // found in the LICENSE file.
5 #ifndef CC_SCHEDULER_H_
6 #define CC_SCHEDULER_H_
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/time.h"
11 #include "cc/cc_export.h"
12 #include "cc/frame_rate_controller.h"
13 #include "cc/layer_tree_host.h"
14 #include "cc/scheduler_state_machine.h"
16 namespace cc {
18 class Thread;
20 struct ScheduledActionDrawAndSwapResult {
21 ScheduledActionDrawAndSwapResult()
22 : didDraw(false)
23 , didSwap(false)
26 ScheduledActionDrawAndSwapResult(bool didDraw, bool didSwap)
27 : didDraw(didDraw)
28 , didSwap(didSwap)
31 bool didDraw;
32 bool didSwap;
35 class SchedulerClient {
36 public:
37 virtual void scheduledActionBeginFrame() = 0;
38 virtual ScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapIfPossible() = 0;
39 virtual ScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced() = 0;
40 virtual void scheduledActionCommit() = 0;
41 virtual void scheduledActionBeginContextRecreation() = 0;
42 virtual void scheduledActionAcquireLayerTexturesForMainThread() = 0;
43 virtual void didAnticipatedDrawTimeChange(base::TimeTicks) = 0;
45 protected:
46 virtual ~SchedulerClient() { }
49 class CC_EXPORT Scheduler : FrameRateControllerClient {
50 public:
51 static scoped_ptr<Scheduler> create(SchedulerClient* client, scoped_ptr<FrameRateController> frameRateController)
53 return make_scoped_ptr(new Scheduler(client, frameRateController.Pass()));
56 virtual ~Scheduler();
58 void setCanBeginFrame(bool);
60 void setVisible(bool);
61 void setCanDraw(bool);
63 void setNeedsCommit();
65 // Like setNeedsCommit(), but ensures a commit will definitely happen even if we are not visible.
66 void setNeedsForcedCommit();
68 void setNeedsRedraw();
70 void setMainThreadNeedsLayerTextures();
72 // Like setNeedsRedraw(), but ensures the draw will definitely happen even if we are not visible.
73 void setNeedsForcedRedraw();
75 void beginFrameComplete();
76 void beginFrameAborted();
78 void setMaxFramesPending(int);
79 void setSwapBuffersCompleteSupported(bool);
80 void didSwapBuffersComplete();
82 void didLoseContext();
83 void didRecreateContext();
85 bool commitPending() const { return m_stateMachine.commitPending(); }
86 bool redrawPending() const { return m_stateMachine.redrawPending(); }
88 void setTimebaseAndInterval(base::TimeTicks timebase, base::TimeDelta interval);
90 base::TimeTicks anticipatedDrawTime();
92 // FrameRateControllerClient implementation
93 virtual void vsyncTick(bool throttled) OVERRIDE;
95 private:
96 Scheduler(SchedulerClient*, scoped_ptr<FrameRateController>);
98 void processScheduledActions();
100 SchedulerClient* m_client;
101 scoped_ptr<FrameRateController> m_frameRateController;
102 SchedulerStateMachine m_stateMachine;
103 bool m_insideProcessScheduledActions;
105 DISALLOW_COPY_AND_ASSIGN(Scheduler);
108 } // namespace cc
110 #endif // CC_SCHEDULER_H_