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

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

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.h ('k') | cc/surfaces/surface_aggregator.h » ('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 #include "cc/surfaces/surface.h" 5 #include "cc/surfaces/surface.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 23 matching lines...) Expand all
34 ReturnedResourceArray current_resources; 34 ReturnedResourceArray current_resources;
35 TransferableResource::ReturnResources( 35 TransferableResource::ReturnResources(
36 current_frame_->delegated_frame_data->resource_list, 36 current_frame_->delegated_frame_data->resource_list,
37 &current_resources); 37 &current_resources);
38 factory_->UnrefResources(current_resources); 38 factory_->UnrefResources(current_resources);
39 } 39 }
40 if (!draw_callback_.is_null()) 40 if (!draw_callback_.is_null())
41 draw_callback_.Run(SurfaceDrawStatus::DRAW_SKIPPED); 41 draw_callback_.Run(SurfaceDrawStatus::DRAW_SKIPPED);
42 } 42 }
43 43
44 void Surface::QueueFrame(scoped_ptr<CompositorFrame> frame, 44 void Surface::QueueFrame(std::unique_ptr<CompositorFrame> frame,
45 const DrawCallback& callback) { 45 const DrawCallback& callback) {
46 DCHECK(factory_); 46 DCHECK(factory_);
47 ClearCopyRequests(); 47 ClearCopyRequests();
48 48
49 if (frame) { 49 if (frame) {
50 TakeLatencyInfo(&frame->metadata.latency_info); 50 TakeLatencyInfo(&frame->metadata.latency_info);
51 } 51 }
52 52
53 scoped_ptr<CompositorFrame> previous_frame = std::move(current_frame_); 53 std::unique_ptr<CompositorFrame> previous_frame = std::move(current_frame_);
54 current_frame_ = std::move(frame); 54 current_frame_ = std::move(frame);
55 55
56 if (current_frame_) { 56 if (current_frame_) {
57 factory_->ReceiveFromChild( 57 factory_->ReceiveFromChild(
58 current_frame_->delegated_frame_data->resource_list); 58 current_frame_->delegated_frame_data->resource_list);
59 } 59 }
60 60
61 // Empty frames shouldn't be drawn and shouldn't contribute damage, so don't 61 // Empty frames shouldn't be drawn and shouldn't contribute damage, so don't
62 // increment frame index for them. 62 // increment frame index for them.
63 if (current_frame_ && 63 if (current_frame_ &&
(...skipping 24 matching lines...) Expand all
88 current_frame_->metadata.satisfies_sequences.swap(satisfies_sequences); 88 current_frame_->metadata.satisfies_sequences.swap(satisfies_sequences);
89 if (referenced_surfaces_changed || !satisfies_sequences.empty()) { 89 if (referenced_surfaces_changed || !satisfies_sequences.empty()) {
90 // Notify the manager that sequences were satisfied either if some new 90 // Notify the manager that sequences were satisfied either if some new
91 // sequences were satisfied, or if the set of referenced surfaces changed 91 // sequences were satisfied, or if the set of referenced surfaces changed
92 // to force a GC to happen. 92 // to force a GC to happen.
93 factory_->manager()->DidSatisfySequences( 93 factory_->manager()->DidSatisfySequences(
94 SurfaceIdAllocator::NamespaceForId(surface_id_), &satisfies_sequences); 94 SurfaceIdAllocator::NamespaceForId(surface_id_), &satisfies_sequences);
95 } 95 }
96 } 96 }
97 97
98 void Surface::RequestCopyOfOutput(scoped_ptr<CopyOutputRequest> copy_request) { 98 void Surface::RequestCopyOfOutput(
99 std::unique_ptr<CopyOutputRequest> copy_request) {
99 if (current_frame_ && 100 if (current_frame_ &&
100 !current_frame_->delegated_frame_data->render_pass_list.empty()) { 101 !current_frame_->delegated_frame_data->render_pass_list.empty()) {
101 std::vector<scoped_ptr<CopyOutputRequest>>& copy_requests = 102 std::vector<std::unique_ptr<CopyOutputRequest>>& copy_requests =
102 current_frame_->delegated_frame_data->render_pass_list.back() 103 current_frame_->delegated_frame_data->render_pass_list.back()
103 ->copy_requests; 104 ->copy_requests;
104 105
105 if (void* source = copy_request->source()) { 106 if (void* source = copy_request->source()) {
106 // Remove existing CopyOutputRequests made on the Surface by the same 107 // Remove existing CopyOutputRequests made on the Surface by the same
107 // source. 108 // source.
108 auto to_remove = 109 auto to_remove =
109 std::remove_if(copy_requests.begin(), copy_requests.end(), 110 std::remove_if(copy_requests.begin(), copy_requests.end(),
110 [source](const scoped_ptr<CopyOutputRequest>& x) { 111 [source](const std::unique_ptr<CopyOutputRequest>& x) {
111 return x->source() == source; 112 return x->source() == source;
112 }); 113 });
113 copy_requests.erase(to_remove, copy_requests.end()); 114 copy_requests.erase(to_remove, copy_requests.end());
114 } 115 }
115 copy_requests.push_back(std::move(copy_request)); 116 copy_requests.push_back(std::move(copy_request));
116 } else { 117 } else {
117 copy_request->SendEmptyResult(); 118 copy_request->SendEmptyResult();
118 } 119 }
119 } 120 }
120 121
121 void Surface::TakeCopyOutputRequests( 122 void Surface::TakeCopyOutputRequests(
122 std::multimap<RenderPassId, scoped_ptr<CopyOutputRequest>>* copy_requests) { 123 std::multimap<RenderPassId, std::unique_ptr<CopyOutputRequest>>*
124 copy_requests) {
123 DCHECK(copy_requests->empty()); 125 DCHECK(copy_requests->empty());
124 if (current_frame_) { 126 if (current_frame_) {
125 for (const auto& render_pass : 127 for (const auto& render_pass :
126 current_frame_->delegated_frame_data->render_pass_list) { 128 current_frame_->delegated_frame_data->render_pass_list) {
127 for (auto& request : render_pass->copy_requests) { 129 for (auto& request : render_pass->copy_requests) {
128 copy_requests->insert( 130 copy_requests->insert(
129 std::make_pair(render_pass->id, std::move(request))); 131 std::make_pair(render_pass->id, std::move(request)));
130 } 132 }
131 render_pass->copy_requests.clear(); 133 render_pass->copy_requests.clear();
132 } 134 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 if (current_frame_) { 181 if (current_frame_) {
180 for (const auto& render_pass : 182 for (const auto& render_pass :
181 current_frame_->delegated_frame_data->render_pass_list) { 183 current_frame_->delegated_frame_data->render_pass_list) {
182 for (const auto& copy_request : render_pass->copy_requests) 184 for (const auto& copy_request : render_pass->copy_requests)
183 copy_request->SendEmptyResult(); 185 copy_request->SendEmptyResult();
184 } 186 }
185 } 187 }
186 } 188 }
187 189
188 } // namespace cc 190 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/surface.h ('k') | cc/surfaces/surface_aggregator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698