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

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

Issue 569173007: Always make context current in ViewManager's BitmapUploader, be laxer in SurfaceResourceHolder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 | « no previous file | mojo/services/public/cpp/view_manager/lib/bitmap_uploader.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 #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
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 void SurfaceResourceHolder::UnrefResources( 45 void SurfaceResourceHolder::UnrefResources(
46 const ReturnedResourceArray& resources) { 46 const ReturnedResourceArray& resources) {
47 ReturnedResourceArray resources_available_to_return; 47 ReturnedResourceArray resources_available_to_return;
48 48
49 for (ReturnedResourceArray::const_iterator it = resources.begin(); 49 for (ReturnedResourceArray::const_iterator it = resources.begin();
50 it != resources.end(); 50 it != resources.end();
51 ++it) { 51 ++it) {
52 ResourceProvider::ResourceId id = it->id; 52 ResourceProvider::ResourceId id = it->id;
53 ResourceIdCountMap::iterator count_it = resource_id_use_count_map_.find(id); 53 ResourceIdCountMap::iterator count_it = resource_id_use_count_map_.find(id);
54 DCHECK(count_it != resource_id_use_count_map_.end()); 54 if (count_it == resource_id_use_count_map_.end())
55 continue;
55 ResourceRefs& ref = count_it->second; 56 ResourceRefs& ref = count_it->second;
56 ref.refs_holding_resource_alive -= it->count; 57 ref.refs_holding_resource_alive -= it->count;
57 if (ref.refs_holding_resource_alive == 0) { 58 if (ref.refs_holding_resource_alive == 0) {
58 ReturnedResource returned = *it; 59 ReturnedResource returned = *it;
59 returned.count = ref.refs_received_from_child; 60 returned.count = ref.refs_received_from_child;
60 resources_available_to_return.push_back(returned); 61 resources_available_to_return.push_back(returned);
61 resource_id_use_count_map_.erase(count_it); 62 resource_id_use_count_map_.erase(count_it);
62 } 63 }
63 } 64 }
64 65
65 client_->ReturnResources(resources_available_to_return); 66 client_->ReturnResources(resources_available_to_return);
66 } 67 }
67 68
68 } // namespace cc 69 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | mojo/services/public/cpp/view_manager/lib/bitmap_uploader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698