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

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

Issue 2493223002: Change exo::SurfaceFactoryOwner to exo::ExoCompositorFrameSink (Closed)
Patch Set: Nit changes based on comments 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 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 #include <list>
6 #include <memory>
7 #include <set>
8 #include <utility>
9
10 #include "base/callback.h"
11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/memory/weak_ptr.h"
14 #include "base/observer_list.h"
15 #include "cc/ipc/compositor_frame.mojom.h"
16 #include "cc/ipc/mojo_compositor_frame_sink.mojom.h"
17 #include "cc/resources/transferable_resource.h"
18 #include "cc/scheduler/begin_frame_source.h"
19 #include "cc/surfaces/surface_factory.h"
20 #include "cc/surfaces/surface_factory_client.h"
21 #include "cc/surfaces/surface_id_allocator.h"
22 #include "mojo/public/cpp/bindings/binding.h"
23 #include "third_party/skia/include/core/SkRegion.h"
24 #include "third_party/skia/include/core/SkXfermode.h"
25 #include "ui/aura/window.h"
26 #include "ui/aura/window_observer.h"
27 #include "ui/gfx/geometry/rect.h"
28
29 namespace cc {
30 class SurfaceFactory;
31 }
32
33 namespace exo {
34
35 // This class owns the SurfaceFactory and keeps track of references to the
36 // contents of Buffers. It's keeped alive by references from
37 // release_callbacks_. It's destroyed when its owning Surface is destroyed and
38 // the last outstanding release callback is called.
39 class ExoCompositorFrameSink : public base::RefCounted<ExoCompositorFrameSink>,
40 public cc::SurfaceFactoryClient,
41 public cc::BeginFrameObserver {
42 public:
43 ExoCompositorFrameSink(const cc::FrameSinkId& frame_sink_id,
44 cc::SurfaceManager* surface_manager);
45
46 // cc::SurfaceFactoryClient:
Fady Samuel 2016/11/16 15:02:00 Make all these overrides private to indicate that
reveman 2016/11/16 17:43:30 I'm not a fan of changing access to functions when
Alex Z. 2016/11/16 19:56:16 Done.
47 void ReturnResources(const cc::ReturnedResourceArray& resources) override;
48 void WillDrawSurface(const cc::LocalFrameId& id,
49 const gfx::Rect& damage_rect) override;
50 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override;
51
52 // To be cc::mojom::MojoCompositorFrameSink:
53 void SubmitCompositorFrame(cc::CompositorFrame frame);
54
55 // cc::BeginFrameObserver:
Fady Samuel 2016/11/16 15:02:00 Make all these overrides private to indicate that
Alex Z. 2016/11/16 19:56:16 Done.
56 void OnBeginFrame(const cc::BeginFrameArgs& args) override;
57 const cc::BeginFrameArgs& LastUsedBeginFrameArgs() const override;
58 void OnBeginFrameSourcePausedChanged(bool paused) override;
59
60 cc::SurfaceManager* surface_manager() { return surface_manager_; }
Fady Samuel 2016/11/16 15:02:00 It would be nice to not read back things from ExoC
Alex Z. 2016/11/16 19:56:16 Done.
61
62 private:
63 friend class base::RefCounted<ExoCompositorFrameSink>;
64 friend class Surface;
Fady Samuel 2016/11/16 15:02:00 Remove this friend.
Alex Z. 2016/11/16 19:56:16 Removing this friend prevents exo::Surface from ac
65
66 ~ExoCompositorFrameSink() override;
67 void UpdateNeedsBeginFrameInternal();
68 void DidRecieveCompositorFrameAck();
69
70 std::map<int,
71 std::pair<scoped_refptr<ExoCompositorFrameSink>,
72 std::unique_ptr<cc::SingleReleaseCallback>>>
73 release_callbacks_;
Fady Samuel 2016/11/16 15:02:00 I really don't understand the purpose of this.
reveman 2016/11/16 17:43:30 jbauman can the explain the details of this map be
74 const cc::FrameSinkId frame_sink_id_;
75 cc::LocalFrameId local_frame_id_;
76 cc::SurfaceIdAllocator id_allocator_;
77
78 cc::SurfaceManager* surface_manager_;
79 cc::SurfaceFactory surface_factory_;
80
81 int ack_pending_count_ = 0;
82
83 cc::BeginFrameSource* begin_frame_source_ = nullptr;
84
85 gfx::Size last_submitted_frame_size_;
86
87 cc::BeginFrameArgs last_begin_frame_args_;
88
89 bool needs_begin_frame_ = false;
90 bool added_frame_observer_ = false;
91 };
Fady Samuel 2016/11/16 15:02:00 DISALLOW_COPY_AND_ASSIGN(ExoCompositorFrameSink);
Alex Z. 2016/11/16 19:56:16 Done.
92
93 } // namespace exo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698