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

Unified Diff: components/display_compositor/frame_evictor.h

Issue 2811083002: Move frame eviction into components (Closed)
Patch Set: Move features into base,and rename Created 3 years, 8 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: components/display_compositor/frame_evictor.h
diff --git a/components/display_compositor/frame_evictor.h b/components/display_compositor/frame_evictor.h
new file mode 100644
index 0000000000000000000000000000000000000000..9e3c49ce5b69c3c878aa222b6a89e326fc72f5c0
--- /dev/null
+++ b/components/display_compositor/frame_evictor.h
@@ -0,0 +1,47 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
Fady Samuel 2017/04/12 03:17:02 nit: 2017
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_DISPLAY_COMPOSITOR_FRAME_EVICTOR_H_
+#define COMPONENTS_DISPLAY_COMPOSITOR_FRAME_EVICTOR_H_
+
+#include "base/macros.h"
+#include "components/display_compositor/display_compositor_export.h"
+#include "components/display_compositor/frame_eviction_manager.h"
+
+namespace display_compositor {
+
+class DISPLAY_COMPOSITOR_EXPORT FrameEvictorClient {
+ public:
+ virtual ~FrameEvictorClient() {}
+ virtual void EvictDelegatedFrame() = 0;
+};
+
+class DISPLAY_COMPOSITOR_EXPORT FrameEvictor
+ : public FrameEvictionManagerClient {
+ public:
+ // |client| must outlive |this|.
+ explicit FrameEvictor(FrameEvictorClient* client);
+ ~FrameEvictor() override;
+
+ void SwappedFrame(bool visible);
+ void DiscardedFrame();
+ void SetVisible(bool visible);
+ void LockFrame();
+ void UnlockFrame();
+ bool HasFrame() { return has_frame_; }
+
+ private:
+ // FrameEvictionManagerClient implementation.
+ void EvictCurrentFrame() override;
+
+ FrameEvictorClient* client_;
+ bool has_frame_;
+ bool visible_;
+
+ DISALLOW_COPY_AND_ASSIGN(FrameEvictor);
+};
+
+} // namespace display_compositor
+
+#endif // COMPONENTS_DISPLAY_COMPOSITOR_FRAME_EVICTOR_H_

Powered by Google App Engine
This is Rietveld 408576698