summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhush <hush@chromium.org>2014-09-10 12:10:38 -0700
committerHui Shu <hush@google.com>2014-09-16 04:11:38 +0000
commit862bd7759b5ede90f02436dab473f47a24ab7e9b (patch)
tree3adb0232bcbf93857bff12e3babe36729cf27f08
parent2dd9be87cef33d6537cf9cf0bb662907ba826ae0 (diff)
downloadchromium_org-862bd7759b5ede90f02436dab473f47a24ab7e9b.tar.gz
Cherry pick: Cleanup comments, unit tests and unnecessary early out.
Clean cherry-pick of chromium: https://crrev.com/947fb1c405943173d09e721efcde628dee896e36 BUG: 17369933 Original description: Cleanup comments, unit tests and unnecessary early out. Review URL: https://codereview.chromium.org/545663002 Change-Id: Ia3050dfe65b406b2677f9e10de43ac6665cf953d Cr-Commit-Position: refs/heads/master@{#294206}
-rw-r--r--android_webview/browser/browser_view_renderer.cc5
-rw-r--r--android_webview/browser/global_tile_manager.h2
-rw-r--r--android_webview/browser/global_tile_manager_unittest.cc2
3 files changed, 4 insertions, 5 deletions
diff --git a/android_webview/browser/browser_view_renderer.cc b/android_webview/browser/browser_view_renderer.cc
index c29ccee34d..734fa23f0a 100644
--- a/android_webview/browser/browser_view_renderer.cc
+++ b/android_webview/browser/browser_view_renderer.cc
@@ -136,8 +136,7 @@ BrowserViewRenderer::~BrowserViewRenderer() {
// policy should have already been updated.
}
-// This function updates the cached memory policy in shared renderer state, as
-// well as the tile resource allocation in GlobalTileManager.
+// This function updates the resource allocation in GlobalTileManager.
void BrowserViewRenderer::TrimMemory(const int level, const bool visible) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
// Constants from Android ComponentCallbacks2.
@@ -202,8 +201,6 @@ void BrowserViewRenderer::RequestMemoryPolicy(
void BrowserViewRenderer::SetNumTiles(size_t num_tiles,
bool effective_immediately) {
- if (num_tiles == num_tiles_)
- return;
num_tiles_ = num_tiles;
memory_policy_.num_resources_limit = num_tiles_;
diff --git a/android_webview/browser/global_tile_manager.h b/android_webview/browser/global_tile_manager.h
index 3473c20ead..a4b976bc4f 100644
--- a/android_webview/browser/global_tile_manager.h
+++ b/android_webview/browser/global_tile_manager.h
@@ -31,7 +31,7 @@ class GlobalTileManager {
void SetTileLimit(size_t num_tiles_limit);
- // Requests the |num_of_tiles| from the available global pool. Calls
+ // Requests the |new_num_of_tiles| from the available global pool. Calls
// GlobalTileManagerClient.SetNumTiles after the manager determines how many
// tiles are available for the client. If the number of tiles left is not
// enough to satisfy the request, the manager will evict tiles allocated to
diff --git a/android_webview/browser/global_tile_manager_unittest.cc b/android_webview/browser/global_tile_manager_unittest.cc
index 9f090842f0..bd96889607 100644
--- a/android_webview/browser/global_tile_manager_unittest.cc
+++ b/android_webview/browser/global_tile_manager_unittest.cc
@@ -90,6 +90,8 @@ TEST_F(GlobalTileManagerTest, RandomizedStressRequests) {
index[i] = i;
}
+ // Fix the seed so that tests are reproducible.
+ std::srand(1);
// Simulate a random request order of clients.
std::random_shuffle(&index[0], &index[99]);