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 1498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1509 base::allocator::ReleaseFreeMemory(); | 1509 base::allocator::ReleaseFreeMemory(); |
1510 | 1510 |
1511 // Trigger full v8 garbage collection on critical memory notification. This | 1511 // Trigger full v8 garbage collection on critical memory notification. This |
1512 // will potentially hang the renderer for a long time, however, when we | 1512 // will potentially hang the renderer for a long time, however, when we |
1513 // receive a memory pressure notification, we might be about to be killed. | 1513 // receive a memory pressure notification, we might be about to be killed. |
1514 if (blink_platform_impl_ && blink::mainThreadIsolate()) { | 1514 if (blink_platform_impl_ && blink::mainThreadIsolate()) { |
1515 blink::mainThreadIsolate()->LowMemoryNotification(); | 1515 blink::mainThreadIsolate()->LowMemoryNotification(); |
1516 } | 1516 } |
1517 | 1517 |
1518 if (memory_pressure_level == | 1518 if (memory_pressure_level == |
1519 base::MemoryPressureListener::MEMORY_PRESSURE_CRITICAL) { | 1519 base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL) { |
1520 if (blink_platform_impl_) { | 1520 if (blink_platform_impl_) { |
1521 // Clear the image cache. Do not call into blink if it is not initialized. | 1521 // Clear the image cache. Do not call into blink if it is not initialized. |
1522 blink::WebImageCache::clear(); | 1522 blink::WebImageCache::clear(); |
1523 } | 1523 } |
1524 | 1524 |
1525 // Purge Skia font cache, by setting it to 0 and then again to the previous | 1525 // Purge Skia font cache, by setting it to 0 and then again to the previous |
1526 // limit. | 1526 // limit. |
1527 size_t font_cache_limit = SkGraphics::SetFontCacheLimit(0); | 1527 size_t font_cache_limit = SkGraphics::SetFontCacheLimit(0); |
1528 SkGraphics::SetFontCacheLimit(font_cache_limit); | 1528 SkGraphics::SetFontCacheLimit(font_cache_limit); |
1529 } | 1529 } |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1587 hidden_widget_count_--; | 1587 hidden_widget_count_--; |
1588 | 1588 |
1589 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { | 1589 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { |
1590 return; | 1590 return; |
1591 } | 1591 } |
1592 | 1592 |
1593 ScheduleIdleHandler(kLongIdleHandlerDelayMs); | 1593 ScheduleIdleHandler(kLongIdleHandlerDelayMs); |
1594 } | 1594 } |
1595 | 1595 |
1596 } // namespace content | 1596 } // namespace content |
OLD | NEW |