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

Side by Side Diff: content/browser/devtools/protocol/memory_handler.cc

Issue 2819493002: [Test] Move DelegatedFrameEvictor into components -public_deps (Closed)
Patch Set: use if null instead of feature Created 3 years, 8 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/devtools/protocol/memory_handler.h" 5 #include "content/browser/devtools/protocol/memory_handler.h"
6 6
7 #include "base/base_features.h"
7 #include "base/memory/memory_pressure_listener.h" 8 #include "base/memory/memory_pressure_listener.h"
8 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
9 #include "content/browser/memory/memory_pressure_controller_impl.h" 10 #include "content/browser/memory/memory_pressure_controller_impl.h"
10 #include "content/public/common/content_features.h"
11 11
12 namespace content { 12 namespace content {
13 namespace protocol { 13 namespace protocol {
14 14
15 MemoryHandler::MemoryHandler() 15 MemoryHandler::MemoryHandler()
16 : DevToolsDomainHandler(Memory::Metainfo::domainName) { 16 : DevToolsDomainHandler(Memory::Metainfo::domainName) {
17 } 17 }
18 18
19 MemoryHandler::~MemoryHandler() {} 19 MemoryHandler::~MemoryHandler() {}
20 20
21 void MemoryHandler::Wire(UberDispatcher* dispatcher) { 21 void MemoryHandler::Wire(UberDispatcher* dispatcher) {
22 Memory::Dispatcher::wire(dispatcher, this); 22 Memory::Dispatcher::wire(dispatcher, this);
23 } 23 }
24 24
25 Response MemoryHandler::SetPressureNotificationsSuppressed( 25 Response MemoryHandler::SetPressureNotificationsSuppressed(
26 bool suppressed) { 26 bool suppressed) {
27 if (base::FeatureList::IsEnabled(features::kMemoryCoordinator)) { 27 if (base::FeatureList::IsEnabled(base::features::kMemoryCoordinator)) {
28 return Response::Error( 28 return Response::Error(
29 "Cannot enable/disable notifications when memory coordinator is " 29 "Cannot enable/disable notifications when memory coordinator is "
30 "enabled"); 30 "enabled");
31 } 31 }
32 content::MemoryPressureControllerImpl::GetInstance() 32 content::MemoryPressureControllerImpl::GetInstance()
33 ->SetPressureNotificationsSuppressedInAllProcesses(suppressed); 33 ->SetPressureNotificationsSuppressedInAllProcesses(suppressed);
34 return Response::OK(); 34 return Response::OK();
35 } 35 }
36 36
37 Response MemoryHandler::SimulatePressureNotification( 37 Response MemoryHandler::SimulatePressureNotification(
38 const std::string& level) { 38 const std::string& level) {
39 base::MemoryPressureListener::MemoryPressureLevel parsed_level; 39 base::MemoryPressureListener::MemoryPressureLevel parsed_level;
40 if (level == protocol::Memory::PressureLevelEnum::Moderate) { 40 if (level == protocol::Memory::PressureLevelEnum::Moderate) {
41 parsed_level = base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE; 41 parsed_level = base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE;
42 } else if (level == protocol::Memory::PressureLevelEnum::Critical) { 42 } else if (level == protocol::Memory::PressureLevelEnum::Critical) {
43 parsed_level = base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL; 43 parsed_level = base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL;
44 } else { 44 } else {
45 return Response::InvalidParams(base::StringPrintf( 45 return Response::InvalidParams(base::StringPrintf(
46 "Invalid memory pressure level '%s'", level.c_str())); 46 "Invalid memory pressure level '%s'", level.c_str()));
47 } 47 }
48 48
49 MemoryPressureControllerImpl::GetInstance() 49 MemoryPressureControllerImpl::GetInstance()
50 ->SimulatePressureNotificationInAllProcesses(parsed_level); 50 ->SimulatePressureNotificationInAllProcesses(parsed_level);
51 return Response::OK(); 51 return Response::OK();
52 } 52 }
53 53
54 } // namespace protocol 54 } // namespace protocol
55 } // namespace content 55 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_main_loop.cc ('k') | content/browser/dom_storage/dom_storage_context_wrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698