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

Side by Side Diff: components/exo/compositor_frame_sink.h

Issue 2493223002: Change exo::SurfaceFactoryOwner to exo::ExoCompositorFrameSink (Closed)
Patch Set: Added MojoCompositorFrameSink::Require() and MojoCompositorFrameSink::Satisfy() 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_EXO_EXO_COMPOSITOR_FRAME_SINK_H_
6 #define COMPONENTS_EXO_EXO_COMPOSITOR_FRAME_SINK_H_
7
8 #include <memory>
9 #include <utility>
10
11 #include "base/callback.h"
12 #include "base/macros.h"
13 #include "base/memory/weak_ptr.h"
14 #include "cc/ipc/compositor_frame.mojom.h"
15 #include "cc/ipc/mojo_compositor_frame_sink.mojom.h"
16 #include "cc/resources/transferable_resource.h"
17 #include "cc/scheduler/begin_frame_source.h"
18 #include "cc/surfaces/surface_factory.h"
19 #include "cc/surfaces/surface_factory_client.h"
20 #include "mojo/public/cpp/bindings/strong_binding.h"
21 #include "ui/gfx/geometry/rect.h"
22
23 namespace cc {
24 class SurfaceFactory;
25 }
26
27 namespace exo {
28
29 // This class owns the SurfaceFactory and keeps track of references to the
30 // contents of Buffers. It's keeped alive by references from
31 // release_callbacks_. It's destroyed when its owning Surface is destroyed and
32 // the last outstanding release callback is called.
33 class CompositorFrameSink : public cc::SurfaceFactoryClient,
34 public cc::BeginFrameObserver,
35 public cc::mojom::MojoCompositorFrameSink {
36 public:
37 static void Create(const cc::FrameSinkId& frame_sink_id,
38 cc::SurfaceManager* surface_manager,
39 cc::mojom::MojoCompositorFrameSinkClientPtr client,
40 cc::mojom::MojoCompositorFrameSinkRequest request);
41
42 CompositorFrameSink(const cc::FrameSinkId& frame_sink_id,
43 cc::SurfaceManager* surface_manager,
44 cc::mojom::MojoCompositorFrameSinkClientPtr client);
45
46 ~CompositorFrameSink() override;
47
48 // cc::mojom::MojoCompositorFrameSink:
49 void SetNeedsBeginFrame(bool needs_begin_frame) override;
50 void SubmitCompositorFrame(const cc::LocalFrameId& local_frame_id,
51 cc::CompositorFrame frame) override;
52 void EvictFrame() override;
53 void Require(const cc::LocalFrameId& local_frame_id,
54 const cc::SurfaceSequence& sequence) override;
55 void Satisfy(const cc::SurfaceSequence& sequence) override;
56
57 private:
58 void UpdateNeedsBeginFrameInternal();
59 void DidReceiveCompositorFrameAck();
60
61 // cc::SurfaceFactoryClient:
62 void ReturnResources(const cc::ReturnedResourceArray& resources) override;
63 void WillDrawSurface(const cc::LocalFrameId& id,
64 const gfx::Rect& damage_rect) override;
65 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override;
66
67 // cc::BeginFrameObserver:
68 void OnBeginFrame(const cc::BeginFrameArgs& args) override;
69 const cc::BeginFrameArgs& LastUsedBeginFrameArgs() const override;
70 void OnBeginFrameSourcePausedChanged(bool paused) override;
71
72 const cc::FrameSinkId frame_sink_id_;
73
74 cc::SurfaceManager* surface_manager_;
75 cc::SurfaceFactory surface_factory_;
76
77 cc::mojom::MojoCompositorFrameSinkClientPtr client_;
78
79 int ack_pending_count_ = 0;
80 cc::ReturnedResourceArray surface_returned_resources_;
81
82 cc::BeginFrameSource* begin_frame_source_ = nullptr;
83
84 gfx::Size last_submitted_frame_size_;
85
86 cc::BeginFrameArgs last_begin_frame_args_;
87
88 bool needs_begin_frame_ = false;
89 bool added_frame_observer_ = false;
90
91 mojo::StrongBindingPtr<cc::mojom::MojoCompositorFrameSink> binding_;
92
93 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSink);
94 };
95
96 } // namespace exo
97
98 #endif // COMPONENTS_EXO_EXO_COMPOSITOR_FRAME_SINK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698