Reviewers: Søren Gjesse,
Description:
Use OpenThread instead of DuplicateHandle in Win32 profiler
implementation.
OpenThread doesn't fail in Chrome sandbox, while DuplicateHandle does.
Please review this at
http://codereview.chromium.org/49028
Affected files:
M src/platform-win32.cc
Index: src/platform-win32.cc
diff --git a/src/platform-win32.cc b/src/platform-win32.cc
index
f5d0913581311796912c0d449d2941ed4126fee3..8628c9648bb08e49645e2312856ebf45bccd14ae
100644
--- a/src/platform-win32.cc
+++ b/src/platform-win32.cc
@@ -1820,10 +1820,12 @@ void Sampler::Start() {
// 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);
+ data_->profiled_thread_ = OpenThread(THREAD_GET_CONTEXT |
+ THREAD_SUSPEND_RESUME |
+ THREAD_QUERY_INFORMATION,
+ FALSE,
+ GetCurrentThreadId());
+ BOOL ok = data_->profiled_thread_ != NULL;
if (!ok) return;
}