| 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 1513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1524 params.route_id); | 1524 params.route_id); |
| 1525 } | 1525 } |
| 1526 | 1526 |
| 1527 void RenderThreadImpl::OnMemoryPressure( | 1527 void RenderThreadImpl::OnMemoryPressure( |
| 1528 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level) { | 1528 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level) { |
| 1529 base::allocator::ReleaseFreeMemory(); | 1529 base::allocator::ReleaseFreeMemory(); |
| 1530 | 1530 |
| 1531 // Trigger full v8 garbage collection on critical memory notification. This | 1531 // Trigger full v8 garbage collection on critical memory notification. This |
| 1532 // will potentially hang the renderer for a long time, however, when we | 1532 // will potentially hang the renderer for a long time, however, when we |
| 1533 // receive a memory pressure notification, we might be about to be killed. | 1533 // receive a memory pressure notification, we might be about to be killed. |
| 1534 if (blink::mainThreadIsolate()) { | 1534 if (webkit_platform_support_ && blink::mainThreadIsolate()) { |
| 1535 blink::mainThreadIsolate()->LowMemoryNotification(); | 1535 blink::mainThreadIsolate()->LowMemoryNotification(); |
| 1536 } | 1536 } |
| 1537 | 1537 |
| 1538 if (memory_pressure_level == | 1538 if (memory_pressure_level == |
| 1539 base::MemoryPressureListener::MEMORY_PRESSURE_CRITICAL) { | 1539 base::MemoryPressureListener::MEMORY_PRESSURE_CRITICAL) { |
| 1540 if (webkit_platform_support_) { | 1540 if (webkit_platform_support_) { |
| 1541 // Clear the image cache. Do not call into blink if it is not initialized. | 1541 // Clear the image cache. Do not call into blink if it is not initialized. |
| 1542 blink::WebImageCache::clear(); | 1542 blink::WebImageCache::clear(); |
| 1543 } | 1543 } |
| 1544 | 1544 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1613 hidden_widget_count_--; | 1613 hidden_widget_count_--; |
| 1614 | 1614 |
| 1615 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { | 1615 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { |
| 1616 return; | 1616 return; |
| 1617 } | 1617 } |
| 1618 | 1618 |
| 1619 ScheduleIdleHandler(kLongIdleHandlerDelayMs); | 1619 ScheduleIdleHandler(kLongIdleHandlerDelayMs); |
| 1620 } | 1620 } |
| 1621 | 1621 |
| 1622 } // namespace content | 1622 } // namespace content |
| OLD | NEW |