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

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

Issue 2493223002: Change exo::SurfaceFactoryOwner to exo::ExoCompositorFrameSink (Closed)
Patch Set: Added ExoCompositorFrameSink::SubmitCompositorFrame(). 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.
reveman 2016/11/16 03:48:38 Why does this need to be in a new file when it's o
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>,
reveman 2016/11/16 03:48:38 Exo is typically not used as a prefix inside the e
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:
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:
56 void OnBeginFrame(const cc::BeginFrameArgs& args) override;
57 const cc::BeginFrameArgs& LastUsedBeginFrameArgs() const override;
58 void OnBeginFrameSourcePausedChanged(bool paused) override;
59
60 const cc::FrameSinkId& frame_sink_id() { return frame_sink_id_; }
Fady Samuel 2016/11/15 23:19:46 nit: do you need this?
Alex Z. 2016/11/16 14:55:46 Done.
61 cc::SurfaceManager* surface_manager() { return surface_manager_; }
Fady Samuel 2016/11/15 23:19:46 nit: do you need this?
Alex Z. 2016/11/16 14:55:46 Yes. In CommitSurfaceHierarchy(), the SurfaceManag
62
63 private:
64 friend class base::RefCounted<ExoCompositorFrameSink>;
65 friend class Surface;
66
67 ~ExoCompositorFrameSink() override;
68 void UpdateNeedsBeginFrameInternal();
69 void DidRecieveCompositorFrameAck();
70
71 std::map<int,
72 std::pair<scoped_refptr<ExoCompositorFrameSink>,
73 std::unique_ptr<cc::SingleReleaseCallback>>>
74 release_callbacks_;
Fady Samuel 2016/11/15 23:19:46 What is this for?
Alex Z. 2016/11/16 14:55:46 I don't fully understand this part, but it seems t
75 cc::FrameSinkId frame_sink_id_;
Fady Samuel 2016/11/15 23:19:46 Mark as const.
Alex Z. 2016/11/23 14:25:03 Done.
76 cc::LocalFrameId local_frame_id_;
77 cc::SurfaceIdAllocator id_allocator_;
78
79 cc::SurfaceManager* surface_manager_;
80 cc::SurfaceFactory surface_factory_;
81
82 int ack_pending_count_ = 0;
83
84 cc::BeginFrameSource* begin_frame_source_ = nullptr;
85
86 gfx::Size last_submitted_frame_size_;
87
88 cc::BeginFrameArgs last_begin_frame_args_;
89
90 bool needs_begin_frame_ = false;
91 bool added_frame_observer_ = false;
92 };
93
94 } // namespace exo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698