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

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

Issue 1640483003: Switch SurfaceId maps from base::hash_map to std::unordered_map. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebasing Created 4 years, 10 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
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_aggregator.h" 5 #include "cc/surfaces/surface_aggregator.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <map> 9 #include <map>
10 10
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 115
116 static void UnrefHelper(base::WeakPtr<SurfaceFactory> surface_factory, 116 static void UnrefHelper(base::WeakPtr<SurfaceFactory> surface_factory,
117 const ReturnedResourceArray& resources, 117 const ReturnedResourceArray& resources,
118 BlockingTaskRunner* main_thread_task_runner) { 118 BlockingTaskRunner* main_thread_task_runner) {
119 if (surface_factory) 119 if (surface_factory)
120 surface_factory->UnrefResources(resources); 120 surface_factory->UnrefResources(resources);
121 } 121 }
122 122
123 RenderPassId SurfaceAggregator::RemapPassId(RenderPassId surface_local_pass_id, 123 RenderPassId SurfaceAggregator::RemapPassId(RenderPassId surface_local_pass_id,
124 SurfaceId surface_id) { 124 SurfaceId surface_id) {
125 RenderPassIdAllocator* allocator = render_pass_allocator_map_.get(surface_id); 125 RenderPassIdAllocator* allocator =
danakj 2016/01/26 23:53:32 You could write this code a bit shorter now I gues
lfg 2016/01/27 00:53:14 Done.
126 render_pass_allocator_map_[surface_id].get();
126 if (!allocator) { 127 if (!allocator) {
127 allocator = new RenderPassIdAllocator(&next_render_pass_id_); 128 allocator = new RenderPassIdAllocator(&next_render_pass_id_);
128 render_pass_allocator_map_.set(surface_id, make_scoped_ptr(allocator)); 129 render_pass_allocator_map_[surface_id] = make_scoped_ptr(allocator);
129 } 130 }
130 allocator->AddKnownPass(surface_local_pass_id); 131 allocator->AddKnownPass(surface_local_pass_id);
131 return allocator->Remap(surface_local_pass_id); 132 return allocator->Remap(surface_local_pass_id);
132 } 133 }
133 134
134 int SurfaceAggregator::ChildIdForSurface(Surface* surface) { 135 int SurfaceAggregator::ChildIdForSurface(Surface* surface) {
135 SurfaceToResourceChildIdMap::iterator it = 136 SurfaceToResourceChildIdMap::iterator it =
136 surface_id_to_resource_child_id_.find(surface->surface_id()); 137 surface_id_to_resource_child_id_.find(surface->surface_id());
137 if (it == surface_id_to_resource_child_id_.end()) { 138 if (it == surface_id_to_resource_child_id_.end()) {
138 int child_id = 139 int child_id =
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 708
708 void SurfaceAggregator::SetFullDamageForSurface(SurfaceId surface_id) { 709 void SurfaceAggregator::SetFullDamageForSurface(SurfaceId surface_id) {
709 auto it = previous_contained_surfaces_.find(surface_id); 710 auto it = previous_contained_surfaces_.find(surface_id);
710 if (it == previous_contained_surfaces_.end()) 711 if (it == previous_contained_surfaces_.end())
711 return; 712 return;
712 // Set the last drawn index as 0 to ensure full damage next time it's drawn. 713 // Set the last drawn index as 0 to ensure full damage next time it's drawn.
713 it->second = 0; 714 it->second = 0;
714 } 715 }
715 716
716 } // namespace cc 717 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698