OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/render_thread_impl.h" | 5 #include "content/renderer/render_thread_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <map> | 9 #include <map> |
10 #include <vector> | 10 #include <vector> |
(...skipping 1400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1411 params.route_id); | 1411 params.route_id); |
1412 } | 1412 } |
1413 | 1413 |
1414 void RenderThreadImpl::OnMemoryPressure( | 1414 void RenderThreadImpl::OnMemoryPressure( |
1415 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level) { | 1415 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level) { |
1416 base::allocator::ReleaseFreeMemory(); | 1416 base::allocator::ReleaseFreeMemory(); |
1417 | 1417 |
1418 if (memory_pressure_level == | 1418 if (memory_pressure_level == |
1419 base::MemoryPressureListener::MEMORY_PRESSURE_CRITICAL) { | 1419 base::MemoryPressureListener::MEMORY_PRESSURE_CRITICAL) { |
1420 // Trigger full v8 garbage collection on critical memory notification. | 1420 // Trigger full v8 garbage collection on critical memory notification. |
1421 v8::V8::LowMemoryNotification(); | 1421 v8::V8::LowMemoryNotification(); |
boliu
2014/05/16 16:31:15
Could skip v8 and skia as well if blink is not ini
| |
1422 // Clear the image cache. | 1422 |
1423 blink::WebImageCache::clear(); | 1423 if (webkit_platform_support_) { |
1424 // Clear the image cache. Do not call into blink if it is not initialized. | |
1425 blink::WebImageCache::clear(); | |
1426 } | |
1427 | |
1424 // Purge Skia font cache, by setting it to 0 and then again to the previous | 1428 // Purge Skia font cache, by setting it to 0 and then again to the previous |
1425 // limit. | 1429 // limit. |
1426 size_t font_cache_limit = SkGraphics::SetFontCacheLimit(0); | 1430 size_t font_cache_limit = SkGraphics::SetFontCacheLimit(0); |
1427 SkGraphics::SetFontCacheLimit(font_cache_limit); | 1431 SkGraphics::SetFontCacheLimit(font_cache_limit); |
1428 } else { | 1432 } else { |
1429 // Otherwise trigger a couple of v8 GCs using IdleNotification. | 1433 // Otherwise trigger a couple of v8 GCs using IdleNotification. |
1430 if (!v8::V8::IdleNotification()) | 1434 if (!v8::V8::IdleNotification()) |
1431 v8::V8::IdleNotification(); | 1435 v8::V8::IdleNotification(); |
1432 } | 1436 } |
1433 } | 1437 } |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1502 hidden_widget_count_--; | 1506 hidden_widget_count_--; |
1503 | 1507 |
1504 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { | 1508 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { |
1505 return; | 1509 return; |
1506 } | 1510 } |
1507 | 1511 |
1508 ScheduleIdleHandler(kLongIdleHandlerDelayMs); | 1512 ScheduleIdleHandler(kLongIdleHandlerDelayMs); |
1509 } | 1513 } |
1510 | 1514 |
1511 } // namespace content | 1515 } // namespace content |
OLD | NEW |