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

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

Issue 2150633002: cc: Pass SurfaceId by const ref in more places (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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>
11 11
12 #include "cc/base/container_util.h" 12 #include "cc/base/container_util.h"
13 #include "cc/output/compositor_frame.h" 13 #include "cc/output/compositor_frame.h"
14 #include "cc/output/copy_output_request.h" 14 #include "cc/output/copy_output_request.h"
15 #include "cc/surfaces/surface_factory.h" 15 #include "cc/surfaces/surface_factory.h"
16 #include "cc/surfaces/surface_id_allocator.h" 16 #include "cc/surfaces/surface_id_allocator.h"
17 #include "cc/surfaces/surface_manager.h" 17 #include "cc/surfaces/surface_manager.h"
18 18
19 namespace cc { 19 namespace cc {
20 20
21 // The frame index starts at 2 so that empty frames will be treated as 21 // The frame index starts at 2 so that empty frames will be treated as
22 // completely damaged the first time they're drawn from. 22 // completely damaged the first time they're drawn from.
23 static const int kFrameIndexStart = 2; 23 static const int kFrameIndexStart = 2;
24 24
25 Surface::Surface(SurfaceId id, SurfaceFactory* factory) 25 Surface::Surface(const SurfaceId& id, SurfaceFactory* factory)
26 : surface_id_(id), 26 : surface_id_(id),
27 previous_frame_surface_id_(id), 27 previous_frame_surface_id_(id),
28 factory_(factory->AsWeakPtr()), 28 factory_(factory->AsWeakPtr()),
29 frame_index_(kFrameIndexStart), 29 frame_index_(kFrameIndexStart),
30 destroyed_(false) {} 30 destroyed_(false) {}
31 31
32 Surface::~Surface() { 32 Surface::~Surface() {
33 ClearCopyRequests(); 33 ClearCopyRequests();
34 if (current_frame_.delegated_frame_data && factory_) { 34 if (current_frame_.delegated_frame_data && factory_) {
35 UnrefFrameResources(current_frame_.delegated_frame_data.get()); 35 UnrefFrameResources(current_frame_.delegated_frame_data.get());
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 if (current_frame_.delegated_frame_data) { 189 if (current_frame_.delegated_frame_data) {
190 for (const auto& render_pass : 190 for (const auto& render_pass :
191 current_frame_.delegated_frame_data->render_pass_list) { 191 current_frame_.delegated_frame_data->render_pass_list) {
192 for (const auto& copy_request : render_pass->copy_requests) 192 for (const auto& copy_request : render_pass->copy_requests)
193 copy_request->SendEmptyResult(); 193 copy_request->SendEmptyResult();
194 } 194 }
195 } 195 }
196 } 196 }
197 197
198 } // namespace cc 198 } // 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