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 1534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1545 } | 1545 } |
1546 | 1546 |
1547 void RenderThreadImpl::WidgetHidden() { | 1547 void RenderThreadImpl::WidgetHidden() { |
1548 DCHECK_LT(hidden_widget_count_, widget_count_); | 1548 DCHECK_LT(hidden_widget_count_, widget_count_); |
1549 hidden_widget_count_++; | 1549 hidden_widget_count_++; |
1550 | 1550 |
1551 if (widget_count_ && hidden_widget_count_ == widget_count_) { | 1551 if (widget_count_ && hidden_widget_count_ == widget_count_) { |
1552 #if !defined(SYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE) | 1552 #if !defined(SYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE) |
1553 // TODO(vollick): Remove this this heavy-handed approach once we're polling | 1553 // TODO(vollick): Remove this this heavy-handed approach once we're polling |
1554 // the real system memory pressure. | 1554 // the real system memory pressure. |
1555 base::MemoryPressureListener::NotifyMemoryPressure( | 1555 |
1556 base::MemoryPressureListener::MEMORY_PRESSURE_MODERATE); | 1556 // TODO(wfh): http://crbug.com/381820 remove this after testing whether |
| 1557 // this affects tabs hanging. |
| 1558 // base::MemoryPressureListener::NotifyMemoryPressure( |
| 1559 // base::MemoryPressureListener::MEMORY_PRESSURE_MODERATE); |
1557 #endif | 1560 #endif |
1558 if (GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) | 1561 if (GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) |
1559 ScheduleIdleHandler(kInitialIdleHandlerDelayMs); | 1562 ScheduleIdleHandler(kInitialIdleHandlerDelayMs); |
1560 } | 1563 } |
1561 } | 1564 } |
1562 | 1565 |
1563 void RenderThreadImpl::WidgetRestored() { | 1566 void RenderThreadImpl::WidgetRestored() { |
1564 DCHECK_GT(hidden_widget_count_, 0); | 1567 DCHECK_GT(hidden_widget_count_, 0); |
1565 hidden_widget_count_--; | 1568 hidden_widget_count_--; |
1566 | 1569 |
1567 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { | 1570 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { |
1568 return; | 1571 return; |
1569 } | 1572 } |
1570 | 1573 |
1571 ScheduleIdleHandler(kLongIdleHandlerDelayMs); | 1574 ScheduleIdleHandler(kLongIdleHandlerDelayMs); |
1572 } | 1575 } |
1573 | 1576 |
1574 } // namespace content | 1577 } // namespace content |
OLD | NEW |