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

Unified Diff: cc/surfaces/compositor_frame_sink_support.h

Issue 2543373002: Extract non-Mojo bits of GpuCompositorFrameSink to CompositorFrameSinkSupport (Closed)
Patch Set: Rebased Created 4 years 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/BUILD.gn ('k') | cc/surfaces/compositor_frame_sink_support.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/surfaces/compositor_frame_sink_support.h
diff --git a/cc/surfaces/compositor_frame_sink_support.h b/cc/surfaces/compositor_frame_sink_support.h
new file mode 100644
index 0000000000000000000000000000000000000000..1d89554e025567337fc70b2f21464bccc4c1b434
--- /dev/null
+++ b/cc/surfaces/compositor_frame_sink_support.h
@@ -0,0 +1,104 @@
+// Copyright 2016 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_COMPOSITOR_FRAME_SINK_SUPPORT_H_
+#define CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_
+
+#include "base/compiler_specific.h"
+#include "base/memory/weak_ptr.h"
+#include "cc/output/compositor_frame.h"
+#include "cc/scheduler/begin_frame_source.h"
+#include "cc/surfaces/display.h"
+#include "cc/surfaces/display_client.h"
+#include "cc/surfaces/surface_factory.h"
+#include "cc/surfaces/surface_factory_client.h"
+#include "cc/surfaces/surfaces_export.h"
+
+namespace cc {
+
+class CompositorFrameSinkSupportClient;
+class Display;
+class SurfaceManager;
+
+class CC_SURFACES_EXPORT CompositorFrameSinkSupport
+ : public NON_EXPORTED_BASE(DisplayClient),
+ public SurfaceFactoryClient,
+ public BeginFrameObserver {
+ public:
+ CompositorFrameSinkSupport(CompositorFrameSinkSupportClient* client,
+ SurfaceManager* surface_manager,
+ const FrameSinkId& frame_sink_id,
+ std::unique_ptr<Display> display);
+
+ ~CompositorFrameSinkSupport() override;
+
+ const FrameSinkId& frame_sink_id() const { return frame_sink_id_; }
+
+ void EvictFrame();
+ void SetNeedsBeginFrame(bool needs_begin_frame);
+ void SubmitCompositorFrame(const LocalFrameId& local_frame_id,
+ CompositorFrame frame);
+ void AddChildFrameSink(const FrameSinkId& child_frame_sink_id);
+ void RemoveChildFrameSink(const FrameSinkId& child_frame_sink_id);
+
+ private:
+ void DidReceiveCompositorFrameAck();
+
+ // DisplayClient implementation.
+ void DisplayOutputSurfaceLost() override;
+ void DisplayWillDrawAndSwap(bool will_draw_and_swap,
+ const RenderPassList& render_passes) override;
+ void DisplayDidDrawAndSwap() override;
+
+ // SurfaceFactoryClient implementation.
+ void ReturnResources(const ReturnedResourceArray& resources) override;
+ void SetBeginFrameSource(BeginFrameSource* begin_frame_source) override;
+ void WillDrawSurface(const LocalFrameId& local_frame_id,
+ const gfx::Rect& damage_rect) override;
+
+ // BeginFrameObserver implementation.
+ void OnBeginFrame(const BeginFrameArgs& args) override;
+ const BeginFrameArgs& LastUsedBeginFrameArgs() const override;
+ void OnBeginFrameSourcePausedChanged(bool paused) override;
+
+ void UpdateNeedsBeginFramesInternal();
+
+ CompositorFrameSinkSupportClient* const client_;
+
+ SurfaceManager* const surface_manager_;
+
+ const FrameSinkId frame_sink_id_;
+
+ // GpuCompositorFrameSink holds a Display if it created with
+ // non-null gpu::SurfaceHandle. In the window server, the display root
+ // window's CompositorFrameSink will have a valid gpu::SurfaceHandle.
+ std::unique_ptr<Display> display_;
+
+ LocalFrameId local_frame_id_;
+ SurfaceFactory surface_factory_;
+ // Counts the number of CompositorFrames that have been submitted and have not
+ // yet received an ACK.
+ int ack_pending_count_ = 0;
+ ReturnedResourceArray surface_returned_resources_;
+
+ // The begin frame source being observered. Null if none.
+ BeginFrameSource* begin_frame_source_ = nullptr;
+
+ // The last begin frame args generated by the begin frame source.
+ BeginFrameArgs last_begin_frame_args_;
+
+ // Whether a request for begin frames has been issued.
+ bool needs_begin_frame_ = false;
+
+ // Whether or not a frame observer has been added.
+ bool added_frame_observer_ = false;
+
+ base::WeakPtrFactory<CompositorFrameSinkSupport> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkSupport);
+};
+
+} // namespace cc
+
+#endif // CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_
« no previous file with comments | « cc/surfaces/BUILD.gn ('k') | cc/surfaces/compositor_frame_sink_support.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698