Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(235)

Side by Side Diff: content/renderer/devtools/v8_sampling_profiler.cc

Issue 1165673002: [Startup Tracing] Hook up TraceConfig and remove CategoryFilter & TraceOptions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 bool enabled; 592 bool enabled;
593 TRACE_EVENT_CATEGORY_GROUP_ENABLED( 593 TRACE_EVENT_CATEGORY_GROUP_ENABLED(
594 TRACE_DISABLED_BY_DEFAULT("v8.cpu_profile"), &enabled); 594 TRACE_DISABLED_BY_DEFAULT("v8.cpu_profile"), &enabled);
595 if (!enabled) 595 if (!enabled)
596 return; 596 return;
597 597
598 // Do not enable sampling profiler in continuous mode, as losing 598 // Do not enable sampling profiler in continuous mode, as losing
599 // Jit code events may not be afforded. 599 // Jit code events may not be afforded.
600 // TODO(alph): add support of infinite recording of meta trace events. 600 // TODO(alph): add support of infinite recording of meta trace events.
601 base::trace_event::TraceRecordMode record_mode = 601 base::trace_event::TraceRecordMode record_mode =
602 TraceLog::GetInstance()->GetCurrentTraceOptions().record_mode; 602 TraceLog::GetInstance()->GetCurrentTraceConfig().GetTraceRecordMode();
603 if (record_mode == base::trace_event::TraceRecordMode::RECORD_CONTINUOUSLY) 603 if (record_mode == base::trace_event::TraceRecordMode::RECORD_CONTINUOUSLY)
604 return; 604 return;
605 605
606 task_runner_->PostTask(FROM_HERE, 606 task_runner_->PostTask(FROM_HERE,
607 base::Bind(&V8SamplingProfiler::StartSamplingThread, 607 base::Bind(&V8SamplingProfiler::StartSamplingThread,
608 base::Unretained(this))); 608 base::Unretained(this)));
609 } 609 }
610 610
611 void V8SamplingProfiler::OnTraceLogDisabled() { 611 void V8SamplingProfiler::OnTraceLogDisabled() {
612 if (!sampling_thread_.get()) 612 if (!sampling_thread_.get())
613 return; 613 return;
614 sampling_thread_->Stop(); 614 sampling_thread_->Stop();
615 sampling_thread_.reset(); 615 sampling_thread_.reset();
616 } 616 }
617 617
618 void V8SamplingProfiler::EnableSamplingEventForTesting(int code_added_events, 618 void V8SamplingProfiler::EnableSamplingEventForTesting(int code_added_events,
619 int sample_events) { 619 int sample_events) {
620 render_thread_sampler_->SetEventsToCollectForTest(code_added_events, 620 render_thread_sampler_->SetEventsToCollectForTest(code_added_events,
621 sample_events); 621 sample_events);
622 waitable_event_for_testing_.reset(new base::WaitableEvent(false, false)); 622 waitable_event_for_testing_.reset(new base::WaitableEvent(false, false));
623 } 623 }
624 624
625 void V8SamplingProfiler::WaitSamplingEventForTesting() { 625 void V8SamplingProfiler::WaitSamplingEventForTesting() {
626 waitable_event_for_testing_->Wait(); 626 waitable_event_for_testing_->Wait();
627 } 627 }
628 628
629 } // namespace blink 629 } // namespace blink
OLDNEW
« no previous file with comments | « content/renderer/devtools/devtools_agent.cc ('k') | content/renderer/devtools/v8_sampling_profiler_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698