Skip to content

Commit

Permalink
[Tracing] Move tracing switches to components
Browse files Browse the repository at this point in the history
We plan to add --trace-config-file flag, which will be needed by components/tracing. This CL moves all existing tracing switches to components. And the next CL will add the --trace-config-file.

Design doc for Add --trace-config-file:
https://docs.google.com/document/d/1PgdXUOJF3WtEmYWUyGRbC2Fz2ICCZKO9jPvpLPRSHH8/edit?usp=sharing

BUG=482098,515323

Review URL: https://codereview.chromium.org/1300733004

Cr-Commit-Position: refs/heads/master@{#344079}
  • Loading branch information
wangzhen127 authored and Commit bot committed Aug 18, 2015
1 parent d9ae4bf commit ecedcf2
Show file tree
Hide file tree
Showing 30 changed files with 99 additions and 57 deletions.
1 change: 1 addition & 0 deletions chrome/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ source_set("browser") {
"//components/strings",
"//components/suggestions",
"//components/sync_driver",
"//components/tracing:startup_tracing",
"//components/translate/core/browser",
"//components/translate/core/common",
"//components/ui/zoom:ui_zoom",
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ include_rules = [
"+components/storage_monitor",
"+components/suggestions",
"+components/sync_driver",
"+components/tracing",
"+components/translate/content/browser",
"+components/translate/content/common",
"+components/translate/core/browser",
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/chrome_browser_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
#include "components/rappor/rappor_service.h"
#include "components/signin/core/common/profile_management_switches.h"
#include "components/startup_metric_utils/startup_metric_utils.h"
#include "components/tracing/tracing_switches.h"
#include "components/translate/content/browser/browser_cld_utils.h"
#include "components/translate/content/common/cld_data_source.h"
#include "components/translate/core/browser/translate_download_manager.h"
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/lifetime/application_lifetime.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "components/tracing/tracing_switches.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/navigation_details.h"
#include "content/public/browser/notification_service.h"
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/tracing/crash_service_uploader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/time/time.h"
#include "components/tracing/tracing_switches.h"
#include "components/version_info/version_info.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/common/content_switches.h"
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/tracing/navigation_tracing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/tracing/crash_service_uploader.h"
#include "chrome/common/chrome_switches.h"
#include "components/tracing/tracing_switches.h"
#include "content/public/browser/background_tracing_manager.h"
#include "content/public/browser/background_tracing_reactive_config.h"
#include "content/public/browser/browser_thread.h"
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/ui/tab_helpers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include "components/history/content/browser/web_contents_top_sites_observer.h"
#include "components/history/core/browser/top_sites.h"
#include "components/password_manager/core/browser/password_manager.h"
#include "components/tracing/tracing_switches.h"
#include "content/public/browser/web_contents.h"

#if defined(OS_ANDROID)
Expand Down
3 changes: 2 additions & 1 deletion chrome/chrome_browser.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -3178,6 +3178,7 @@
'../components/components.gyp:webdata_common',
'../components/components.gyp:webdata_services',
'../components/mime_util/mime_util.gyp:mime_util',
'../components/tracing.gyp:tracing',
'../components/url_formatter/url_formatter.gyp:url_formatter',
'../content/content.gyp:content_browser',
'../content/content.gyp:content_common',
Expand Down Expand Up @@ -3260,7 +3261,7 @@
'../components/components.gyp:translate_content_browser',
'../components/components.gyp:upload_list',
'../components/components.gyp:url_matcher',
'../components/components.gyp:user_prefs_tracked',
'../components/components.gyp:user_prefs_tracked',
'../components/components.gyp:visitedlink_browser',
'../components/components.gyp:visitedlink_common',
'../components/components.gyp:web_cache_browser',
Expand Down
4 changes: 3 additions & 1 deletion components/tracing.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@
'tracing/child_memory_dump_manager_delegate_impl.h',
'tracing/child_trace_message_filter.cc',
'tracing/child_trace_message_filter.h',
'tracing/tracing_export.h',
'tracing/startup_tracing.cc',
'tracing/startup_tracing.h',
'tracing/tracing_export.h',
'tracing/tracing_messages.cc',
'tracing/tracing_messages.h',
'tracing/tracing_switches.cc',
'tracing/tracing_switches.h',
],
},
],
Expand Down
2 changes: 2 additions & 0 deletions components/tracing/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ component("startup_tracing") {
"startup_tracing.cc",
"startup_tracing.h",
"tracing_export.h",
"tracing_switches.cc",
"tracing_switches.h",
]

defines = [ "TRACING_IMPLEMENTATION" ]
Expand Down
48 changes: 48 additions & 0 deletions components/tracing/tracing_switches.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/tracing/tracing_switches.h"

namespace switches {

// Causes TRACE_EVENT flags to be recorded beginning with shutdown. Optionally,
// can specify the specific trace categories to include (e.g.
// --trace-shutdown=base,net) otherwise, all events are recorded.
// --trace-shutdown-file can be used to control where the trace log gets stored
// to since there is otherwise no way to access the result.
const char kTraceShutdown[] = "trace-shutdown";

// If supplied, sets the file which shutdown tracing will be stored into, if
// omitted the default will be used "chrometrace.log" in the current directory.
// Has no effect unless --trace-shutdown is also supplied.
// Example: --trace-shutdown --trace-shutdown-file=/tmp/trace_event.log
const char kTraceShutdownFile[] = "trace-shutdown-file";

// Causes TRACE_EVENT flags to be recorded from startup. Optionally, can
// specify the specific trace categories to include (e.g.
// --trace-startup=base,net) otherwise, all events are recorded. Setting this
// flag results in the first call to BeginTracing() to receive all trace events
// since startup. In Chrome, you may find --trace-startup-file and
// --trace-startup-duration to control the auto-saving of the trace (not
// supported in the base-only TraceLog component).
const char kTraceStartup[] = "trace-startup";

// Sets the time in seconds until startup tracing ends. If omitted a default of
// 5 seconds is used. Has no effect without --trace-startup, or if
// --startup-trace-file=none was supplied.
const char kTraceStartupDuration[] = "trace-startup-duration";

// If supplied, sets the file which startup tracing will be stored into, if
// omitted the default will be used "chrometrace.log" in the current directory.
// Has no effect unless --trace-startup is also supplied.
// Example: --trace-startup --trace-startup-file=/tmp/trace_event.log
// As a special case, can be set to 'none' - this disables automatically saving
// the result to a file and the first manually recorded trace will then receive
// all events since startup.
const char kTraceStartupFile[] = "trace-startup-file";

// Sets the target URL for uploading tracing data.
const char kTraceUploadURL[] = "trace-upload-url";

} // namespace switches
21 changes: 21 additions & 0 deletions components/tracing/tracing_switches.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_TRACING_TRACING_SWITCHES_H_
#define COMPONENTS_TRACING_TRACING_SWITCHES_H_

#include "components/tracing/tracing_export.h"

namespace switches {

TRACING_EXPORT extern const char kTraceShutdown[];
TRACING_EXPORT extern const char kTraceShutdownFile[];
TRACING_EXPORT extern const char kTraceStartup[];
TRACING_EXPORT extern const char kTraceStartupDuration[];
TRACING_EXPORT extern const char kTraceStartupFile[];
TRACING_EXPORT extern const char kTraceUploadURL[];

} // namespace switches

#endif // COMPONENTS_TRACING_TRACING_SWITCHES_H_
3 changes: 3 additions & 0 deletions components/tracing_nacl.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,11 @@
'tracing/child_trace_message_filter.h',
'tracing/startup_tracing.cc',
'tracing/startup_tracing.h',
'tracing/tracing_export.h',
'tracing/tracing_messages.cc',
'tracing/tracing_messages.h',
'tracing/tracing_switches.cc',
'tracing/tracing_switches.h',
],
},
],
Expand Down
2 changes: 1 addition & 1 deletion content/app/DEPS
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
include_rules = [
"+components/tracing/startup_tracing.h",
"+components/tracing",
"+content",
"+device/battery",
"+device/bluetooth",
Expand Down
1 change: 1 addition & 0 deletions content/app/android/library_loader_hooks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "base/trace_event/trace_event.h"
#include "base/tracked_objects.h"
#include "components/tracing/startup_tracing.h"
#include "components/tracing/tracing_switches.h"
#include "content/app/android/app_jni_registrar.h"
#include "content/browser/android/browser_jni_registrar.h"
#include "content/common/android/common_jni_registrar.h"
Expand Down
1 change: 1 addition & 0 deletions content/app/content_main_runner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "base/strings/stringprintf.h"
#include "base/trace_event/trace_event.h"
#include "components/tracing/startup_tracing.h"
#include "components/tracing/tracing_switches.h"
#include "content/browser/browser_main.h"
#include "content/common/set_process_title.h"
#include "content/common/url_schemes.h"
Expand Down
1 change: 1 addition & 0 deletions content/browser/browser_main_loop.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "base/timer/hi_res_timer_manager.h"
#include "base/trace_event/memory_dump_manager.h"
#include "base/trace_event/trace_event.h"
#include "components/tracing/tracing_switches.h"
#include "content/browser/browser_thread_impl.h"
#include "content/browser/device_sensors/device_inertial_sensor_service.h"
#include "content/browser/dom_storage/dom_storage_area.h"
Expand Down
1 change: 1 addition & 0 deletions content/browser/browser_main_runner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "base/profiler/scoped_tracker.h"
#include "base/trace_event/trace_event.h"
#include "base/tracked_objects.h"
#include "components/tracing/tracing_switches.h"
#include "content/browser/browser_main_loop.h"
#include "content/browser/browser_shutdown_profile_dumper.h"
#include "content/browser/notification_service_impl.h"
Expand Down
3 changes: 1 addition & 2 deletions content/browser/browser_shutdown_profile_dumper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#include "content/browser/browser_shutdown_profile_dumper.h"

#include "base/base_switches.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
Expand All @@ -16,7 +15,7 @@
#include "base/threading/thread_restrictions.h"
#include "base/trace_event/trace_event.h"
#include "base/trace_event/trace_event_impl.h"
#include "content/public/common/content_switches.h"
#include "components/tracing/tracing_switches.h"

namespace content {

Expand Down
1 change: 1 addition & 0 deletions content/browser/gpu/gpu_process_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "base/sha1.h"
#include "base/threading/thread.h"
#include "base/trace_event/trace_event.h"
#include "components/tracing/tracing_switches.h"
#include "content/browser/browser_child_process_host_impl.h"
#include "content/browser/gpu/compositor_util.h"
#include "content/browser/gpu/gpu_data_manager_impl.h"
Expand Down
1 change: 1 addition & 0 deletions content/browser/plugin_process_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/synchronization/lock.h"
#include "components/tracing/tracing_switches.h"
#include "content/browser/browser_child_process_host_impl.h"
#include "content/browser/gpu/gpu_data_manager_impl.h"
#include "content/browser/loader/resource_message_filter.h"
Expand Down
1 change: 1 addition & 0 deletions content/browser/renderer_host/render_process_host_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "base/trace_event/trace_event.h"
#include "base/tracked_objects.h"
#include "cc/base/switches.h"
#include "components/tracing/tracing_switches.h"
#include "content/browser/appcache/appcache_dispatcher_host.h"
#include "content/browser/appcache/chrome_appcache_service.h"
#include "content/browser/background_sync/background_sync_service_impl.h"
Expand Down
40 changes: 0 additions & 40 deletions content/public/common/content_switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -804,46 +804,6 @@ const char kTestType[] = "test-type";
// the platform default is used.
const char kTouchTextSelectionStrategy[] = "touch-selection-strategy";

// Causes TRACE_EVENT flags to be recorded beginning with shutdown. Optionally,
// can specify the specific trace categories to include (e.g.
// --trace-shutdown=base,net) otherwise, all events are recorded.
// --trace-shutdown-file can be used to control where the trace log gets stored
// to since there is otherwise no way to access the result.
const char kTraceShutdown[] = "trace-shutdown";

// If supplied, sets the file which shutdown tracing will be stored into, if
// omitted the default will be used "chrometrace.log" in the current directory.
// Has no effect unless --trace-shutdown is also supplied.
// Example: --trace-shutdown --trace-shutdown-file=/tmp/trace_event.log
const char kTraceShutdownFile[] = "trace-shutdown-file";

// Causes TRACE_EVENT flags to be recorded from startup. Optionally, can
// specify the specific trace categories to include (e.g.
// --trace-startup=base,net) otherwise, all events are recorded. Setting this
// flag results in the first call to BeginTracing() to receive all trace events
// since startup. In Chrome, you may find --trace-startup-file and
// --trace-startup-duration to control the auto-saving of the trace (not
// supported in the base-only TraceLog component).
const char kTraceStartup[] = "trace-startup";

// Sets the time in seconds until startup tracing ends. If omitted a default of
// 5 seconds is used. Has no effect without --trace-startup, or if
// --startup-trace-file=none was supplied.
const char kTraceStartupDuration[] = "trace-startup-duration";

// If supplied, sets the file which startup tracing will be stored into, if
// omitted the default will be used "chrometrace.log" in the current directory.
// Has no effect unless --trace-startup is also supplied.
// Example: --trace-startup --trace-startup-file=/tmp/trace_event.log
// As a special case, can be set to 'none' - this disables automatically saving
// the result to a file and the first manually recorded trace will then receive
// all events since startup.
const char kTraceStartupFile[] = "trace-startup-file";

// Sets the target URL for uploading tracing data.
const char kTraceUploadURL[] = "trace-upload-url";


// Prioritizes the UI's command stream in the GPU process
extern const char kUIPrioritizeInGpuProcess[] =
"ui-prioritize-in-gpu-process";
Expand Down
6 changes: 0 additions & 6 deletions content/public/common/content_switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,6 @@ CONTENT_EXPORT extern const char kTestingFixedHttpPort[];
CONTENT_EXPORT extern const char kTestingFixedHttpsPort[];
CONTENT_EXPORT extern const char kTestType[];
CONTENT_EXPORT extern const char kTouchTextSelectionStrategy[];
CONTENT_EXPORT extern const char kTraceShutdown[];
extern const char kTraceShutdownFile[];
extern const char kTraceStartup[];
extern const char kTraceStartupDuration[];
extern const char kTraceStartupFile[];
CONTENT_EXPORT extern const char kTraceUploadURL[];
CONTENT_EXPORT extern const char kUIPrioritizeInGpuProcess[];
CONTENT_EXPORT extern const char kUseFakeUIForMediaStream[];
CONTENT_EXPORT extern const char kEnableNativeGpuMemoryBuffers[];
Expand Down
1 change: 1 addition & 0 deletions mandoline/app/desktop/DEPS
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
include_rules = [
"+components/tracing",
"+sandbox",
]
1 change: 1 addition & 0 deletions mandoline/app/desktop/launcher_process.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "base/synchronization/waitable_event.h"
#include "base/trace_event/trace_event.h"
#include "components/tracing/startup_tracing.h"
#include "components/tracing/tracing_switches.h"
#include "mandoline/app/core_services_initialization.h"
#include "mandoline/app/desktop/launcher_process.h"
#include "mojo/runner/context.h"
Expand Down
2 changes: 1 addition & 1 deletion mojo/runner/DEPS
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include_rules = [
"+components/devtools_service/public",
"+components/tracing/startup_tracing.h",
"+components/tracing",
"+components/view_manager",
"+components/view_manager/gles2",
"+components/view_manager/native_viewport",
Expand Down
1 change: 1 addition & 0 deletions mojo/runner/desktop/launcher_process.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "base/synchronization/waitable_event.h"
#include "base/trace_event/trace_event.h"
#include "components/tracing/startup_tracing.h"
#include "components/tracing/tracing_switches.h"
#include "mojo/runner/context.h"
#include "mojo/runner/switches.h"

Expand Down
4 changes: 0 additions & 4 deletions mojo/runner/switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ const char kHelp[] = "help";
// Can be used multiple times.
const char kMapOrigin[] = "map-origin";

// Starts tracing when the shell starts up, saving a trace file on disk after 5
// seconds or when the shell exits.
const char kTraceStartup[] = "trace-startup";

// Specifies a set of mappings to apply when resolving URLs. The value is a set
// of comma-separated mappings, where each mapping consists of a pair of URLs
// giving the to/from URLs to map. For example, 'a=b,c=d' contains two mappings,
Expand Down
1 change: 0 additions & 1 deletion mojo/runner/switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ extern const char kEnableSandbox[];
extern const char kForceInProcess[];
extern const char kHelp[];
extern const char kMapOrigin[];
extern const char kTraceStartup[];
extern const char kURLMappings[];
extern const char kUseTemporaryUserDataDir[];
extern const char kUserDataDir[];
Expand Down

0 comments on commit ecedcf2

Please sign in to comment.