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

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

Issue 1587283002: Switch cc to std::unordered_*. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@unordered-map
Patch Set: Fix MSVC build issue 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
« no previous file with comments | « cc/surfaces/surface_aggregator.h ('k') | cc/surfaces/surface_factory.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_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
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/containers/hash_tables.h"
13 #include "base/logging.h" 12 #include "base/logging.h"
14 #include "base/macros.h" 13 #include "base/macros.h"
15 #include "base/stl_util.h" 14 #include "base/stl_util.h"
16 #include "base/trace_event/trace_event.h" 15 #include "base/trace_event/trace_event.h"
17 #include "cc/base/math_util.h" 16 #include "cc/base/math_util.h"
18 #include "cc/output/compositor_frame.h" 17 #include "cc/output/compositor_frame.h"
19 #include "cc/output/delegated_frame_data.h" 18 #include "cc/output/delegated_frame_data.h"
20 #include "cc/quads/draw_quad.h" 19 #include "cc/quads/draw_quad.h"
21 #include "cc/quads/render_pass_draw_quad.h" 20 #include "cc/quads/render_pass_draw_quad.h"
22 #include "cc/quads/shared_quad_state.h" 21 #include "cc/quads/shared_quad_state.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 return; 99 return;
101 id_to_index_map_[id] = (*next_index_)++; 100 id_to_index_map_[id] = (*next_index_)++;
102 } 101 }
103 102
104 RenderPassId Remap(RenderPassId id) { 103 RenderPassId Remap(RenderPassId id) {
105 DCHECK(id_to_index_map_.find(id) != id_to_index_map_.end()); 104 DCHECK(id_to_index_map_.find(id) != id_to_index_map_.end());
106 return RenderPassId(1, id_to_index_map_[id]); 105 return RenderPassId(1, id_to_index_map_[id]);
107 } 106 }
108 107
109 private: 108 private:
110 base::hash_map<RenderPassId, int> id_to_index_map_; 109 std::unordered_map<RenderPassId, int, RenderPassIdHash> id_to_index_map_;
111 int* next_index_; 110 int* next_index_;
112 111
113 DISALLOW_COPY_AND_ASSIGN(RenderPassIdAllocator); 112 DISALLOW_COPY_AND_ASSIGN(RenderPassIdAllocator);
114 }; 113 };
115 114
116 static void UnrefHelper(base::WeakPtr<SurfaceFactory> surface_factory, 115 static void UnrefHelper(base::WeakPtr<SurfaceFactory> surface_factory,
117 const ReturnedResourceArray& resources, 116 const ReturnedResourceArray& resources,
118 BlockingTaskRunner* main_thread_task_runner) { 117 BlockingTaskRunner* main_thread_task_runner) {
119 if (surface_factory) 118 if (surface_factory)
120 surface_factory->UnrefResources(resources); 119 surface_factory->UnrefResources(resources);
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 705
707 void SurfaceAggregator::SetFullDamageForSurface(SurfaceId surface_id) { 706 void SurfaceAggregator::SetFullDamageForSurface(SurfaceId surface_id) {
708 auto it = previous_contained_surfaces_.find(surface_id); 707 auto it = previous_contained_surfaces_.find(surface_id);
709 if (it == previous_contained_surfaces_.end()) 708 if (it == previous_contained_surfaces_.end())
710 return; 709 return;
711 // Set the last drawn index as 0 to ensure full damage next time it's drawn. 710 // Set the last drawn index as 0 to ensure full damage next time it's drawn.
712 it->second = 0; 711 it->second = 0;
713 } 712 }
714 713
715 } // namespace cc 714 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/surface_aggregator.h ('k') | cc/surfaces/surface_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698