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

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

Issue 2493223002: Change exo::SurfaceFactoryOwner to exo::ExoCompositorFrameSink (Closed)
Patch Set: Undid a change on an if condition in exo::Surface::CommitSurfaceHierarchy() 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/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 ExoCompositorFrameSink : public cc::SurfaceFactoryClient,
34 public cc::BeginFrameObserver,
35 public cc::mojom::MojoCompositorFrameSink {
36 public:
37 ExoCompositorFrameSink(const cc::FrameSinkId& frame_sink_id,
38 cc::SurfaceManager* surface_manager,
39 cc::mojom::MojoCompositorFrameSinkClientPtr client);
40
41 ~ExoCompositorFrameSink() override;
42
43 // cc::mojom::MojoCompositorFrameSink:
44 void SetNeedsBeginFrame(bool needs_begin_frame) override;
45 void SubmitCompositorFrame(const cc::LocalFrameId& local_frame_id,
46 cc::CompositorFrame frame) override;
47 void EvictFrame() override;
48
49 private:
50 void UpdateNeedsBeginFrameInternal();
51 void DidReceiveCompositorFrameAck();
52
53 // cc::SurfaceFactoryClient:
54 void ReturnResources(const cc::ReturnedResourceArray& resources) override;
55 void WillDrawSurface(const cc::LocalFrameId& id,
56 const gfx::Rect& damage_rect) override;
57 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override;
58
59 // cc::BeginFrameObserver:
60 void OnBeginFrame(const cc::BeginFrameArgs& args) override;
61 const cc::BeginFrameArgs& LastUsedBeginFrameArgs() const override;
62 void OnBeginFrameSourcePausedChanged(bool paused) override;
63
64 const cc::FrameSinkId frame_sink_id_;
65 cc::LocalFrameId last_local_frame_id_;
66
67 cc::SurfaceManager* surface_manager_;
68 cc::SurfaceFactory surface_factory_;
69
70 cc::mojom::MojoCompositorFrameSinkClientPtr client_;
71
72 int ack_pending_count_ = 0;
73 cc::ReturnedResourceArray surface_returned_resources_;
74
75 cc::BeginFrameSource* begin_frame_source_ = nullptr;
76
77 gfx::Size last_submitted_frame_size_;
78
79 cc::BeginFrameArgs last_begin_frame_args_;
80
81 bool needs_begin_frame_ = false;
82 bool added_frame_observer_ = false;
83
84 DISALLOW_COPY_AND_ASSIGN(ExoCompositorFrameSink);
85 };
86
87 } // namespace exo
88
89 #endif // COMPONENTS_EXO_EXO_COMPOSITOR_FRAME_SINK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698