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

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

Issue 2475773005: Add SurfaceFactory::Reset (Closed)
Patch Set: Add comment per review comment Created 4 years, 1 month 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_resource_holder.h ('k') | no next file » | 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_resource_holder.h" 5 #include "cc/surfaces/surface_resource_holder.h"
6 6
7 #include "cc/surfaces/surface_factory_client.h" 7 #include "cc/surfaces/surface_factory_client.h"
8 8
9 namespace cc { 9 namespace cc {
10 10
11 SurfaceResourceHolder::SurfaceResourceHolder(SurfaceFactoryClient* client) 11 SurfaceResourceHolder::SurfaceResourceHolder(SurfaceFactoryClient* client)
12 : client_(client) { 12 : client_(client) {
13 } 13 }
14 14
15 SurfaceResourceHolder::~SurfaceResourceHolder() { 15 SurfaceResourceHolder::~SurfaceResourceHolder() {
16 } 16 }
17 17
18 SurfaceResourceHolder::ResourceRefs::ResourceRefs() 18 SurfaceResourceHolder::ResourceRefs::ResourceRefs()
19 : refs_received_from_child(0), refs_holding_resource_alive(0) { 19 : refs_received_from_child(0), refs_holding_resource_alive(0) {
20 } 20 }
21 21
22 void SurfaceResourceHolder::Reset() {
23 resource_id_info_map_.clear();
24 }
25
22 void SurfaceResourceHolder::ReceiveFromChild( 26 void SurfaceResourceHolder::ReceiveFromChild(
23 const TransferableResourceArray& resources) { 27 const TransferableResourceArray& resources) {
24 for (TransferableResourceArray::const_iterator it = resources.begin(); 28 for (TransferableResourceArray::const_iterator it = resources.begin();
25 it != resources.end(); 29 it != resources.end();
26 ++it) { 30 ++it) {
27 ResourceRefs& ref = resource_id_info_map_[it->id]; 31 ResourceRefs& ref = resource_id_info_map_[it->id];
28 ref.refs_holding_resource_alive++; 32 ref.refs_holding_resource_alive++;
29 ref.refs_received_from_child++; 33 ref.refs_received_from_child++;
30 } 34 }
31 } 35 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 returned.count = ref.refs_received_from_child; 68 returned.count = ref.refs_received_from_child;
65 resources_available_to_return.push_back(returned); 69 resources_available_to_return.push_back(returned);
66 resource_id_info_map_.erase(count_it); 70 resource_id_info_map_.erase(count_it);
67 } 71 }
68 } 72 }
69 73
70 client_->ReturnResources(resources_available_to_return); 74 client_->ReturnResources(resources_available_to_return);
71 } 75 }
72 76
73 } // namespace cc 77 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/surface_resource_holder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698