| OLD | NEW |
| 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/memory/memory_pressure_listener.h" | 7 #include "base/memory/memory_pressure_listener.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "content/browser/memory/memory_pressure_controller_impl.h" | 9 #include "content/browser/memory/memory_pressure_controller_impl.h" |
| 10 #include "content/public/common/content_features.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) { |
| 17 } |
| 16 | 18 |
| 17 MemoryHandler::~MemoryHandler() {} | 19 MemoryHandler::~MemoryHandler() {} |
| 18 | 20 |
| 19 void MemoryHandler::Wire(UberDispatcher* dispatcher) { | 21 void MemoryHandler::Wire(UberDispatcher* dispatcher) { |
| 20 Memory::Dispatcher::wire(dispatcher, this); | 22 Memory::Dispatcher::wire(dispatcher, this); |
| 21 } | 23 } |
| 22 | 24 |
| 23 Response MemoryHandler::Disable() { | |
| 24 return Response::OK(); | |
| 25 } | |
| 26 | |
| 27 Response MemoryHandler::SetPressureNotificationsSuppressed( | 25 Response MemoryHandler::SetPressureNotificationsSuppressed( |
| 28 bool suppressed) { | 26 bool suppressed) { |
| 29 if (base::FeatureList::IsEnabled(features::kMemoryCoordinator)) { | 27 if (base::FeatureList::IsEnabled(features::kMemoryCoordinator)) { |
| 30 return Response::Error( | 28 return Response::Error( |
| 31 "Cannot enable/disable notifications when memory coordinator is " | 29 "Cannot enable/disable notifications when memory coordinator is " |
| 32 "enabled"); | 30 "enabled"); |
| 33 } | 31 } |
| 34 content::MemoryPressureControllerImpl::GetInstance() | 32 content::MemoryPressureControllerImpl::GetInstance() |
| 35 ->SetPressureNotificationsSuppressedInAllProcesses(suppressed); | 33 ->SetPressureNotificationsSuppressedInAllProcesses(suppressed); |
| 36 return Response::OK(); | 34 return Response::OK(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 48 "Invalid memory pressure level '%s'", level.c_str())); | 46 "Invalid memory pressure level '%s'", level.c_str())); |
| 49 } | 47 } |
| 50 | 48 |
| 51 MemoryPressureControllerImpl::GetInstance() | 49 MemoryPressureControllerImpl::GetInstance() |
| 52 ->SimulatePressureNotificationInAllProcesses(parsed_level); | 50 ->SimulatePressureNotificationInAllProcesses(parsed_level); |
| 53 return Response::OK(); | 51 return Response::OK(); |
| 54 } | 52 } |
| 55 | 53 |
| 56 } // namespace protocol | 54 } // namespace protocol |
| 57 } // namespace content | 55 } // namespace content |
| OLD | NEW |