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

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

Issue 2565323002: Stop using callbacks in MemoryCoordinatorProxy (Closed)
Patch Set: fix Created 4 years 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"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 RemoveFrame(frame); 71 RemoveFrame(frame);
72 unlocked_frames_.push_front(frame); 72 unlocked_frames_.push_front(frame);
73 CullUnlockedFrames(GetMaxNumberOfSavedFrames()); 73 CullUnlockedFrames(GetMaxNumberOfSavedFrames());
74 } 74 }
75 } 75 }
76 76
77 size_t RendererFrameManager::GetMaxNumberOfSavedFrames() const { 77 size_t RendererFrameManager::GetMaxNumberOfSavedFrames() const {
78 int percentage = 100; 78 int percentage = 100;
79 if (base::FeatureList::IsEnabled(features::kMemoryCoordinator)) { 79 if (base::FeatureList::IsEnabled(features::kMemoryCoordinator)) {
80 switch (base::MemoryCoordinatorProxy::GetInstance()-> 80 switch (base::MemoryCoordinatorProxy::GetInstance()->
81 GetCurrentMemoryState()) { 81 GetLocalMemoryState()) {
82 case base::MemoryState::NORMAL: 82 case base::MemoryState::NORMAL:
83 percentage = 100; 83 percentage = 100;
84 break; 84 break;
85 case base::MemoryState::THROTTLED: 85 case base::MemoryState::THROTTLED:
86 percentage = kCriticalPressurePercentage; 86 percentage = kCriticalPressurePercentage;
87 break; 87 break;
88 case base::MemoryState::SUSPENDED: 88 case base::MemoryState::SUSPENDED:
89 case base::MemoryState::UNKNOWN: 89 case base::MemoryState::UNKNOWN:
90 NOTREACHED(); 90 NOTREACHED();
91 break; 91 break;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 } 185 }
186 186
187 void RendererFrameManager::PurgeMemory(int percentage) { 187 void RendererFrameManager::PurgeMemory(int percentage) {
188 int saved_frame_limit = max_number_of_saved_frames_; 188 int saved_frame_limit = max_number_of_saved_frames_;
189 if (saved_frame_limit <= 1) 189 if (saved_frame_limit <= 1)
190 return; 190 return;
191 CullUnlockedFrames(std::max(1, (saved_frame_limit * percentage) / 100)); 191 CullUnlockedFrames(std::max(1, (saved_frame_limit * percentage) / 100));
192 } 192 }
193 193
194 } // namespace content 194 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698