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

Unified Diff: services/ui/ws/server_window_compositor_frame_sink.h

Issue 2480203002: ui: Cleanup class/struct forward declarations (Closed)
Patch Set: Sync CL to position 430550 Created 4 years, 1 month 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 | « services/ui/ws/server_window.cc ('k') | services/ui/ws/server_window_compositor_frame_sink.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/ws/server_window_compositor_frame_sink.h
diff --git a/services/ui/ws/server_window_compositor_frame_sink.h b/services/ui/ws/server_window_compositor_frame_sink.h
index d78fc0e745a9abdeb09686da200c0f930c6da956..7703942ad9e3f310d6920485ca0bbfe3c99a5d9d 100644
--- a/services/ui/ws/server_window_compositor_frame_sink.h
+++ b/services/ui/ws/server_window_compositor_frame_sink.h
@@ -13,6 +13,7 @@
#include "cc/ipc/compositor_frame.mojom.h"
#include "cc/ipc/mojo_compositor_frame_sink.mojom.h"
#include "cc/output/context_provider.h"
+#include "cc/scheduler/begin_frame_source.h"
#include "cc/surfaces/display.h"
#include "cc/surfaces/display_client.h"
#include "cc/surfaces/frame_sink_id.h"
@@ -21,7 +22,6 @@
#include "cc/surfaces/surface_id.h"
#include "cc/surfaces/surface_id_allocator.h"
#include "mojo/public/cpp/bindings/binding.h"
-#include "services/ui/public/interfaces/window_tree.mojom.h"
#include "services/ui/surfaces/surfaces_context_provider.h"
#include "services/ui/ws/ids.h"
@@ -40,16 +40,20 @@ class DisplayCompositor;
namespace ws {
class ServerWindow;
-class ServerWindowCompositorFrameSinkManager;
// Server side representation of a WindowSurface.
class ServerWindowCompositorFrameSink
: public cc::mojom::MojoCompositorFrameSink,
public cc::DisplayClient,
- public cc::SurfaceFactoryClient {
+ public cc::mojom::MojoCompositorFrameSinkPrivate,
+ public cc::SurfaceFactoryClient,
+ public cc::BeginFrameObserver {
public:
+ // TODO(fsamuel): DisplayCompositor should own
+ // ServerWindowCompositorFrameSink. ServerWindowCompositorFrameSink should not
+ // refer to ServerWindowCompositorFrameSinkManager.
ServerWindowCompositorFrameSink(
- ServerWindowCompositorFrameSinkManager* manager,
+ scoped_refptr<DisplayCompositor> display_compositor,
const cc::FrameSinkId& frame_sink_id,
gfx::AcceleratedWidget widget,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
@@ -63,6 +67,11 @@ class ServerWindowCompositorFrameSink
void SetNeedsBeginFrame(bool needs_begin_frame) override;
void SubmitCompositorFrame(cc::CompositorFrame frame) override;
+ // cc::mojom::MojoCompositorFrameSinkPrivate:
+ void AddChildFrameSink(const cc::FrameSinkId& child_frame_sink_id) override;
+ void RemoveChildFrameSink(
+ const cc::FrameSinkId& child_frame_sink_id) override;
+
private:
void InitDisplay(gfx::AcceleratedWidget widget,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
@@ -70,20 +79,30 @@ class ServerWindowCompositorFrameSink
void DidReceiveCompositorFrameAck();
- // DisplayClient implementation.
+ // cc::DisplayClient implementation.
void DisplayOutputSurfaceLost() override;
void DisplayWillDrawAndSwap(bool will_draw_and_swap,
const cc::RenderPassList& render_passes) override;
void DisplayDidDrawAndSwap() override;
- // SurfaceFactoryClient implementation.
+ // cc::SurfaceFactoryClient implementation.
void ReturnResources(const cc::ReturnedResourceArray& resources) override;
void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override;
+ // cc::BeginFrameObserver implementation.
+ void OnBeginFrame(const cc::BeginFrameArgs& args) override;
+ const cc::BeginFrameArgs& LastUsedBeginFrameArgs() const override;
+ void OnBeginFrameSourcePausedChanged(bool paused) override;
+
+ void UpdateNeedsBeginFramesInternal();
+
const cc::FrameSinkId frame_sink_id_;
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
- ServerWindowCompositorFrameSinkManager* manager_; // Owns this.
+ // TODO(fsamuel): We hold a reference to DisplayCompositor so we can talk to
+ // SurfaceManager in the destructor. In the future, DisplayCompositor will own
+ // ServerWindowCompositorFrameSink.
+ scoped_refptr<DisplayCompositor> display_compositor_;
gfx::Size last_submitted_frame_size_;
// ServerWindowCompositorFrameSink holds a cc::Display if it created with
@@ -99,8 +118,20 @@ class ServerWindowCompositorFrameSink
int ack_pending_count_ = 0;
cc::ReturnedResourceArray surface_returned_resources_;
+ // The begin frame source being observered. Null if none.
+ cc::BeginFrameSource* begin_frame_source_ = nullptr;
+
+ // The last begin frame args generated by the begin frame source.
+ cc::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;
+
cc::mojom::MojoCompositorFrameSinkClientPtr client_;
- mojo::Binding<MojoCompositorFrameSink> binding_;
+ mojo::Binding<cc::mojom::MojoCompositorFrameSink> binding_;
DISALLOW_COPY_AND_ASSIGN(ServerWindowCompositorFrameSink);
};
« no previous file with comments | « services/ui/ws/server_window.cc ('k') | services/ui/ws/server_window_compositor_frame_sink.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698