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

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

Issue 2825853002: Improvements to uses of base::SmallMap (Closed)
Patch Set: 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>
(...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1151 // If we return DRAW_SUCCESS, then we expect DrawLayers() to be called before 1151 // If we return DRAW_SUCCESS, then we expect DrawLayers() to be called before
1152 // this function is called again. 1152 // this function is called again.
1153 return draw_result; 1153 return draw_result;
1154 } 1154 }
1155 1155
1156 void LayerTreeHostImpl::RemoveRenderPasses(FrameData* frame) { 1156 void LayerTreeHostImpl::RemoveRenderPasses(FrameData* frame) {
1157 // There is always at least a root RenderPass. 1157 // There is always at least a root RenderPass.
1158 DCHECK_GE(frame->render_passes.size(), 1u); 1158 DCHECK_GE(frame->render_passes.size(), 1u);
1159 1159
1160 // A set of RenderPasses that we have seen. 1160 // A set of RenderPasses that we have seen.
1161 std::set<int> pass_exists; 1161 std::set<int> pass_exists;
brettw 2017/04/19 16:29:48 We discussed in chat also changing this to a flat_
1162 // A set of RenderPassDrawQuads that we have seen (stored by the RenderPasses 1162 // A set of RenderPassDrawQuads that we have seen (stored by the RenderPasses
1163 // they refer to). 1163 // they refer to).
1164 base::SmallMap<std::unordered_map<int, int>> pass_references; 1164 base::small_map<std::unordered_map<int, int>> pass_references;
danakj 2017/04/18 21:35:50 This should be a flat_map
1165 1165
1166 // Iterate RenderPasses in draw order, removing empty render passes (except 1166 // Iterate RenderPasses in draw order, removing empty render passes (except
1167 // the root RenderPass). 1167 // the root RenderPass).
1168 for (size_t i = 0; i < frame->render_passes.size(); ++i) { 1168 for (size_t i = 0; i < frame->render_passes.size(); ++i) {
1169 RenderPass* pass = frame->render_passes[i].get(); 1169 RenderPass* pass = frame->render_passes[i].get();
1170 1170
1171 // Remove orphan RenderPassDrawQuads. 1171 // Remove orphan RenderPassDrawQuads.
1172 for (auto it = pass->quad_list.begin(); it != pass->quad_list.end();) { 1172 for (auto it = pass->quad_list.begin(); it != pass->quad_list.end();) {
1173 if (it->material != DrawQuad::RENDER_PASS) { 1173 if (it->material != DrawQuad::RENDER_PASS) {
1174 ++it; 1174 ++it;
(...skipping 3123 matching lines...) Expand 10 before | Expand all | Expand 10 after
4298 } 4298 }
4299 4299
4300 void LayerTreeHostImpl::UpdateScrollSourceInfo(bool is_wheel_scroll) { 4300 void LayerTreeHostImpl::UpdateScrollSourceInfo(bool is_wheel_scroll) {
4301 if (is_wheel_scroll) 4301 if (is_wheel_scroll)
4302 has_scrolled_by_wheel_ = true; 4302 has_scrolled_by_wheel_ = true;
4303 else 4303 else
4304 has_scrolled_by_touch_ = true; 4304 has_scrolled_by_touch_ = true;
4305 } 4305 }
4306 4306
4307 } // namespace cc 4307 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698