| OLD | NEW |
| 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 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 base::flat_set<int> pass_exists; |
| 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::flat_map<int, int> pass_references; |
| 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 Loading... |
| 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 |
| OLD | NEW |