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 #include "base/synchronization/cancellation_flag.h" | 7 #include "base/synchronization/cancellation_flag.h" |
8 #include "base/threading/platform_thread.h" | 8 #include "base/threading/platform_thread.h" |
9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
10 | 10 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 } | 50 } |
51 } | 51 } |
52 | 52 |
53 void V8SamplingThread::Stop() { | 53 void V8SamplingThread::Stop() { |
54 cancellation_flag_.Set(); | 54 cancellation_flag_.Set(); |
55 base::PlatformThread::Join(sampling_thread_handle_); | 55 base::PlatformThread::Join(sampling_thread_handle_); |
56 } | 56 } |
57 | 57 |
58 V8SamplingProfiler::V8SamplingProfiler() : sampling_thread_(nullptr) { | 58 V8SamplingProfiler::V8SamplingProfiler() : sampling_thread_(nullptr) { |
59 // Force the "v8_cpu_profile" category to show up in the trace viewer. | 59 // Force the "v8_cpu_profile" category to show up in the trace viewer. |
60 base::debug::TraceLog::GetCategoryGroupEnabled( | 60 base::trace_event::TraceLog::GetCategoryGroupEnabled( |
61 TRACE_DISABLED_BY_DEFAULT("v8_cpu_profile")); | 61 TRACE_DISABLED_BY_DEFAULT("v8_cpu_profile")); |
62 base::debug::TraceLog::GetInstance()->AddEnabledStateObserver(this); | 62 base::trace_event::TraceLog::GetInstance()->AddEnabledStateObserver(this); |
63 } | 63 } |
64 | 64 |
65 V8SamplingProfiler::~V8SamplingProfiler() { | 65 V8SamplingProfiler::~V8SamplingProfiler() { |
66 base::debug::TraceLog::GetInstance()->RemoveEnabledStateObserver(this); | 66 base::trace_event::TraceLog::GetInstance()->RemoveEnabledStateObserver(this); |
67 DCHECK(!sampling_thread_.get()); | 67 DCHECK(!sampling_thread_.get()); |
68 } | 68 } |
69 | 69 |
70 void V8SamplingProfiler::OnTraceLogEnabled() { | 70 void V8SamplingProfiler::OnTraceLogEnabled() { |
71 bool enabled; | 71 bool enabled; |
72 TRACE_EVENT_CATEGORY_GROUP_ENABLED( | 72 TRACE_EVENT_CATEGORY_GROUP_ENABLED( |
73 TRACE_DISABLED_BY_DEFAULT("v8_cpu_profile"), &enabled); | 73 TRACE_DISABLED_BY_DEFAULT("v8_cpu_profile"), &enabled); |
74 if (!enabled) | 74 if (!enabled) |
75 return; | 75 return; |
76 DCHECK(!sampling_thread_.get()); | 76 DCHECK(!sampling_thread_.get()); |
(...skipping 11 matching lines...) Expand all Loading... |
88 | 88 |
89 void V8SamplingProfiler::EnableSamplingEventForTesting() { | 89 void V8SamplingProfiler::EnableSamplingEventForTesting() { |
90 waitable_event_for_testing_.reset(new base::WaitableEvent(false, false)); | 90 waitable_event_for_testing_.reset(new base::WaitableEvent(false, false)); |
91 } | 91 } |
92 | 92 |
93 void V8SamplingProfiler::WaitSamplingEventForTesting() { | 93 void V8SamplingProfiler::WaitSamplingEventForTesting() { |
94 waitable_event_for_testing_->Wait(); | 94 waitable_event_for_testing_->Wait(); |
95 } | 95 } |
96 | 96 |
97 } // namespace blink | 97 } // namespace blink |
OLD | NEW |