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

Unified Diff: cc/surfaces/display_scheduler.h

Issue 1138563002: Add DisplayScheduler for Surfaces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@rendererLatencyRecoveryHeuristic
Patch Set: rebase Created 5 years, 7 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
« no previous file with comments | « cc/surfaces/display_client.h ('k') | cc/surfaces/display_scheduler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..faabcbbc8f06b9aa53951132ab514d907b31900e
--- /dev/null
+++ b/cc/surfaces/display_scheduler.h
@@ -0,0 +1,91 @@
+// 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 BeginFrameSource;
+
+// TODO(brianderson): Reconcile with SurfacesScheduler crbug.com/476676
+class CC_SURFACES_EXPORT DisplaySchedulerClient {
+ public:
+ virtual ~DisplaySchedulerClient() {}
+
+ virtual bool DrawAndSwap() = 0;
+};
+
+class CC_SURFACES_EXPORT DisplayScheduler : public BeginFrameObserverMixIn {
+ public:
+ DisplayScheduler(DisplaySchedulerClient* client,
+ BeginFrameSource* begin_frame_source,
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner,
+ int max_pending_swaps);
+ ~DisplayScheduler() override;
+
+ void SetRootSurfaceResourcesLocked(bool locked);
+ virtual void EntireDisplayDamaged(SurfaceId root_surface_id);
+ virtual void SurfaceDamaged(SurfaceId surface_id);
+
+ virtual void DidSwapBuffers();
+ void DidSwapBuffersComplete();
+
+ void OutputSurfaceLost();
+
+ // BeginFrameObserverMixIn implementation
+ bool OnBeginFrameMixInDelegate(const BeginFrameArgs& args) override;
+
+ protected:
+ base::TimeTicks DesiredBeginFrameDeadlineTime();
+ virtual void ScheduleBeginFrameDeadline();
+ void OnBeginFrameDeadline();
+ void DrawAndSwap();
+
+ DisplaySchedulerClient* client_;
+ BeginFrameSource* begin_frame_source_;
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
+
+ BeginFrameArgs current_begin_frame_args_;
+ base::Closure begin_frame_deadline_closure_;
+ base::CancelableClosure begin_frame_deadline_task_;
+ base::TimeTicks begin_frame_deadline_task_time_;
+
+ bool output_surface_lost_;
+ bool root_surface_resources_locked_;
+
+ bool inside_begin_frame_deadline_interval_;
+ bool needs_draw_;
+ bool entire_display_damaged_;
+ bool all_active_child_surfaces_ready_to_draw_;
+
+ int pending_swaps_;
+ int max_pending_swaps_;
+
+ SurfaceId root_surface_id_;
+ bool root_surface_damaged_;
+ bool expect_damage_from_root_surface_;
+
+ std::set<SurfaceId> child_surface_ids_damaged_;
+ std::set<SurfaceId> child_surface_ids_damaged_prev_;
+ std::vector<SurfaceId> child_surface_ids_to_expect_damage_from_;
+
+ base::WeakPtrFactory<DisplayScheduler> weak_ptr_factory_;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DisplayScheduler);
+};
+
+} // namespace cc
+
+#endif // CC_SURFACES_DISPLAY_SCHEDULER_H_
« no previous file with comments | « cc/surfaces/display_client.h ('k') | cc/surfaces/display_scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698