Use OpenThread instead of DuplicateHandle in Win32 profiler implementation.

OpenThread doesn't fail in Chrome sandbox, while DuplicateHandle does.

Review URL: http://codereview.chromium.org/49028

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1604 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 898297b0
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment