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

Unified Diff: cc/surfaces/display_scheduler.h

Issue 1012853003: Add DisplayScheduler for Surfaces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DisplaySchedulerClient in preparation of unittests Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: cc/surfaces/display_scheduler.h
diff --git a/cc/surfaces/display_scheduler.h b/cc/surfaces/display_scheduler.h
new file mode 100644
index 0000000000000000000000000000000000000000..efc4f31e3416efc0d4802d099e3bd9c96bf98f13
--- /dev/null
+++ b/cc/surfaces/display_scheduler.h
@@ -0,0 +1,88 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CC_SURFACES_DISPLAY_SCHEDULER_H_
+#define CC_SURFACES_DISPLAY_SCHEDULER_H_
+
+#include "base/cancelable_callback.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/single_thread_task_runner.h"
+#include "cc/scheduler/begin_frame_source.h"
+#include "cc/surfaces/surface_id.h"
+#include "cc/surfaces/surfaces_export.h"
+
+namespace cc {
+
+class OutputSurface;
+
+class CC_SURFACES_EXPORT DisplaySchedulerClient {
+ public:
+ virtual bool Draw() = 0;
+};
+
+class CC_SURFACES_EXPORT DisplayScheduler : public BeginFrameObserverMixIn {
+ public:
+ DisplayScheduler(DisplaySchedulerClient* display,
+ OutputSurface* output_surface,
+ int max_pending_swaps,
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner);
+ ~DisplayScheduler() override;
+
+ void SetResourcesLockedByBrowser(bool locked);
+ void EntireDisplayDamaged();
+ void SurfaceDamaged(SurfaceId surface_id);
+
+ void DidSwapBuffers();
+ void DidSwapBuffersComplete();
+
+ void SetAuthoritativeVSyncInterval(const base::TimeDelta& interval);
+ void CommitVSyncParameters(base::TimeTicks timebase,
+ base::TimeDelta interval);
+ void OutputSurfaceLost();
+
+ // BeginFrameObserverMixIn implementation
+ bool OnBeginFrameMixInDelegate(const BeginFrameArgs& args) override;
+
+ private:
+ base::TimeTicks DesiredBeginFrameDeadlineTime();
+ void ScheduleBeginFrameDeadline();
+ void OnBeginFrameDeadline();
+ void Draw();
+
+ DisplaySchedulerClient* client_;
+ OutputSurface* output_surface_;
brianderson 2015/04/07 02:32:19 This wasn't used anywhere, so I got rid of it.
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
+ scoped_ptr<BeginFrameSource> begin_frame_source_;
+ VSyncParameterObserver* vsync_observer_;
+ base::TimeDelta authoritative_vsync_interval_;
+ base::TimeTicks last_vsync_timebase_;
+
+ BeginFrameArgs current_begin_frame_args_;
+ base::Closure begin_impl_frame_deadline_closure_;
+ base::CancelableClosure begin_impl_frame_deadline_task_;
+ base::TimeTicks begin_impl_frame_deadline_task_time_;
+
+ bool output_surface_lost_;
+ bool inside_begin_frame_deadline_interval_;
+
+ bool resources_locked_by_browser_;
+ bool needs_draw_;
+ bool entire_display_damaged_;
+ bool all_active_surfaces_ready_to_draw_;
+ int pending_swaps_;
+ int max_pending_swaps_;
+
+ std::set<SurfaceId> surface_ids_damaged_;
+ std::set<SurfaceId> surface_ids_damaged_prev_;
+ std::vector<SurfaceId> surface_ids_to_expect_damage_from_;
+
+ base::WeakPtrFactory<DisplayScheduler> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(DisplayScheduler);
+};
+
+} // namespace cc
+
+#endif // CC_SURFACES_DISPLAY_SCHEDULER_H_

Powered by Google App Engine
This is Rietveld 408576698