| 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;
|
| }
|
|
|
|
|