Chromium Code Reviews| 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 "chrome/browser/task_manager/sampling/task_group.h" | 5 #include "chrome/browser/task_manager/sampling/task_group.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 83 gpu_memory_(-1), | 83 gpu_memory_(-1), |
| 84 memory_state_(base::MemoryState::UNKNOWN), | 84 memory_state_(base::MemoryState::UNKNOWN), |
| 85 per_process_network_usage_(-1), | 85 per_process_network_usage_(-1), |
| 86 #if defined(OS_WIN) | 86 #if defined(OS_WIN) |
| 87 gdi_current_handles_(-1), | 87 gdi_current_handles_(-1), |
| 88 gdi_peak_handles_(-1), | 88 gdi_peak_handles_(-1), |
| 89 user_current_handles_(-1), | 89 user_current_handles_(-1), |
| 90 user_peak_handles_(-1), | 90 user_peak_handles_(-1), |
| 91 #endif // defined(OS_WIN) | 91 #endif // defined(OS_WIN) |
| 92 #if !defined(DISABLE_NACL) | 92 #if !defined(DISABLE_NACL) |
| 93 nacl_debug_stub_port_(-1), | 93 nacl_debug_stub_port_(nacl::kGdbDebugStubPortUnknown), |
|
afakhry
2017/01/23 17:41:55
While we are here, can you please revise the expec
Wez
2017/01/23 19:21:01
Hmmm, GetNaClPortText() doesn't need the -2 case,
| |
| 94 #endif // !defined(DISABLE_NACL) | 94 #endif // !defined(DISABLE_NACL) |
| 95 idle_wakeups_per_second_(-1), | 95 idle_wakeups_per_second_(-1), |
| 96 #if defined(OS_LINUX) | 96 #if defined(OS_LINUX) |
| 97 open_fd_count_(-1), | 97 open_fd_count_(-1), |
| 98 #endif // defined(OS_LINUX) | 98 #endif // defined(OS_LINUX) |
| 99 gpu_memory_has_duplicates_(false), | 99 gpu_memory_has_duplicates_(false), |
| 100 is_backgrounded_(false), | 100 is_backgrounded_(false), |
| 101 weak_ptr_factory_(this) { | 101 weak_ptr_factory_(this) { |
| 102 scoped_refptr<TaskGroupSampler> sampler( | 102 scoped_refptr<TaskGroupSampler> sampler( |
| 103 new TaskGroupSampler(base::Process::Open(proc_id), | 103 new TaskGroupSampler(base::Process::Open(proc_id), |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 251 #if defined(OS_WIN) | 251 #if defined(OS_WIN) |
| 252 GetWindowsHandles(process_handle_, | 252 GetWindowsHandles(process_handle_, |
| 253 &gdi_current_handles_, | 253 &gdi_current_handles_, |
| 254 &gdi_peak_handles_, | 254 &gdi_peak_handles_, |
| 255 &user_current_handles_, | 255 &user_current_handles_, |
| 256 &user_peak_handles_); | 256 &user_peak_handles_); |
| 257 #endif // defined(OS_WIN) | 257 #endif // defined(OS_WIN) |
| 258 } | 258 } |
| 259 | 259 |
| 260 #if !defined(DISABLE_NACL) | 260 #if !defined(DISABLE_NACL) |
| 261 static int GetNaClDebugStubPort(int process_id) { | |
|
afakhry
2017/01/23 17:41:55
Can you please add a DCHECK_CURRENTLY_ON(content::
Wez
2017/01/23 19:21:02
I'd prefer to express that via the name, since thi
| |
| 262 return nacl::NaClBrowser::GetInstance()->GetProcessGdbDebugStubPort( | |
| 263 process_id); | |
| 264 } | |
| 265 | |
| 261 void TaskGroup::RefreshNaClDebugStubPort(int child_process_unique_id) { | 266 void TaskGroup::RefreshNaClDebugStubPort(int child_process_unique_id) { |
| 262 nacl::NaClBrowser* nacl_browser = nacl::NaClBrowser::GetInstance(); | |
| 263 content::BrowserThread::PostTaskAndReplyWithResult( | 267 content::BrowserThread::PostTaskAndReplyWithResult( |
| 264 content::BrowserThread::IO, FROM_HERE, | 268 content::BrowserThread::IO, FROM_HERE, |
| 265 base::Bind(&nacl::NaClBrowser::GetProcessGdbDebugStubPort, | 269 base::Bind(&GetNaClDebugStubPort, child_process_unique_id), |
| 266 base::Unretained(nacl_browser), child_process_unique_id), | |
| 267 base::Bind(&TaskGroup::OnRefreshNaClDebugStubPortDone, | 270 base::Bind(&TaskGroup::OnRefreshNaClDebugStubPortDone, |
| 268 weak_ptr_factory_.GetWeakPtr())); | 271 weak_ptr_factory_.GetWeakPtr())); |
| 269 } | 272 } |
| 270 | 273 |
| 271 void TaskGroup::OnRefreshNaClDebugStubPortDone(int nacl_debug_stub_port) { | 274 void TaskGroup::OnRefreshNaClDebugStubPortDone(int nacl_debug_stub_port) { |
| 272 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 275 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 273 | 276 |
| 274 nacl_debug_stub_port_ = nacl_debug_stub_port; | 277 nacl_debug_stub_port_ = nacl_debug_stub_port; |
| 275 OnBackgroundRefreshTypeFinished(REFRESH_TYPE_NACL); | 278 OnBackgroundRefreshTypeFinished(REFRESH_TYPE_NACL); |
| 276 } | 279 } |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 344 | 347 |
| 345 void TaskGroup::OnBackgroundRefreshTypeFinished(int64_t finished_refresh_type) { | 348 void TaskGroup::OnBackgroundRefreshTypeFinished(int64_t finished_refresh_type) { |
| 346 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 349 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 347 | 350 |
| 348 current_on_bg_done_flags_ |= finished_refresh_type; | 351 current_on_bg_done_flags_ |= finished_refresh_type; |
| 349 if (AreBackgroundCalculationsDone()) | 352 if (AreBackgroundCalculationsDone()) |
| 350 on_background_calculations_done_.Run(); | 353 on_background_calculations_done_.Run(); |
| 351 } | 354 } |
| 352 | 355 |
| 353 } // namespace task_manager | 356 } // namespace task_manager |
| OLD | NEW |