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

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

Issue 175543002: CC: Fix overlow in multiply. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mimimal patch for cherry-pick. Created 6 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 return; 1167 return;
1168 1168
1169 // TODO(reveman): We should avoid keeping around unused resources if 1169 // TODO(reveman): We should avoid keeping around unused resources if
1170 // possible. crbug.com/224475 1170 // possible. crbug.com/224475
1171 global_tile_state_.hard_memory_limit_in_bytes = 0; 1171 global_tile_state_.hard_memory_limit_in_bytes = 0;
1172 global_tile_state_.soft_memory_limit_in_bytes = 0; 1172 global_tile_state_.soft_memory_limit_in_bytes = 0;
1173 if (visible_ && policy.bytes_limit_when_visible > 0) { 1173 if (visible_ && policy.bytes_limit_when_visible > 0) {
1174 global_tile_state_.hard_memory_limit_in_bytes = 1174 global_tile_state_.hard_memory_limit_in_bytes =
1175 policy.bytes_limit_when_visible; 1175 policy.bytes_limit_when_visible;
1176 global_tile_state_.soft_memory_limit_in_bytes = 1176 global_tile_state_.soft_memory_limit_in_bytes =
1177 global_tile_state_.hard_memory_limit_in_bytes * 1177 (static_cast<int64>(global_tile_state_.hard_memory_limit_in_bytes) *
1178 settings_.max_memory_for_prepaint_percentage / 100; 1178 settings_.max_memory_for_prepaint_percentage) /
1179 100;
1179 } 1180 }
1180 // Unused limit is calculated from soft-limit, as hard-limit may 1181 // Unused limit is calculated from soft-limit, as hard-limit may
1181 // be very high and shouldn't typically be exceeded. 1182 // be very high and shouldn't typically be exceeded.
1182 global_tile_state_.unused_memory_limit_in_bytes = static_cast<size_t>( 1183 global_tile_state_.unused_memory_limit_in_bytes = static_cast<size_t>(
1183 (static_cast<int64>(global_tile_state_.soft_memory_limit_in_bytes) * 1184 (static_cast<int64>(global_tile_state_.soft_memory_limit_in_bytes) *
1184 settings_.max_unused_resource_memory_percentage) / 1185 settings_.max_unused_resource_memory_percentage) /
1185 100); 1186 100);
1186 global_tile_state_.memory_limit_policy = 1187 global_tile_state_.memory_limit_policy =
1187 ManagedMemoryPolicy::PriorityCutoffToTileMemoryLimitPolicy( 1188 ManagedMemoryPolicy::PriorityCutoffToTileMemoryLimitPolicy(
1188 visible_ ? 1189 visible_ ?
(...skipping 1810 matching lines...) Expand 10 before | Expand all | Expand 10 after
2999 swap_promise_monitor_.erase(monitor); 3000 swap_promise_monitor_.erase(monitor);
3000 } 3001 }
3001 3002
3002 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { 3003 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() {
3003 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); 3004 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin();
3004 for (; it != swap_promise_monitor_.end(); it++) 3005 for (; it != swap_promise_monitor_.end(); it++)
3005 (*it)->OnSetNeedsRedrawOnImpl(); 3006 (*it)->OnSetNeedsRedrawOnImpl();
3006 } 3007 }
3007 3008
3008 } // namespace cc 3009 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698