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

Side by Side Diff: cc/trees/layer_tree_host_impl.cc

Issue 2825853002: Improvements to uses of base::SmallMap (Closed)
Patch Set: Review comments Created 3 years, 8 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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/trees/layer_tree_host_impl.h" 5 #include "cc/trees/layer_tree_host_impl.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 #include <limits> 11 #include <limits>
12 #include <map> 12 #include <map>
13 #include <set> 13 #include <set>
14 #include <unordered_map> 14 #include <unordered_map>
15 #include <utility> 15 #include <utility>
16 16
17 #include "base/auto_reset.h" 17 #include "base/auto_reset.h"
18 #include "base/bind.h" 18 #include "base/bind.h"
19 #include "base/containers/small_map.h" 19 #include "base/containers/flat_map.h"
20 #include "base/json/json_writer.h" 20 #include "base/json/json_writer.h"
21 #include "base/memory/ptr_util.h" 21 #include "base/memory/ptr_util.h"
22 #include "base/metrics/histogram.h" 22 #include "base/metrics/histogram.h"
23 #include "base/numerics/safe_conversions.h" 23 #include "base/numerics/safe_conversions.h"
24 #include "base/stl_util.h" 24 #include "base/stl_util.h"
25 #include "base/strings/stringprintf.h" 25 #include "base/strings/stringprintf.h"
26 #include "base/trace_event/trace_event_argument.h" 26 #include "base/trace_event/trace_event_argument.h"
27 #include "cc/base/devtools_instrumentation.h" 27 #include "cc/base/devtools_instrumentation.h"
28 #include "cc/base/histograms.h" 28 #include "cc/base/histograms.h"
29 #include "cc/base/math_util.h" 29 #include "cc/base/math_util.h"
(...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1132 // If we return DRAW_SUCCESS, then we expect DrawLayers() to be called before 1132 // If we return DRAW_SUCCESS, then we expect DrawLayers() to be called before
1133 // this function is called again. 1133 // this function is called again.
1134 return draw_result; 1134 return draw_result;
1135 } 1135 }
1136 1136
1137 void LayerTreeHostImpl::RemoveRenderPasses(FrameData* frame) { 1137 void LayerTreeHostImpl::RemoveRenderPasses(FrameData* frame) {
1138 // There is always at least a root RenderPass. 1138 // There is always at least a root RenderPass.
1139 DCHECK_GE(frame->render_passes.size(), 1u); 1139 DCHECK_GE(frame->render_passes.size(), 1u);
1140 1140
1141 // A set of RenderPasses that we have seen. 1141 // A set of RenderPasses that we have seen.
1142 std::set<int> pass_exists; 1142 base::flat_set<int> pass_exists;
1143 // A set of RenderPassDrawQuads that we have seen (stored by the RenderPasses 1143 // A set of RenderPassDrawQuads that we have seen (stored by the RenderPasses
1144 // they refer to). 1144 // they refer to).
1145 base::SmallMap<std::unordered_map<int, int>> pass_references; 1145 base::flat_map<int, int> pass_references;
1146 1146
1147 // Iterate RenderPasses in draw order, removing empty render passes (except 1147 // Iterate RenderPasses in draw order, removing empty render passes (except
1148 // the root RenderPass). 1148 // the root RenderPass).
1149 for (size_t i = 0; i < frame->render_passes.size(); ++i) { 1149 for (size_t i = 0; i < frame->render_passes.size(); ++i) {
1150 RenderPass* pass = frame->render_passes[i].get(); 1150 RenderPass* pass = frame->render_passes[i].get();
1151 1151
1152 // Remove orphan RenderPassDrawQuads. 1152 // Remove orphan RenderPassDrawQuads.
1153 for (auto it = pass->quad_list.begin(); it != pass->quad_list.end();) { 1153 for (auto it = pass->quad_list.begin(); it != pass->quad_list.end();) {
1154 if (it->material != DrawQuad::RENDER_PASS) { 1154 if (it->material != DrawQuad::RENDER_PASS) {
1155 ++it; 1155 ++it;
(...skipping 3122 matching lines...) Expand 10 before | Expand all | Expand 10 after
4278 } 4278 }
4279 4279
4280 void LayerTreeHostImpl::UpdateScrollSourceInfo(bool is_wheel_scroll) { 4280 void LayerTreeHostImpl::UpdateScrollSourceInfo(bool is_wheel_scroll) {
4281 if (is_wheel_scroll) 4281 if (is_wheel_scroll)
4282 has_scrolled_by_wheel_ = true; 4282 has_scrolled_by_wheel_ = true;
4283 else 4283 else
4284 has_scrolled_by_touch_ = true; 4284 has_scrolled_by_touch_ = true;
4285 } 4285 }
4286 4286
4287 } // namespace cc 4287 } // namespace cc
OLDNEW
« no previous file with comments | « cc/tiles/picture_layer_tiling.cc ('k') | chrome/browser/media/router/presentation_service_delegate_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698