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}
diff --git a/android_webview/browser/browser_view_renderer.cc b/android_webview/browser/browser_view_renderer.cc
index c29ccee..734fa23 100644
--- a/android_webview/browser/browser_view_renderer.cc
+++ b/android_webview/browser/browser_view_renderer.cc
@@ -136,8 +136,7 @@
// 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::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 3473c20..a4b976b 100644
--- a/android_webview/browser/global_tile_manager.h
+++ b/android_webview/browser/global_tile_manager.h
@@ -31,7 +31,7 @@
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 9f09084..bd96889 100644
--- a/android_webview/browser/global_tile_manager_unittest.cc
+++ b/android_webview/browser/global_tile_manager_unittest.cc
@@ -90,6 +90,8 @@
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]);