Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
|
Avi (use Gerrit)
2013/06/20 20:34:27
New files don't get "(c)", use current year.
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "content/renderer/render_process_visibility_manager.h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 #include "base/memory/memory_pressure_listener.h" | |
| 9 | |
| 10 namespace content { | |
| 11 | |
| 12 RenderProcessVisibilityManager::RenderProcessVisibilityManager() | |
| 13 : num_visible_render_widgets_(0) { | |
| 14 } | |
| 15 | |
| 16 RenderProcessVisibilityManager::~RenderProcessVisibilityManager() { | |
| 17 } | |
| 18 | |
| 19 // static | |
| 20 RenderProcessVisibilityManager* RenderProcessVisibilityManager::GetInstance() { | |
| 21 return Singleton<RenderProcessVisibilityManager>::get(); | |
| 22 } | |
| 23 | |
| 24 void RenderProcessVisibilityManager::WidgetVisibilityChanged(bool visible) { | |
| 25 #if !defined(DISCARDABLE_MEMORY_SUPPORTED_NATIVELY) | |
| 26 num_visible_render_widgets_ += visible ? 1 : -1; | |
| 27 DCHECK_LE(0, num_visible_render_widgets_); | |
| 28 if (num_visible_render_widgets_ == 0) { | |
| 29 base::MemoryPressureListener::NotifyMemoryPressure( | |
| 30 base::MemoryPressureListener::MEMORY_PRESSURE_CRITICAL); | |
|
Avi (use Gerrit)
2013/06/20 20:34:27
Wow, that's heavy-handed.
| |
| 31 } | |
| 32 #endif | |
| 33 } | |
| 34 | |
| 35 } // namespace content | |
| OLD | NEW |