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