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

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

Issue 1866203004: Convert //cc from scoped_ptr to std::unique_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptrcc: rebase Created 4 years, 8 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
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 <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <map> 11 #include <map>
12 #include <memory>
12 #include <set> 13 #include <set>
13 #include <unordered_set> 14 #include <unordered_set>
14 #include <vector> 15 #include <vector>
15 16
16 #include "base/callback.h" 17 #include "base/callback.h"
17 #include "base/macros.h" 18 #include "base/macros.h"
18 #include "base/memory/scoped_ptr.h"
19 #include "base/memory/weak_ptr.h" 19 #include "base/memory/weak_ptr.h"
20 #include "cc/output/copy_output_request.h" 20 #include "cc/output/copy_output_request.h"
21 #include "cc/quads/render_pass_id.h" 21 #include "cc/quads/render_pass_id.h"
22 #include "cc/surfaces/surface_factory.h" 22 #include "cc/surfaces/surface_factory.h"
23 #include "cc/surfaces/surface_id.h" 23 #include "cc/surfaces/surface_id.h"
24 #include "cc/surfaces/surface_sequence.h" 24 #include "cc/surfaces/surface_sequence.h"
25 #include "cc/surfaces/surfaces_export.h" 25 #include "cc/surfaces/surfaces_export.h"
26 #include "ui/gfx/geometry/size.h" 26 #include "ui/gfx/geometry/size.h"
27 27
28 namespace ui { 28 namespace ui {
29 class LatencyInfo; 29 class LatencyInfo;
30 } 30 }
31 31
32 namespace cc { 32 namespace cc {
33 class CompositorFrame; 33 class CompositorFrame;
34 class CopyOutputRequest; 34 class CopyOutputRequest;
35 class SurfaceManager; 35 class SurfaceManager;
36 class SurfaceFactory; 36 class SurfaceFactory;
37 class SurfaceResourceHolder; 37 class SurfaceResourceHolder;
38 38
39 class CC_SURFACES_EXPORT Surface { 39 class CC_SURFACES_EXPORT Surface {
40 public: 40 public:
41 using DrawCallback = SurfaceFactory::DrawCallback; 41 using DrawCallback = SurfaceFactory::DrawCallback;
42 42
43 Surface(SurfaceId id, SurfaceFactory* factory); 43 Surface(SurfaceId id, SurfaceFactory* factory);
44 ~Surface(); 44 ~Surface();
45 45
46 SurfaceId surface_id() const { return surface_id_; } 46 SurfaceId surface_id() const { return surface_id_; }
47 47
48 void QueueFrame(scoped_ptr<CompositorFrame> frame, 48 void QueueFrame(std::unique_ptr<CompositorFrame> frame,
49 const DrawCallback& draw_callback); 49 const DrawCallback& draw_callback);
50 void RequestCopyOfOutput(scoped_ptr<CopyOutputRequest> copy_request); 50 void RequestCopyOfOutput(std::unique_ptr<CopyOutputRequest> copy_request);
51 // Adds each CopyOutputRequest in the current frame to copy_requests. The 51 // Adds each CopyOutputRequest in the current frame to copy_requests. The
52 // caller takes ownership of them. 52 // caller takes ownership of them.
53 void TakeCopyOutputRequests( 53 void TakeCopyOutputRequests(
54 std::multimap<RenderPassId, scoped_ptr<CopyOutputRequest>>* 54 std::multimap<RenderPassId, std::unique_ptr<CopyOutputRequest>>*
55 copy_requests); 55 copy_requests);
56 // Returns the most recent frame that is eligible to be rendered. 56 // Returns the most recent frame that is eligible to be rendered.
57 const CompositorFrame* GetEligibleFrame(); 57 const CompositorFrame* GetEligibleFrame();
58 58
59 // Returns a number that increments by 1 every time a new frame is enqueued. 59 // Returns a number that increments by 1 every time a new frame is enqueued.
60 int frame_index() const { return frame_index_; } 60 int frame_index() const { return frame_index_; }
61 61
62 void TakeLatencyInfo(std::vector<ui::LatencyInfo>* latency_info); 62 void TakeLatencyInfo(std::vector<ui::LatencyInfo>* latency_info);
63 void RunDrawCallbacks(SurfaceDrawStatus drawn); 63 void RunDrawCallbacks(SurfaceDrawStatus drawn);
64 64
(...skipping 18 matching lines...) Expand all
83 83
84 bool destroyed() const { return destroyed_; } 84 bool destroyed() const { return destroyed_; }
85 void set_destroyed(bool destroyed) { destroyed_ = destroyed; } 85 void set_destroyed(bool destroyed) { destroyed_ = destroyed; }
86 86
87 private: 87 private:
88 void ClearCopyRequests(); 88 void ClearCopyRequests();
89 89
90 SurfaceId surface_id_; 90 SurfaceId surface_id_;
91 base::WeakPtr<SurfaceFactory> factory_; 91 base::WeakPtr<SurfaceFactory> factory_;
92 // TODO(jamesr): Support multiple frames in flight. 92 // TODO(jamesr): Support multiple frames in flight.
93 scoped_ptr<CompositorFrame> current_frame_; 93 std::unique_ptr<CompositorFrame> current_frame_;
94 int frame_index_; 94 int frame_index_;
95 bool destroyed_; 95 bool destroyed_;
96 std::vector<SurfaceSequence> destruction_dependencies_; 96 std::vector<SurfaceSequence> destruction_dependencies_;
97 97
98 // This surface may have multiple BeginFrameSources if it is 98 // This surface may have multiple BeginFrameSources if it is
99 // on multiple Displays. 99 // on multiple Displays.
100 std::set<BeginFrameSource*> begin_frame_sources_; 100 std::set<BeginFrameSource*> begin_frame_sources_;
101 101
102 std::vector<SurfaceId> referenced_surfaces_; 102 std::vector<SurfaceId> referenced_surfaces_;
103 103
104 DrawCallback draw_callback_; 104 DrawCallback draw_callback_;
105 105
106 DISALLOW_COPY_AND_ASSIGN(Surface); 106 DISALLOW_COPY_AND_ASSIGN(Surface);
107 }; 107 };
108 108
109 } // namespace cc 109 } // namespace cc
110 110
111 #endif // CC_SURFACES_SURFACE_H_ 111 #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