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

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

Issue 885443002: Roll Chrome into Mojo. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebase to ToT mojo Created 5 years, 10 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/display.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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CC_SURFACES_SURFACE_H_ 5 #ifndef CC_SURFACES_SURFACE_H_
6 #define CC_SURFACES_SURFACE_H_ 6 #define CC_SURFACES_SURFACE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/containers/hash_tables.h" 12 #include "base/containers/hash_tables.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "cc/base/scoped_ptr_vector.h" 16 #include "cc/base/scoped_ptr_vector.h"
17 #include "cc/output/copy_output_request.h" 17 #include "cc/output/copy_output_request.h"
18 #include "cc/quads/render_pass_id.h" 18 #include "cc/quads/render_pass_id.h"
19 #include "cc/surfaces/surface_factory.h"
19 #include "cc/surfaces/surface_id.h" 20 #include "cc/surfaces/surface_id.h"
20 #include "cc/surfaces/surface_sequence.h" 21 #include "cc/surfaces/surface_sequence.h"
21 #include "cc/surfaces/surfaces_export.h" 22 #include "cc/surfaces/surfaces_export.h"
22 #include "ui/gfx/geometry/size.h" 23 #include "ui/gfx/geometry/size.h"
23 24
24 namespace ui { 25 namespace ui {
25 struct LatencyInfo; 26 struct LatencyInfo;
26 } 27 }
27 28
28 namespace cc { 29 namespace cc {
29 class CompositorFrame; 30 class CompositorFrame;
30 class CopyOutputRequest; 31 class CopyOutputRequest;
31 class SurfaceManager; 32 class SurfaceManager;
32 class SurfaceFactory; 33 class SurfaceFactory;
33 class SurfaceResourceHolder; 34 class SurfaceResourceHolder;
34 35
35 class CC_SURFACES_EXPORT Surface { 36 class CC_SURFACES_EXPORT Surface {
36 public: 37 public:
37 using DrawCallback = base::Callback<void(bool)>; 38 using DrawCallback = SurfaceFactory::DrawCallback;
38 39
39 Surface(SurfaceId id, SurfaceFactory* factory); 40 Surface(SurfaceId id, SurfaceFactory* factory);
40 ~Surface(); 41 ~Surface();
41 42
42 SurfaceId surface_id() const { return surface_id_; } 43 SurfaceId surface_id() const { return surface_id_; }
43 44
44 void QueueFrame(scoped_ptr<CompositorFrame> frame, 45 void QueueFrame(scoped_ptr<CompositorFrame> frame,
45 const DrawCallback& draw_callback); 46 const DrawCallback& draw_callback);
46 void RequestCopyOfOutput(scoped_ptr<CopyOutputRequest> copy_request); 47 void RequestCopyOfOutput(scoped_ptr<CopyOutputRequest> copy_request);
47 // Adds each CopyOutputRequest in the current frame to copy_requests. The 48 // Adds each CopyOutputRequest in the current frame to copy_requests. The
48 // caller takes ownership of them. 49 // caller takes ownership of them.
49 void TakeCopyOutputRequests( 50 void TakeCopyOutputRequests(
50 std::multimap<RenderPassId, CopyOutputRequest*>* copy_requests); 51 std::multimap<RenderPassId, CopyOutputRequest*>* copy_requests);
51 // Returns the most recent frame that is eligible to be rendered. 52 // Returns the most recent frame that is eligible to be rendered.
52 const CompositorFrame* GetEligibleFrame(); 53 const CompositorFrame* GetEligibleFrame();
53 54
54 // Returns a number that increments by 1 every time a new frame is enqueued. 55 // Returns a number that increments by 1 every time a new frame is enqueued.
55 int frame_index() const { return frame_index_; } 56 int frame_index() const { return frame_index_; }
56 57
57 void TakeLatencyInfo(std::vector<ui::LatencyInfo>* latency_info); 58 void TakeLatencyInfo(std::vector<ui::LatencyInfo>* latency_info);
58 void RunDrawCallbacks(); 59 void RunDrawCallbacks(SurfaceDrawStatus drawn);
59 60
60 base::WeakPtr<SurfaceFactory> factory() { return factory_; } 61 base::WeakPtr<SurfaceFactory> factory() { return factory_; }
61 62
62 // Add a SurfaceSequence that must be satisfied before the Surface is 63 // Add a SurfaceSequence that must be satisfied before the Surface is
63 // destroyed. 64 // destroyed.
64 void AddDestructionDependency(SurfaceSequence sequence); 65 void AddDestructionDependency(SurfaceSequence sequence);
65 66
66 // Satisfy all destruction dependencies that are contained in sequences, and 67 // Satisfy all destruction dependencies that are contained in sequences, and
67 // remove them from sequences. 68 // remove them from sequences.
68 void SatisfyDestructionDependencies( 69 void SatisfyDestructionDependencies(
(...skipping 13 matching lines...) Expand all
82 std::vector<SurfaceSequence> destruction_dependencies_; 83 std::vector<SurfaceSequence> destruction_dependencies_;
83 84
84 DrawCallback draw_callback_; 85 DrawCallback draw_callback_;
85 86
86 DISALLOW_COPY_AND_ASSIGN(Surface); 87 DISALLOW_COPY_AND_ASSIGN(Surface);
87 }; 88 };
88 89
89 } // namespace cc 90 } // namespace cc
90 91
91 #endif // CC_SURFACES_SURFACE_H_ 92 #endif // CC_SURFACES_SURFACE_H_
OLDNEW
« no previous file with comments | « cc/surfaces/display.cc ('k') | cc/surfaces/surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698