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

Side by Side Diff: cc/surfaces/surface_factory.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/surface_display_output_surface_unittest.cc ('k') | cc/surfaces/surface_factory.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_FACTORY_H_ 5 #ifndef CC_SURFACES_SURFACE_FACTORY_H_
6 #define CC_SURFACES_SURFACE_FACTORY_H_ 6 #define CC_SURFACES_SURFACE_FACTORY_H_
7 7
8 #include <memory>
8 #include <set> 9 #include <set>
9 #include <unordered_map> 10 #include <unordered_map>
10 11
11 #include "base/callback_forward.h" 12 #include "base/callback_forward.h"
12 #include "base/macros.h" 13 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "base/observer_list.h" 15 #include "base/observer_list.h"
16 #include "cc/output/compositor_frame.h" 16 #include "cc/output/compositor_frame.h"
17 #include "cc/surfaces/surface_id.h" 17 #include "cc/surfaces/surface_id.h"
18 #include "cc/surfaces/surface_resource_holder.h" 18 #include "cc/surfaces/surface_resource_holder.h"
19 #include "cc/surfaces/surface_sequence.h" 19 #include "cc/surfaces/surface_sequence.h"
20 #include "cc/surfaces/surfaces_export.h" 20 #include "cc/surfaces/surfaces_export.h"
21 21
22 namespace gfx { 22 namespace gfx {
23 class Size; 23 class Size;
(...skipping 23 matching lines...) Expand all
47 47
48 void Create(SurfaceId surface_id); 48 void Create(SurfaceId surface_id);
49 void Destroy(SurfaceId surface_id); 49 void Destroy(SurfaceId surface_id);
50 void DestroyAll(); 50 void DestroyAll();
51 51
52 // A frame can only be submitted to a surface created by this factory, 52 // A frame can only be submitted to a surface created by this factory,
53 // although the frame may reference surfaces created by other factories. 53 // although the frame may reference surfaces created by other factories.
54 // The callback is called the first time this frame is used to draw, or if 54 // The callback is called the first time this frame is used to draw, or if
55 // the frame is discarded. 55 // the frame is discarded.
56 void SubmitCompositorFrame(SurfaceId surface_id, 56 void SubmitCompositorFrame(SurfaceId surface_id,
57 scoped_ptr<CompositorFrame> frame, 57 std::unique_ptr<CompositorFrame> frame,
58 const DrawCallback& callback); 58 const DrawCallback& callback);
59 void RequestCopyOfSurface(SurfaceId surface_id, 59 void RequestCopyOfSurface(SurfaceId surface_id,
60 scoped_ptr<CopyOutputRequest> copy_request); 60 std::unique_ptr<CopyOutputRequest> copy_request);
61 61
62 void WillDrawSurface(SurfaceId id, const gfx::Rect& damage_rect); 62 void WillDrawSurface(SurfaceId id, const gfx::Rect& damage_rect);
63 63
64 SurfaceFactoryClient* client() { return client_; } 64 SurfaceFactoryClient* client() { return client_; }
65 65
66 void ReceiveFromChild(const TransferableResourceArray& resources); 66 void ReceiveFromChild(const TransferableResourceArray& resources);
67 void RefResources(const TransferableResourceArray& resources); 67 void RefResources(const TransferableResourceArray& resources);
68 void UnrefResources(const ReturnedResourceArray& resources); 68 void UnrefResources(const ReturnedResourceArray& resources);
69 69
70 SurfaceManager* manager() { return manager_; } 70 SurfaceManager* manager() { return manager_; }
71 71
72 // This can be set to false if resources from this SurfaceFactory don't need 72 // This can be set to false if resources from this SurfaceFactory don't need
73 // to have sync points set on them when returned from the Display, for 73 // to have sync points set on them when returned from the Display, for
74 // example if the Display shares a context with the creator. 74 // example if the Display shares a context with the creator.
75 bool needs_sync_points() const { return needs_sync_points_; } 75 bool needs_sync_points() const { return needs_sync_points_; }
76 void set_needs_sync_points(bool needs) { needs_sync_points_ = needs; } 76 void set_needs_sync_points(bool needs) { needs_sync_points_ = needs; }
77 77
78 private: 78 private:
79 SurfaceManager* manager_; 79 SurfaceManager* manager_;
80 SurfaceFactoryClient* client_; 80 SurfaceFactoryClient* client_;
81 SurfaceResourceHolder holder_; 81 SurfaceResourceHolder holder_;
82 82
83 bool needs_sync_points_; 83 bool needs_sync_points_;
84 84
85 using OwningSurfaceMap = 85 using OwningSurfaceMap =
86 std::unordered_map<SurfaceId, scoped_ptr<Surface>, SurfaceIdHash>; 86 std::unordered_map<SurfaceId, std::unique_ptr<Surface>, SurfaceIdHash>;
87 OwningSurfaceMap surface_map_; 87 OwningSurfaceMap surface_map_;
88 88
89 DISALLOW_COPY_AND_ASSIGN(SurfaceFactory); 89 DISALLOW_COPY_AND_ASSIGN(SurfaceFactory);
90 }; 90 };
91 91
92 } // namespace cc 92 } // namespace cc
93 93
94 #endif // CC_SURFACES_SURFACE_FACTORY_H_ 94 #endif // CC_SURFACES_SURFACE_FACTORY_H_
OLDNEW
« no previous file with comments | « cc/surfaces/surface_display_output_surface_unittest.cc ('k') | cc/surfaces/surface_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698