Chromium Code Reviews| Index: chrome/browser/task_management/task_manager_interface.cc |
| diff --git a/chrome/browser/task_management/task_manager_interface.cc b/chrome/browser/task_management/task_manager_interface.cc |
| index 1383682872842c4a3d413d4d401dfa2fd54f4b62..d6c10c1d80a32f749a8a82216fab84998694d4be 100644 |
| --- a/chrome/browser/task_management/task_manager_interface.cc |
| +++ b/chrome/browser/task_management/task_manager_interface.cc |
| @@ -4,15 +4,35 @@ |
| #include "chrome/browser/task_management/task_manager_interface.h" |
| +#include "chrome/browser/browser_process.h" |
| #include "chrome/browser/task_management/sampling/task_manager_impl.h" |
| #include "chrome/browser/task_management/sampling/task_manager_io_thread_helper.h" |
| -#include "chrome/browser/task_manager/task_manager.h" |
| #include "chrome/common/chrome_switches.h" |
| +#include "chrome/common/pref_names.h" |
| +#include "components/prefs/pref_registry_simple.h" |
| +#include "components/prefs/pref_service.h" |
| #include "content/public/browser/browser_thread.h" |
| +#if defined(OS_MACOSX) |
| +#include "chrome/browser/task_manager/task_manager.h" |
| +#endif // defined(OS_MACOSX) |
| + |
| namespace task_management { |
| // static |
| +void TaskManagerInterface::RegisterPrefs(PrefRegistrySimple* registry) { |
| + registry->RegisterDictionaryPref(prefs::kTaskManagerWindowPlacement); |
| + registry->RegisterDictionaryPref(prefs::kTaskManagerColumnVisibility); |
| + registry->RegisterBooleanPref(prefs::kTaskManagerEndProcessEnabled, true); |
| +} |
| + |
| +// static |
| +bool TaskManagerInterface::IsEndProcessEnabled() { |
| + PrefService* state = g_browser_process->local_state(); |
| + return !state || state->GetBoolean(prefs::kTaskManagerEndProcessEnabled); |
| +} |
| + |
| +// static |
| TaskManagerInterface* TaskManagerInterface::GetTaskManager() { |
| DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| @@ -24,10 +44,14 @@ void TaskManagerInterface::OnRawBytesRead(const net::URLRequest& request, |
| int64_t bytes_read) { |
| DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| - if (switches::NewTaskManagerEnabled()) |
| - TaskManagerIoThreadHelper::OnRawBytesRead(request, bytes_read); |
| - else |
| +#if defined(OS_MACOSX) |
| + if (!TaskManager::NewTaskManagerEnabled()) { |
| TaskManager::GetInstance()->model()->NotifyBytesRead(request, bytes_read); |
|
tapted
2016/04/27 13:01:45
This approach doesn't really work from outside of
|
| + return; |
| + } |
| +#endif // defined(OS_MACOSX) |
| + |
| + TaskManagerIoThreadHelper::OnRawBytesRead(request, bytes_read); |
| } |
| void TaskManagerInterface::AddObserver(TaskManagerObserver* observer) { |