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

Side by Side Diff: android_webview/browser/browser_view_renderer.cc

Issue 269893002: aw: Avoid using std::max for compile (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« 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 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 "android_webview/browser/browser_view_renderer.h" 5 #include "android_webview/browser/browser_view_renderer.h"
6 6
7 #include "android_webview/browser/browser_view_renderer_client.h" 7 #include "android_webview/browser/browser_view_renderer_client.h"
8 #include "android_webview/browser/shared_renderer_state.h" 8 #include "android_webview/browser/shared_renderer_state.h"
9 #include "android_webview/public/browser/draw_gl.h" 9 #include "android_webview/public/browser/draw_gl.h"
10 #include "base/android/jni_android.h" 10 #include "base/android/jni_android.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 SynchronousCompositorMemoryPolicy 164 SynchronousCompositorMemoryPolicy
165 BrowserViewRenderer::CalculateDesiredMemoryPolicy() { 165 BrowserViewRenderer::CalculateDesiredMemoryPolicy() {
166 SynchronousCompositorMemoryPolicy policy; 166 SynchronousCompositorMemoryPolicy policy;
167 size_t width = draw_gl_input_.global_visible_rect.width(); 167 size_t width = draw_gl_input_.global_visible_rect.width();
168 size_t height = draw_gl_input_.global_visible_rect.height(); 168 size_t height = draw_gl_input_.global_visible_rect.height();
169 policy.bytes_limit = kMemoryMultiplier * kBytesPerPixel * width * height; 169 policy.bytes_limit = kMemoryMultiplier * kBytesPerPixel * width * height;
170 // Round up to a multiple of kMemoryAllocationStep. 170 // Round up to a multiple of kMemoryAllocationStep.
171 policy.bytes_limit = 171 policy.bytes_limit =
172 (policy.bytes_limit / kMemoryAllocationStep + 1) * kMemoryAllocationStep; 172 (policy.bytes_limit / kMemoryAllocationStep + 1) * kMemoryAllocationStep;
173 173
174 size_t tiles = std::max(width * height * kTileMultiplier / g_tile_area, 1u); 174 size_t tiles = width * height * kTileMultiplier / g_tile_area;
175 // Round up to a multiple of kTileAllocationStep. The minimum number of tiles 175 // Round up to a multiple of kTileAllocationStep. The minimum number of tiles
176 // is also kTileAllocationStep. 176 // is also kTileAllocationStep.
177 tiles = (tiles + kTileAllocationStep - 1) / kTileAllocationStep * 177 tiles = (tiles / kTileAllocationStep + 1) * kTileAllocationStep;
178 kTileAllocationStep;
179 policy.num_resources_limit = tiles; 178 policy.num_resources_limit = tiles;
180 return policy; 179 return policy;
181 } 180 }
182 181
183 // This function updates the cached memory policy in shared renderer state, as 182 // This function updates the cached memory policy in shared renderer state, as
184 // well as the tile resource allocation in GlobalTileManager. 183 // well as the tile resource allocation in GlobalTileManager.
185 void BrowserViewRenderer::RequestMemoryPolicy( 184 void BrowserViewRenderer::RequestMemoryPolicy(
186 SynchronousCompositorMemoryPolicy& new_policy) { 185 SynchronousCompositorMemoryPolicy& new_policy) {
187 // This will be used in SetNumTiles. 186 // This will be used in SetNumTiles.
188 num_bytes_ = new_policy.bytes_limit; 187 num_bytes_ = new_policy.bytes_limit;
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 base::StringAppendF(&str, 746 base::StringAppendF(&str,
748 "surface width height: [%d %d] ", 747 "surface width height: [%d %d] ",
749 draw_info->width, 748 draw_info->width,
750 draw_info->height); 749 draw_info->height);
751 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer); 750 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer);
752 } 751 }
753 return str; 752 return str;
754 } 753 }
755 754
756 } // namespace android_webview 755 } // namespace android_webview
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