Author: mikhail.naga...@gmail.com Date: Wed Mar 25 02:35:11 2009 New Revision: 1604
Modified: branches/bleeding_edge/src/platform-win32.cc Log: 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 Modified: branches/bleeding_edge/src/platform-win32.cc ============================================================================== --- branches/bleeding_edge/src/platform-win32.cc (original) +++ branches/bleeding_edge/src/platform-win32.cc Wed Mar 25 02:35:11 2009 @@ -1817,13 +1817,16 @@ // 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; } --~--~---------~--~----~------------~-------~--~----~ v8-dev mailing list v8-dev@googlegroups.com http://groups.google.com/group/v8-dev -~----------~----~----~----~------~----~------~--~---