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

Unified Diff: chrome/browser/task_manager/sampling/task_group.cc

Issue 2646623004: Query NaCl processes' GDB debug port on the correct thread. (Closed)
Patch Set: Pull changes from 2634573003 Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/task_manager/sampling/task_group.cc
diff --git a/chrome/browser/task_manager/sampling/task_group.cc b/chrome/browser/task_manager/sampling/task_group.cc
index a7a0d11116ec0b15b4f361873cfdc146174b294e..dfb15a536ee74b5b06001286e86c389e0eb68b87 100644
--- a/chrome/browser/task_manager/sampling/task_group.cc
+++ b/chrome/browser/task_manager/sampling/task_group.cc
@@ -31,7 +31,7 @@ const int kBackgroundRefreshTypesMask =
#if defined(OS_LINUX)
REFRESH_TYPE_FD_COUNT |
#endif // defined(OS_LINUX)
- REFRESH_TYPE_PRIORITY;
+ REFRESH_TYPE_NACL | REFRESH_TYPE_PRIORITY;
Wez 2017/01/23 21:49:10 IIUC getting these wrong should mean that we never
afakhry 2017/02/09 01:26:59 Your understanding is correct. That's why you mu
#if defined(OS_WIN)
// Gets the GDI and USER Handles on Windows at one shot.
@@ -89,7 +89,7 @@ TaskGroup::TaskGroup(
user_peak_handles_(-1),
#endif // defined(OS_WIN)
#if !defined(DISABLE_NACL)
- nacl_debug_stub_port_(-1),
+ nacl_debug_stub_port_(nacl::kGdbDebugStubPortUnknown),
#endif // !defined(DISABLE_NACL)
idle_wakeups_per_second_(-1),
#if defined(OS_LINUX)
@@ -176,7 +176,8 @@ void TaskGroup::Refresh(const gpu::VideoMemoryUsageStats& gpu_memory_stats,
}
#endif // defined(OS_WIN)
- // 4- Refresh the NACL debug stub port (if enabled).
+// 4- Refresh the NACL debug stub port (if enabled). This calls out to
+// NaClBrowser on the browser's IO thread, completing asynchronously.
#if !defined(DISABLE_NACL)
if (TaskManagerObserver::IsResourceRefreshEnabled(REFRESH_TYPE_NACL,
refresh_flags) &&
@@ -255,14 +256,28 @@ void TaskGroup::RefreshWindowsHandles() {
#endif // defined(OS_WIN)
}
-void TaskGroup::RefreshNaClDebugStubPort(int child_process_unique_id) {
#if !defined(DISABLE_NACL)
- nacl::NaClBrowser* nacl_browser = nacl::NaClBrowser::GetInstance();
- nacl_debug_stub_port_ =
- nacl_browser->GetProcessGdbDebugStubPort(child_process_unique_id);
-#endif // !defined(DISABLE_NACL)
+static int GetNaClDebugStubPortOnIoThread(int process_id) {
+ return nacl::NaClBrowser::GetInstance()->GetProcessGdbDebugStubPort(
+ process_id);
+}
afakhry 2017/02/09 01:26:59 Nit: To keep the organization of the current code
+
+void TaskGroup::RefreshNaClDebugStubPort(int child_process_unique_id) {
+ content::BrowserThread::PostTaskAndReplyWithResult(
+ content::BrowserThread::IO, FROM_HERE,
+ base::Bind(&GetNaClDebugStubPortOnIoThread, child_process_unique_id),
+ base::Bind(&TaskGroup::OnRefreshNaClDebugStubPortDone,
+ weak_ptr_factory_.GetWeakPtr()));
}
+void TaskGroup::OnRefreshNaClDebugStubPortDone(int nacl_debug_stub_port) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+
+ nacl_debug_stub_port_ = nacl_debug_stub_port;
+ OnBackgroundRefreshTypeFinished(REFRESH_TYPE_NACL);
+}
+#endif // !defined(DISABLE_NACL)
+
void TaskGroup::OnCpuRefreshDone(double cpu_usage) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);

Powered by Google App Engine
This is Rietveld 408576698