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

Side by Side Diff: cc/surfaces/surface.h

Issue 1535833002: Delete CC. (Closed) Base URL: git@github.com:domokit/mojo.git@moz-5
Patch Set: rebase Created 4 years, 11 months 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
« no previous file with comments | « cc/surfaces/onscreen_display_client.cc ('k') | cc/surfaces/surface.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 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 CC_SURFACES_SURFACE_H_
6 #define CC_SURFACES_SURFACE_H_
7
8 #include <map>
9 #include <vector>
10
11 #include "base/callback.h"
12 #include "base/containers/hash_tables.h"
13 #include "base/macros.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/weak_ptr.h"
16 #include "cc/base/scoped_ptr_vector.h"
17 #include "cc/output/copy_output_request.h"
18 #include "cc/quads/render_pass_id.h"
19 #include "cc/surfaces/surface_factory.h"
20 #include "cc/surfaces/surface_id.h"
21 #include "cc/surfaces/surface_sequence.h"
22 #include "cc/surfaces/surfaces_export.h"
23 #include "ui/gfx/geometry/size.h"
24
25 namespace ui {
26 struct LatencyInfo;
27 }
28
29 namespace cc {
30 class CompositorFrame;
31 class CopyOutputRequest;
32 class SurfaceManager;
33 class SurfaceFactory;
34 class SurfaceResourceHolder;
35
36 class CC_SURFACES_EXPORT Surface {
37 public:
38 using DrawCallback = SurfaceFactory::DrawCallback;
39
40 Surface(SurfaceId id, SurfaceFactory* factory);
41 ~Surface();
42
43 SurfaceId surface_id() const { return surface_id_; }
44
45 void QueueFrame(scoped_ptr<CompositorFrame> frame,
46 const DrawCallback& draw_callback);
47 void RequestCopyOfOutput(scoped_ptr<CopyOutputRequest> copy_request);
48 // Adds each CopyOutputRequest in the current frame to copy_requests. The
49 // caller takes ownership of them.
50 void TakeCopyOutputRequests(
51 std::multimap<RenderPassId, CopyOutputRequest*>* copy_requests);
52 // Returns the most recent frame that is eligible to be rendered.
53 const CompositorFrame* GetEligibleFrame();
54
55 // Returns a number that increments by 1 every time a new frame is enqueued.
56 int frame_index() const { return frame_index_; }
57
58 void TakeLatencyInfo(std::vector<ui::LatencyInfo>* latency_info);
59 void RunDrawCallbacks(SurfaceDrawStatus drawn);
60
61 base::WeakPtr<SurfaceFactory> factory() { return factory_; }
62
63 // Add a SurfaceSequence that must be satisfied before the Surface is
64 // destroyed.
65 void AddDestructionDependency(SurfaceSequence sequence);
66
67 // Satisfy all destruction dependencies that are contained in sequences, and
68 // remove them from sequences.
69 void SatisfyDestructionDependencies(
70 base::hash_set<SurfaceSequence>* sequences);
71 size_t GetDestructionDependencyCount() const {
72 return destruction_dependencies_.size();
73 }
74
75 private:
76 void ClearCopyRequests();
77
78 SurfaceId surface_id_;
79 base::WeakPtr<SurfaceFactory> factory_;
80 // TODO(jamesr): Support multiple frames in flight.
81 scoped_ptr<CompositorFrame> current_frame_;
82 int frame_index_;
83 std::vector<SurfaceSequence> destruction_dependencies_;
84
85 DrawCallback draw_callback_;
86
87 DISALLOW_COPY_AND_ASSIGN(Surface);
88 };
89
90 } // namespace cc
91
92 #endif // CC_SURFACES_SURFACE_H_
OLDNEW
« no previous file with comments | « cc/surfaces/onscreen_display_client.cc ('k') | cc/surfaces/surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698