| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/devtools/v8_sampling_profiler.h" | 5 #include "content/renderer/devtools/v8_sampling_profiler.h" |
| 6 | 6 |
| 7 #if defined(OS_POSIX) | 7 #if defined(OS_POSIX) |
| 8 #include <signal.h> | 8 #include <signal.h> |
| 9 #define USE_SIGNALS | 9 #define USE_SIGNALS |
| 10 #endif | 10 #endif |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 // static | 438 // static |
| 439 void V8SamplingThread::HandleProfilerSignal(int signal, | 439 void V8SamplingThread::HandleProfilerSignal(int signal, |
| 440 siginfo_t* info, | 440 siginfo_t* info, |
| 441 void* context) { | 441 void* context) { |
| 442 if (signal != SIGPROF) | 442 if (signal != SIGPROF) |
| 443 return; | 443 return; |
| 444 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); | 444 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); |
| 445 mcontext_t& mcontext = ucontext->uc_mcontext; | 445 mcontext_t& mcontext = ucontext->uc_mcontext; |
| 446 v8::RegisterState state; | 446 v8::RegisterState state; |
| 447 | 447 |
| 448 #if defined(OS_ANDROID) | 448 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) |
| 449 // TODO(alph): Add support for Android | 449 // TODO(alph): Add support for Android and ChromeOS |
| 450 ALLOW_UNUSED_LOCAL(mcontext); | 450 ALLOW_UNUSED_LOCAL(mcontext); |
| 451 | 451 |
| 452 #elif defined(OS_MACOSX) | 452 #elif defined(OS_MACOSX) |
| 453 #if ARCH_CPU_64_BITS | 453 #if ARCH_CPU_64_BITS |
| 454 state.pc = reinterpret_cast<void*>(mcontext->__ss.__rip); | 454 state.pc = reinterpret_cast<void*>(mcontext->__ss.__rip); |
| 455 state.sp = reinterpret_cast<void*>(mcontext->__ss.__rsp); | 455 state.sp = reinterpret_cast<void*>(mcontext->__ss.__rsp); |
| 456 state.fp = reinterpret_cast<void*>(mcontext->__ss.__rbp); | 456 state.fp = reinterpret_cast<void*>(mcontext->__ss.__rbp); |
| 457 #elif ARCH_CPU_32_BITS | 457 #elif ARCH_CPU_32_BITS |
| 458 state.pc = reinterpret_cast<void*>(mcontext->__ss.__eip); | 458 state.pc = reinterpret_cast<void*>(mcontext->__ss.__eip); |
| 459 state.sp = reinterpret_cast<void*>(mcontext->__ss.__esp); | 459 state.sp = reinterpret_cast<void*>(mcontext->__ss.__esp); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 | 538 |
| 539 void V8SamplingProfiler::EnableSamplingEventForTesting() { | 539 void V8SamplingProfiler::EnableSamplingEventForTesting() { |
| 540 waitable_event_for_testing_.reset(new base::WaitableEvent(false, false)); | 540 waitable_event_for_testing_.reset(new base::WaitableEvent(false, false)); |
| 541 } | 541 } |
| 542 | 542 |
| 543 void V8SamplingProfiler::WaitSamplingEventForTesting() { | 543 void V8SamplingProfiler::WaitSamplingEventForTesting() { |
| 544 waitable_event_for_testing_->Wait(); | 544 waitable_event_for_testing_->Wait(); |
| 545 } | 545 } |
| 546 | 546 |
| 547 } // namespace blink | 547 } // namespace blink |
| OLD | NEW |