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() { ...@@ -1817,13 +1817,16 @@ void Sampler::Start() {
// thread. // thread.
if (IsProfiling()) { if (IsProfiling()) {
// Get a handle to the calling thread. This is the thread that we are // 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 profile. We need to make a copy of the handle because we are
// going to use it in the sampler thread. using GetThreadHandle() will // going to use it in the sampler thread. Using GetThreadHandle() will
// not work in this case. // not work in this case. We're using OpenThread because DuplicateHandle
BOOL ok = DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), // for some reason doesn't work in Chrome's sandbox.
GetCurrentProcess(), &data_->profiled_thread_, data_->profiled_thread_ = OpenThread(THREAD_GET_CONTEXT |
THREAD_GET_CONTEXT | THREAD_SUSPEND_RESUME | THREAD_SUSPEND_RESUME |
THREAD_QUERY_INFORMATION, FALSE, 0); THREAD_QUERY_INFORMATION,
FALSE,
GetCurrentThreadId());
BOOL ok = data_->profiled_thread_ != NULL;
if (!ok) return; 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