Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: content/browser/renderer_host/renderer_frame_manager.cc

Issue 1308823002: Move Singleton and related structs to namespace base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ToT Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/browser/renderer_host/renderer_frame_manager.h" 5 #include "content/browser/renderer_host/renderer_frame_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/memory/memory_pressure_listener.h" 11 #include "base/memory/memory_pressure_listener.h"
12 #include "base/memory/memory_pressure_monitor.h" 12 #include "base/memory/memory_pressure_monitor.h"
13 #include "base/memory/shared_memory.h" 13 #include "base/memory/shared_memory.h"
14 #include "base/sys_info.h" 14 #include "base/sys_info.h"
15 #include "content/common/host_shared_bitmap_manager.h" 15 #include "content/common/host_shared_bitmap_manager.h"
16 16
17 namespace content { 17 namespace content {
18 namespace { 18 namespace {
19 19
20 const int kModeratePressurePercentage = 50; 20 const int kModeratePressurePercentage = 50;
21 const int kCriticalPressurePercentage = 10; 21 const int kCriticalPressurePercentage = 10;
22 22
23 } // namespace 23 } // namespace
24 24
25 RendererFrameManager* RendererFrameManager::GetInstance() { 25 RendererFrameManager* RendererFrameManager::GetInstance() {
26 return Singleton<RendererFrameManager>::get(); 26 return base::Singleton<RendererFrameManager>::get();
27 } 27 }
28 28
29 void RendererFrameManager::AddFrame(RendererFrameManagerClient* frame, 29 void RendererFrameManager::AddFrame(RendererFrameManagerClient* frame,
30 bool locked) { 30 bool locked) {
31 RemoveFrame(frame); 31 RemoveFrame(frame);
32 if (locked) 32 if (locked)
33 locked_frames_[frame] = 1; 33 locked_frames_[frame] = 1;
34 else 34 else
35 unlocked_frames_.push_front(frame); 35 unlocked_frames_.push_front(frame);
36 CullUnlockedFrames(GetMaxNumberOfSavedFrames()); 36 CullUnlockedFrames(GetMaxNumberOfSavedFrames());
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 percentage = kCriticalPressurePercentage; 145 percentage = kCriticalPressurePercentage;
146 break; 146 break;
147 case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE: 147 case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE:
148 // No need to change anything when there is no pressure. 148 // No need to change anything when there is no pressure.
149 return; 149 return;
150 } 150 }
151 CullUnlockedFrames(std::max(1, (saved_frame_limit * percentage) / 100)); 151 CullUnlockedFrames(std::max(1, (saved_frame_limit * percentage) / 100));
152 } 152 }
153 153
154 } // namespace content 154 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/renderer_frame_manager.h ('k') | content/browser/renderer_host/text_input_client_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698