| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include <cstdlib> | 8 #include <cstdlib> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 #else | 783 #else |
| 784 #define MAYBE_DestroyProfilerWhileProfiling \ | 784 #define MAYBE_DestroyProfilerWhileProfiling \ |
| 785 DISABLED_DestroyProfilerWhileProfiling | 785 DISABLED_DestroyProfilerWhileProfiling |
| 786 #endif | 786 #endif |
| 787 TEST(StackSamplingProfilerTest, MAYBE_DestroyProfilerWhileProfiling) { | 787 TEST(StackSamplingProfilerTest, MAYBE_DestroyProfilerWhileProfiling) { |
| 788 SamplingParams params; | 788 SamplingParams params; |
| 789 params.sampling_interval = TimeDelta::FromMilliseconds(10); | 789 params.sampling_interval = TimeDelta::FromMilliseconds(10); |
| 790 | 790 |
| 791 CallStackProfiles profiles; | 791 CallStackProfiles profiles; |
| 792 WithTargetThread([¶ms, &profiles](PlatformThreadId target_thread_id) { | 792 WithTargetThread([¶ms, &profiles](PlatformThreadId target_thread_id) { |
| 793 scoped_ptr<StackSamplingProfiler> profiler; | 793 std::unique_ptr<StackSamplingProfiler> profiler; |
| 794 profiler.reset(new StackSamplingProfiler( | 794 profiler.reset(new StackSamplingProfiler( |
| 795 target_thread_id, params, Bind(&SaveProfiles, Unretained(&profiles)))); | 795 target_thread_id, params, Bind(&SaveProfiles, Unretained(&profiles)))); |
| 796 profiler->Start(); | 796 profiler->Start(); |
| 797 profiler.reset(); | 797 profiler.reset(); |
| 798 | 798 |
| 799 // Wait longer than a sample interval to catch any use-after-free actions by | 799 // Wait longer than a sample interval to catch any use-after-free actions by |
| 800 // the profiler thread. | 800 // the profiler thread. |
| 801 PlatformThread::Sleep(TimeDelta::FromMilliseconds(50)); | 801 PlatformThread::Sleep(TimeDelta::FromMilliseconds(50)); |
| 802 }); | 802 }); |
| 803 } | 803 } |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 957 #if defined(STACK_SAMPLING_PROFILER_SUPPORTED) | 957 #if defined(STACK_SAMPLING_PROFILER_SUPPORTED) |
| 958 #define MAYBE_UnloadedLibrary UnloadedLibrary | 958 #define MAYBE_UnloadedLibrary UnloadedLibrary |
| 959 #else | 959 #else |
| 960 #define MAYBE_UnloadedLibrary DISABLED_UnloadedLibrary | 960 #define MAYBE_UnloadedLibrary DISABLED_UnloadedLibrary |
| 961 #endif | 961 #endif |
| 962 TEST(StackSamplingProfilerTest, MAYBE_UnloadedLibrary) { | 962 TEST(StackSamplingProfilerTest, MAYBE_UnloadedLibrary) { |
| 963 TestLibraryUnload(true); | 963 TestLibraryUnload(true); |
| 964 } | 964 } |
| 965 | 965 |
| 966 } // namespace base | 966 } // namespace base |
| OLD | NEW |