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

Side by Side Diff: content/app/content_main_runner.cc

Issue 2683913002: Enable startup tracing from command line flags in components/tracing (Closed)
Patch Set: Remove command line arg. Created 3 years, 10 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
« no previous file with comments | « content/app/android/library_loader_hooks.cc ('k') | content/browser/browser_main_loop.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/public/app/content_main_runner.h" 5 #include "content/public/app/content_main_runner.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 #include <string.h> 9 #include <string.h>
10 10
(...skipping 23 matching lines...) Expand all
34 #include "base/process/launch.h" 34 #include "base/process/launch.h"
35 #include "base/process/memory.h" 35 #include "base/process/memory.h"
36 #include "base/process/process.h" 36 #include "base/process/process.h"
37 #include "base/process/process_handle.h" 37 #include "base/process/process_handle.h"
38 #include "base/profiler/scoped_tracker.h" 38 #include "base/profiler/scoped_tracker.h"
39 #include "base/strings/string_number_conversions.h" 39 #include "base/strings/string_number_conversions.h"
40 #include "base/strings/string_util.h" 40 #include "base/strings/string_util.h"
41 #include "base/strings/stringprintf.h" 41 #include "base/strings/stringprintf.h"
42 #include "base/trace_event/trace_event.h" 42 #include "base/trace_event/trace_event.h"
43 #include "build/build_config.h" 43 #include "build/build_config.h"
44 #include "components/tracing/browser/trace_config_file.h" 44 #include "components/tracing/common/trace_startup.h"
45 #include "components/tracing/common/trace_to_console.h"
46 #include "components/tracing/common/tracing_switches.h"
47 #include "content/app/mojo/mojo_init.h" 45 #include "content/app/mojo/mojo_init.h"
48 #include "content/browser/browser_main.h" 46 #include "content/browser/browser_main.h"
49 #include "content/browser/renderer_host/render_process_host_impl.h" 47 #include "content/browser/renderer_host/render_process_host_impl.h"
50 #include "content/browser/utility_process_host_impl.h" 48 #include "content/browser/utility_process_host_impl.h"
51 #include "content/common/set_process_title.h" 49 #include "content/common/set_process_title.h"
52 #include "content/common/url_schemes.h" 50 #include "content/common/url_schemes.h"
53 #include "content/gpu/in_process_gpu_thread.h" 51 #include "content/gpu/in_process_gpu_thread.h"
54 #include "content/public/app/content_main.h" 52 #include "content/public/app/content_main.h"
55 #include "content/public/app/content_main_delegate.h" 53 #include "content/public/app/content_main_delegate.h"
56 #include "content/public/browser/content_browser_client.h" 54 #include "content/public/browser/content_browser_client.h"
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 #if defined(OS_WIN) 601 #if defined(OS_WIN)
604 // Route stdio to parent console (if any) or create one. 602 // Route stdio to parent console (if any) or create one.
605 if (command_line.HasSwitch(switches::kEnableLogging)) 603 if (command_line.HasSwitch(switches::kEnableLogging))
606 base::RouteStdioToConsole(true); 604 base::RouteStdioToConsole(true);
607 #endif 605 #endif
608 606
609 #if !defined(OS_ANDROID) 607 #if !defined(OS_ANDROID)
610 // Enable startup tracing asap to avoid early TRACE_EVENT calls being 608 // Enable startup tracing asap to avoid early TRACE_EVENT calls being
611 // ignored. For Android, startup tracing is enabled in an even earlier place 609 // ignored. For Android, startup tracing is enabled in an even earlier place
612 // content/app/android/library_loader_hooks.cc. 610 // content/app/android/library_loader_hooks.cc.
613 if (command_line.HasSwitch(switches::kTraceStartup)) { 611 // Zygote process does not have file thread and renderer process on Win10
614 base::trace_event::TraceConfig trace_config( 612 // cannot access the file system.
nasko 2017/02/15 19:18:58 Is that the real reason? Utility processes also do
ssid 2017/02/15 19:41:34 Um Then I would guess startup tracing does not wor
615 command_line.GetSwitchValueASCII(switches::kTraceStartup), 613 bool can_access_file_system = (process_type != switches::kZygoteProcess &&
616 base::trace_event::RECORD_UNTIL_FULL); 614 process_type != switches::kRendererProcess);
617 base::trace_event::TraceLog::GetInstance()->SetEnabled( 615 tracing::EnableStartupTracingIfNeeded(can_access_file_system);
618 trace_config,
619 base::trace_event::TraceLog::RECORDING_MODE);
620 } else if (command_line.HasSwitch(switches::kTraceToConsole)) {
621 base::trace_event::TraceConfig trace_config =
622 tracing::GetConfigForTraceToConsole();
623 LOG(ERROR) << "Start " << switches::kTraceToConsole
624 << " with CategoryFilter '"
625 << trace_config.ToCategoryFilterString() << "'.";
626 base::trace_event::TraceLog::GetInstance()->SetEnabled(
627 trace_config,
628 base::trace_event::TraceLog::RECORDING_MODE);
629 } else if (process_type != switches::kZygoteProcess &&
630 process_type != switches::kRendererProcess) {
631 if (tracing::TraceConfigFile::GetInstance()->IsEnabled()) {
632 // This checks kTraceConfigFile switch.
633 base::trace_event::TraceLog::GetInstance()->SetEnabled(
634 tracing::TraceConfigFile::GetInstance()->GetTraceConfig(),
635 base::trace_event::TraceLog::RECORDING_MODE);
636 }
637 }
638 #endif // !OS_ANDROID 616 #endif // !OS_ANDROID
639 617
640 #if defined(OS_WIN) 618 #if defined(OS_WIN)
641 // Enable exporting of events to ETW if requested on the command line. 619 // Enable exporting of events to ETW if requested on the command line.
642 if (command_line.HasSwitch(switches::kTraceExportEventsToETW)) 620 if (command_line.HasSwitch(switches::kTraceExportEventsToETW))
643 base::trace_event::TraceEventETWExport::EnableETWExport(); 621 base::trace_event::TraceEventETWExport::EnableETWExport();
644 #endif // OS_WIN 622 #endif // OS_WIN
645 623
646 #if !defined(OS_ANDROID) 624 #if !defined(OS_ANDROID)
647 // Android tracing started at the beginning of the method. 625 // Android tracing started at the beginning of the method.
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 851
874 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); 852 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl);
875 }; 853 };
876 854
877 // static 855 // static
878 ContentMainRunner* ContentMainRunner::Create() { 856 ContentMainRunner* ContentMainRunner::Create() {
879 return new ContentMainRunnerImpl(); 857 return new ContentMainRunnerImpl();
880 } 858 }
881 859
882 } // namespace content 860 } // namespace content
OLDNEW
« no previous file with comments | « content/app/android/library_loader_hooks.cc ('k') | content/browser/browser_main_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698