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

Unified Diff: src/platform-win32.cc

Issue 49028: Use OpenThread instead of DuplicateHandle in Win32 profiler implementation. (Closed)
Patch Set: Updated comment Created 11 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform-win32.cc
diff --git a/src/platform-win32.cc b/src/platform-win32.cc
index f5d0913581311796912c0d449d2941ed4126fee3..be77360f0142925cca13a93f03b69ca61028452f 100644
--- a/src/platform-win32.cc
+++ b/src/platform-win32.cc
@@ -1817,13 +1817,16 @@ void Sampler::Start() {
// thread.
if (IsProfiling()) {
// Get a handle to the calling thread. This is the thread that we are
- // going to profile. We need to duplicate the handle because we are
- // going to use it in the sampler thread. using GetThreadHandle() will
- // not work in this case.
- BOOL ok = DuplicateHandle(GetCurrentProcess(), GetCurrentThread(),
- GetCurrentProcess(), &data_->profiled_thread_,
- THREAD_GET_CONTEXT | THREAD_SUSPEND_RESUME |
- THREAD_QUERY_INFORMATION, FALSE, 0);
+ // going to profile. We need to make a copy of the handle because we are
+ // going to use it in the sampler thread. Using GetThreadHandle() will
+ // not work in this case. We're using OpenThread because DuplicateHandle
+ // for some reason doesn't work in Chrome's sandbox.
+ data_->profiled_thread_ = OpenThread(THREAD_GET_CONTEXT |
+ THREAD_SUSPEND_RESUME |
+ THREAD_QUERY_INFORMATION,
+ FALSE,
+ GetCurrentThreadId());
+ BOOL ok = data_->profiled_thread_ != NULL;
if (!ok) return;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698