summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgunsch <gunsch@chromium.org>2014-09-18 12:38:06 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-18 19:38:23 +0000
commit840bc4163159ba58413ffa9658e888b1336851fe (patch)
tree12e530e6cb1eaa8e0e40851f8e1bc647a40dd7cb
parent458c86efe592bf8eeaa21cd3e9fb9fc211789d3b (diff)
downloadchromium_src-840bc4163159ba58413ffa9658e888b1336851fe.zip
chromium_src-840bc4163159ba58413ffa9658e888b1336851fe.tar.gz
chromium_src-840bc4163159ba58413ffa9658e888b1336851fe.tar.bz2
Moves ProfilerMetricsProvider to //components/metrics.
R=asvitkine@chromium.org,isherman@chromium.org, BUG=404791 Review URL: https://codereview.chromium.org/577823002 Cr-Commit-Position: refs/heads/master@{#295527}
-rw-r--r--chrome/browser/BUILD.gn1
-rw-r--r--chrome/browser/chrome_browser_main.cc4
-rw-r--r--chrome/browser/chrome_browser_main.h5
-rw-r--r--chrome/browser/metrics/chrome_metrics_service_client.cc8
-rw-r--r--chrome/browser/metrics/chrome_metrics_service_client.h8
-rw-r--r--chrome/browser/ui/webui/profiler_ui.cc4
-rw-r--r--chrome/browser/ui/webui/profiler_ui.h4
-rw-r--r--chrome/chrome_browser.gypi6
-rw-r--r--chrome/chrome_tests_unit.gypi1
-rw-r--r--components/components_tests.gyp2
-rw-r--r--components/metrics.gypi20
-rw-r--r--components/metrics/BUILD.gn19
-rw-r--r--components/metrics/profiler/DEPS5
-rw-r--r--components/metrics/profiler/profiler_metrics_provider.cc (renamed from chrome/browser/metrics/profiler_metrics_provider.cc)17
-rw-r--r--components/metrics/profiler/profiler_metrics_provider.h (renamed from chrome/browser/metrics/profiler_metrics_provider.h)18
-rw-r--r--components/metrics/profiler/profiler_metrics_provider_unittest.cc (renamed from chrome/browser/metrics/profiler_metrics_provider_unittest.cc)46
-rw-r--r--components/metrics/profiler/tracking_synchronizer.cc (renamed from chrome/browser/metrics/tracking_synchronizer.cc)10
-rw-r--r--components/metrics/profiler/tracking_synchronizer.h (renamed from chrome/browser/metrics/tracking_synchronizer.h)10
-rw-r--r--components/metrics/profiler/tracking_synchronizer_observer.h (renamed from chrome/browser/metrics/tracking_synchronizer_observer.h)10
19 files changed, 124 insertions, 74 deletions
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
index 2c17f10..094bf2a 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -68,6 +68,7 @@ static_library("browser") {
"//components/invalidation",
"//components/metrics:gpu",
"//components/metrics:net",
+ "//components/metrics:profiler",
"//components/metrics/proto:proto",
"//components/native_app_window",
"//components/navigation_metrics",
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc
index bfff171..99a8d96 100644
--- a/chrome/browser/chrome_browser_main.cc
+++ b/chrome/browser/chrome_browser_main.cc
@@ -57,7 +57,6 @@
#include "chrome/browser/media/media_capture_devices_dispatcher.h"
#include "chrome/browser/metrics/field_trial_synchronizer.h"
#include "chrome/browser/metrics/thread_watcher.h"
-#include "chrome/browser/metrics/tracking_synchronizer.h"
#include "chrome/browser/metrics/variations/variations_service.h"
#include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h"
#include "chrome/browser/net/chrome_net_log.h"
@@ -104,6 +103,7 @@
#include "components/google/core/browser/google_util.h"
#include "components/language_usage_metrics/language_usage_metrics.h"
#include "components/metrics/metrics_service.h"
+#include "components/metrics/profiler/tracking_synchronizer.h"
#include "components/nacl/browser/nacl_browser.h"
#include "components/rappor/rappor_service.h"
#include "components/signin/core/common/profile_management_switches.h"
@@ -955,7 +955,7 @@ int ChromeBrowserMainParts::PreCreateThreadsImpl() {
#endif
// Initialize tracking synchronizer system.
- tracking_synchronizer_ = new chrome_browser_metrics::TrackingSynchronizer();
+ tracking_synchronizer_ = new metrics::TrackingSynchronizer();
#if defined(OS_MACOSX)
// Get the Keychain API to register for distributed notifications on the main
diff --git a/chrome/browser/chrome_browser_main.h b/chrome/browser/chrome_browser_main.h
index e62f0ef..7b015b0 100644
--- a/chrome/browser/chrome_browser_main.h
+++ b/chrome/browser/chrome_browser_main.h
@@ -41,7 +41,7 @@ extern const char kMissingLocaleDataMessage[];
#endif
}
-namespace chrome_browser_metrics {
+namespace metrics {
class TrackingSynchronizer;
}
@@ -154,8 +154,7 @@ class ChromeBrowserMainParts : public content::BrowserMainParts {
// Members initialized after / released before main_message_loop_ ------------
scoped_ptr<BrowserProcessImpl> browser_process_;
- scoped_refptr<chrome_browser_metrics::TrackingSynchronizer>
- tracking_synchronizer_;
+ scoped_refptr<metrics::TrackingSynchronizer> tracking_synchronizer_;
#if !defined(OS_ANDROID)
// Browser creation happens on the Java side in Android.
scoped_ptr<StartupBrowserCreator> browser_creator_;
diff --git a/chrome/browser/metrics/chrome_metrics_service_client.cc b/chrome/browser/metrics/chrome_metrics_service_client.cc
index 920363d..ab22900 100644
--- a/chrome/browser/metrics/chrome_metrics_service_client.cc
+++ b/chrome/browser/metrics/chrome_metrics_service_client.cc
@@ -23,8 +23,6 @@
#include "chrome/browser/google/google_brand.h"
#include "chrome/browser/metrics/chrome_stability_metrics_provider.h"
#include "chrome/browser/metrics/omnibox_metrics_provider.h"
-#include "chrome/browser/metrics/profiler_metrics_provider.h"
-#include "chrome/browser/metrics/tracking_synchronizer.h"
#include "chrome/browser/ui/browser_otr_state.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
@@ -36,6 +34,8 @@
#include "components/metrics/metrics_service.h"
#include "components/metrics/net/net_metrics_log_uploader.h"
#include "components/metrics/net/network_metrics_provider.h"
+#include "components/metrics/profiler/profiler_metrics_provider.h"
+#include "components/metrics/profiler/tracking_synchronizer.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/histogram_fetcher.h"
#include "content/public/browser/notification_service.h"
@@ -308,7 +308,7 @@ void ChromeMetricsServiceClient::Initialize() {
scoped_ptr<metrics::MetricsProvider>(new ChromeStabilityMetricsProvider));
metrics_service_->RegisterMetricsProvider(
scoped_ptr<metrics::MetricsProvider>(new metrics::GPUMetricsProvider()));
- profiler_metrics_provider_ = new ProfilerMetricsProvider;
+ profiler_metrics_provider_ = new metrics::ProfilerMetricsProvider;
metrics_service_->RegisterMetricsProvider(
scoped_ptr<metrics::MetricsProvider>(profiler_metrics_provider_));
@@ -374,7 +374,7 @@ void ChromeMetricsServiceClient::OnInitTaskGotPluginInfo() {
void ChromeMetricsServiceClient::OnInitTaskGotGoogleUpdateData() {
// Start the next part of the init task: fetching performance data. This will
// call into |FinishedReceivingProfilerData()| when the task completes.
- chrome_browser_metrics::TrackingSynchronizer::FetchProfilerDataAsynchronously(
+ metrics::TrackingSynchronizer::FetchProfilerDataAsynchronously(
weak_ptr_factory_.GetWeakPtr());
}
diff --git a/chrome/browser/metrics/chrome_metrics_service_client.h b/chrome/browser/metrics/chrome_metrics_service_client.h
index 230b7b3..1cb9f45 100644
--- a/chrome/browser/metrics/chrome_metrics_service_client.h
+++ b/chrome/browser/metrics/chrome_metrics_service_client.h
@@ -14,8 +14,8 @@
#include "base/threading/thread_checker.h"
#include "chrome/browser/memory_details.h"
#include "chrome/browser/metrics/network_stats_uploader.h"
-#include "chrome/browser/metrics/tracking_synchronizer_observer.h"
#include "components/metrics/metrics_service_client.h"
+#include "components/metrics/profiler/tracking_synchronizer_observer.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -23,7 +23,6 @@ class ChromeOSMetricsProvider;
class GoogleUpdateMetricsProviderWin;
class PluginMetricsProvider;
class PrefRegistrySimple;
-class ProfilerMetricsProvider;
#if !defined(OS_CHROMEOS) && !defined(OS_IOS)
class SigninStatusMetricsProvider;
@@ -36,13 +35,14 @@ class FilePath;
namespace metrics {
class MetricsService;
class MetricsStateManager;
+class ProfilerMetricsProvider;
}
// ChromeMetricsServiceClient provides an implementation of MetricsServiceClient
// that depends on chrome/.
class ChromeMetricsServiceClient
: public metrics::MetricsServiceClient,
- public chrome_browser_metrics::TrackingSynchronizerObserver,
+ public metrics::TrackingSynchronizerObserver,
public content::NotificationObserver {
public:
virtual ~ChromeMetricsServiceClient();
@@ -153,7 +153,7 @@ class ChromeMetricsServiceClient
// The ProfilerMetricsProvider instance that was registered with
// MetricsService. Has the same lifetime as |metrics_service_|.
- ProfilerMetricsProvider* profiler_metrics_provider_;
+ metrics::ProfilerMetricsProvider* profiler_metrics_provider_;
#if defined(ENABLE_PLUGINS)
// The PluginMetricsProvider instance that was registered with
diff --git a/chrome/browser/ui/webui/profiler_ui.cc b/chrome/browser/ui/webui/profiler_ui.cc
index 9c137de..3e39517 100644
--- a/chrome/browser/ui/webui/profiler_ui.cc
+++ b/chrome/browser/ui/webui/profiler_ui.cc
@@ -18,10 +18,10 @@
#include "base/strings/string_util.h"
#include "base/tracked_objects.h"
#include "base/values.h"
-#include "chrome/browser/metrics/tracking_synchronizer.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/task_profiler/task_profiler_data_serializer.h"
#include "chrome/common/url_constants.h"
+#include "components/metrics/profiler/tracking_synchronizer.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/url_data_source.h"
#include "content/public/browser/web_contents.h"
@@ -37,10 +37,10 @@
#include "base/path_service.h"
#endif // USE_SOURCE_FILES_DIRECTLY
-using chrome_browser_metrics::TrackingSynchronizer;
using content::BrowserThread;
using content::WebContents;
using content::WebUIMessageHandler;
+using metrics::TrackingSynchronizer;
namespace {
diff --git a/chrome/browser/ui/webui/profiler_ui.h b/chrome/browser/ui/webui/profiler_ui.h
index 2142ba0..593316e 100644
--- a/chrome/browser/ui/webui/profiler_ui.h
+++ b/chrome/browser/ui/webui/profiler_ui.h
@@ -6,12 +6,12 @@
#define CHROME_BROWSER_UI_WEBUI_PROFILER_UI_H_
#include "base/memory/weak_ptr.h"
-#include "chrome/browser/metrics/tracking_synchronizer_observer.h"
+#include "components/metrics/profiler/tracking_synchronizer_observer.h"
#include "content/public/browser/web_ui_controller.h"
// The C++ back-end for the chrome://profiler webui page.
class ProfilerUI : public content::WebUIController,
- public chrome_browser_metrics::TrackingSynchronizerObserver {
+ public metrics::TrackingSynchronizerObserver {
public:
explicit ProfilerUI(content::WebUI* web_ui);
virtual ~ProfilerUI();
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index a0cb3cb..dd37bc3 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -685,8 +685,6 @@
'browser/metrics/omnibox_metrics_provider.h',
'browser/metrics/perf_provider_chromeos.cc',
'browser/metrics/perf_provider_chromeos.h',
- 'browser/metrics/profiler_metrics_provider.cc',
- 'browser/metrics/profiler_metrics_provider.h',
'browser/metrics/rappor/sampling.cc',
'browser/metrics/rappor/sampling.h',
'browser/metrics/signin_status_metrics_provider.cc',
@@ -697,9 +695,6 @@
'browser/metrics/thread_watcher_android.h',
'browser/metrics/time_ticks_experiment_win.cc',
'browser/metrics/time_ticks_experiment_win.h',
- 'browser/metrics/tracking_synchronizer.cc',
- 'browser/metrics/tracking_synchronizer.h',
- 'browser/metrics/tracking_synchronizer_observer.h',
'browser/metrics/variations/generated_resources_map.h',
'browser/metrics/variations/generated_resources_map_lookup.cc',
'browser/metrics/variations/variations_registry_syncer_win.cc',
@@ -2798,6 +2793,7 @@
'../components/components.gyp:metrics',
'../components/components.gyp:metrics_gpu',
'../components/components.gyp:metrics_net',
+ '../components/components.gyp:metrics_profiler',
'../components/components.gyp:navigation_metrics',
'../components/components.gyp:network_time',
'../components/components.gyp:omaha_query_params',
diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi
index 04cde22..f05c4b3 100644
--- a/chrome/chrome_tests_unit.gypi
+++ b/chrome/chrome_tests_unit.gypi
@@ -527,7 +527,6 @@
'browser/metrics/cloned_install_detector_unittest.cc',
'browser/metrics/extensions_metrics_provider_unittest.cc',
'browser/metrics/plugin_metrics_provider_unittest.cc',
- 'browser/metrics/profiler_metrics_provider_unittest.cc',
'browser/metrics/signin_status_metrics_provider_unittest.cc',
'browser/metrics/rappor/sampling_unittest.cc',
'browser/metrics/thread_watcher_unittest.cc',
diff --git a/components/components_tests.gyp b/components/components_tests.gyp
index 55f8091..e7733eb 100644
--- a/components/components_tests.gyp
+++ b/components/components_tests.gyp
@@ -152,6 +152,7 @@
'metrics/metrics_service_unittest.cc',
'metrics/metrics_state_manager_unittest.cc',
'metrics/persisted_logs_unittest.cc',
+ 'metrics/profiler/profiler_metrics_provider_unittest.cc',
'navigation_interception/intercept_navigation_resource_throttle_unittest.cc',
'network_time/network_time_tracker_unittest.cc',
'omaha_query_params/omaha_query_params_unittest.cc',
@@ -370,6 +371,7 @@
'components.gyp:metrics',
'components.gyp:metrics_gpu',
'components.gyp:metrics_net',
+ 'components.gyp:metrics_profiler',
'components.gyp:metrics_test_support',
# Dependencies of network_time
diff --git a/components/metrics.gypi b/components/metrics.gypi
index dafeb0e..c16c191 100644
--- a/components/metrics.gypi
+++ b/components/metrics.gypi
@@ -107,6 +107,26 @@
],
},
{
+ # GN version: //components/metrics:profiler
+ 'target_name': 'metrics_profiler',
+ 'type': 'static_library',
+ 'include_dirs': [
+ '..',
+ ],
+ 'dependencies': [
+ '../content/content.gyp:content_browser',
+ 'component_metrics_proto',
+ 'metrics',
+ ],
+ 'sources': [
+ 'metrics/profiler/profiler_metrics_provider.cc',
+ 'metrics/profiler/profiler_metrics_provider.h',
+ 'metrics/profiler/tracking_synchronizer.cc',
+ 'metrics/profiler/tracking_synchronizer.h',
+ 'metrics/profiler/tracking_synchronizer_observer.h',
+ ],
+ },
+ {
# Protobuf compiler / generator for UMA (User Metrics Analysis).
#
# GN version: //components/metrics/proto:proto
diff --git a/components/metrics/BUILD.gn b/components/metrics/BUILD.gn
index 8179e2746..89bedd8 100644
--- a/components/metrics/BUILD.gn
+++ b/components/metrics/BUILD.gn
@@ -88,6 +88,25 @@ static_library("net") {
forward_dependent_configs_from = [ ":metrics" ]
}
+# GYP version: components/metrics.gypi:metrics_profiler
+source_set("profiler") {
+ sources = [
+ "profiler/profiler_metrics_provider.cc",
+ "profiler/profiler_metrics_provider.h",
+ "profiler/tracking_synchronizer.cc",
+ "profiler/tracking_synchronizer.h",
+ "profiler/tracking_synchronizer_observer.h",
+ ]
+
+ deps = [
+ ":metrics",
+ "//base",
+ "//content/public/browser",
+ ]
+
+ forward_dependent_configs_from = [ ":metrics" ]
+}
+
# GYP version: components/metrics.gypi:metrics_test_support
static_library("test_support") {
sources = [
diff --git a/components/metrics/profiler/DEPS b/components/metrics/profiler/DEPS
new file mode 100644
index 0000000..033b9f9
--- /dev/null
+++ b/components/metrics/profiler/DEPS
@@ -0,0 +1,5 @@
+include_rules = [
+ "+components/nacl/common",
+ "+content/public/browser",
+ "+content/public/common",
+]
diff --git a/chrome/browser/metrics/profiler_metrics_provider.cc b/components/metrics/profiler/profiler_metrics_provider.cc
index 4ba80a0..245fc22 100644
--- a/chrome/browser/metrics/profiler_metrics_provider.cc
+++ b/components/metrics/profiler/profiler_metrics_provider.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/metrics/profiler_metrics_provider.h"
+#include "components/metrics/profiler/profiler_metrics_provider.h"
#include <ctype.h>
#include <string>
@@ -13,9 +13,10 @@
#include "components/nacl/common/nacl_process_type.h"
#include "content/public/common/process_type.h"
-using metrics::ProfilerEventProto;
using tracked_objects::ProcessDataSnapshot;
+namespace metrics {
+
namespace {
ProfilerEventProto::TrackedObject::ProcessType AsProtobufProcessType(
@@ -86,14 +87,14 @@ void WriteProfilerData(const ProcessDataSnapshot& profiler_data,
ProfilerEventProto::TrackedObject* tracked_object =
performance_profile->add_tracked_object();
tracked_object->set_birth_thread_name_hash(
- metrics::MetricsLog::Hash(MapThreadName(it->birth.thread_name)));
+ MetricsLog::Hash(MapThreadName(it->birth.thread_name)));
tracked_object->set_exec_thread_name_hash(
- metrics::MetricsLog::Hash(MapThreadName(it->death_thread_name)));
+ MetricsLog::Hash(MapThreadName(it->death_thread_name)));
tracked_object->set_source_file_name_hash(
- metrics::MetricsLog::Hash(NormalizeFileName(
+ MetricsLog::Hash(NormalizeFileName(
it->birth.location.file_name)));
tracked_object->set_source_function_name_hash(
- metrics::MetricsLog::Hash(it->birth.location.function_name));
+ MetricsLog::Hash(it->birth.location.function_name));
tracked_object->set_source_line_number(it->birth.location.line_number);
tracked_object->set_exec_count(death_data.count);
tracked_object->set_exec_time_total(death_data.run_duration_sum);
@@ -114,7 +115,7 @@ ProfilerMetricsProvider::~ProfilerMetricsProvider() {
}
void ProfilerMetricsProvider::ProvideGeneralMetrics(
- metrics::ChromeUserMetricsExtension* uma_proto) {
+ ChromeUserMetricsExtension* uma_proto) {
if (!has_profiler_data_)
return;
@@ -141,3 +142,5 @@ void ProfilerMetricsProvider::RecordProfilerData(
profiler_event_cache_.set_time_source(ProfilerEventProto::WALL_CLOCK_TIME);
WriteProfilerData(process_data, process_type, &profiler_event_cache_);
}
+
+} // namespace metrics
diff --git a/chrome/browser/metrics/profiler_metrics_provider.h b/components/metrics/profiler/profiler_metrics_provider.h
index 680156b..f9e7e48 100644
--- a/chrome/browser/metrics/profiler_metrics_provider.h
+++ b/components/metrics/profiler/profiler_metrics_provider.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_METRICS_PROFILER_METRICS_PROVIDER_H_
-#define CHROME_BROWSER_METRICS_PROFILER_METRICS_PROVIDER_H_
+#ifndef COMPONENTS_METRICS_PROFILER_PROFILER_METRICS_PROVIDER_H_
+#define COMPONENTS_METRICS_PROFILER_PROFILER_METRICS_PROVIDER_H_
#include "base/basictypes.h"
#include "components/metrics/metrics_provider.h"
@@ -13,16 +13,18 @@ namespace tracked_objects {
struct ProcessDataSnapshot;
}
+namespace metrics {
+
// ProfilerMetricsProvider is responsible for filling out the |profiler_event|
// section of the UMA proto.
-class ProfilerMetricsProvider : public metrics::MetricsProvider {
+class ProfilerMetricsProvider : public MetricsProvider {
public:
ProfilerMetricsProvider();
virtual ~ProfilerMetricsProvider();
- // metrics::MetricsDataProvider:
+ // MetricsDataProvider:
virtual void ProvideGeneralMetrics(
- metrics::ChromeUserMetricsExtension* uma_proto) OVERRIDE;
+ ChromeUserMetricsExtension* uma_proto) OVERRIDE;
// Records the passed profiled data, which should be a snapshot of the
// browser's profiled performance during startup for a single process.
@@ -33,7 +35,7 @@ class ProfilerMetricsProvider : public metrics::MetricsProvider {
private:
// Saved cache of generated Profiler event protos, to be copied into the UMA
// proto when ProvideGeneralMetrics() is called.
- metrics::ProfilerEventProto profiler_event_cache_;
+ ProfilerEventProto profiler_event_cache_;
// True if this instance has recorded profiler data since the last call to
// ProvideGeneralMetrics().
@@ -42,4 +44,6 @@ class ProfilerMetricsProvider : public metrics::MetricsProvider {
DISALLOW_COPY_AND_ASSIGN(ProfilerMetricsProvider);
};
-#endif // CHROME_BROWSER_METRICS_PROFILER_METRICS_PROVIDER_H_
+} // namespace metrics
+
+#endif // COMPONENTS_METRICS_PROFILER_PROFILER_METRICS_PROVIDER_H_
diff --git a/chrome/browser/metrics/profiler_metrics_provider_unittest.cc b/components/metrics/profiler/profiler_metrics_provider_unittest.cc
index 3d1be74..61f0837 100644
--- a/chrome/browser/metrics/profiler_metrics_provider_unittest.cc
+++ b/components/metrics/profiler/profiler_metrics_provider_unittest.cc
@@ -2,23 +2,23 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/metrics/profiler_metrics_provider.h"
+#include "components/metrics/profiler/profiler_metrics_provider.h"
#include "base/tracked_objects.h"
#include "components/metrics/metrics_hashes.h"
#include "content/public/common/process_type.h"
#include "testing/gtest/include/gtest/gtest.h"
-using metrics::ProfilerEventProto;
using tracked_objects::ProcessDataSnapshot;
using tracked_objects::TaskSnapshot;
+namespace metrics {
+
TEST(ProfilerMetricsProviderTest, RecordData) {
// WARNING: If you broke the below check, you've modified how
- // metrics::HashMetricName works. Please also modify all server-side code that
+ // HashMetricName works. Please also modify all server-side code that
// relies on the existing way of hashing.
- EXPECT_EQ(GG_UINT64_C(1518842999910132863),
- metrics::HashMetricName("birth_thread*"));
+ EXPECT_EQ(GG_UINT64_C(1518842999910132863), HashMetricName("birth_thread*"));
ProfilerMetricsProvider profiler_metrics_provider;
@@ -92,7 +92,7 @@ TEST(ProfilerMetricsProviderTest, RecordData) {
process_data, content::PROCESS_TYPE_RENDERER);
// Capture the data and verify that it is as expected.
- metrics::ChromeUserMetricsExtension uma_proto;
+ ChromeUserMetricsExtension uma_proto;
profiler_metrics_provider.ProvideGeneralMetrics(&uma_proto);
ASSERT_EQ(1, uma_proto.profiler_event_size());
@@ -104,78 +104,80 @@ TEST(ProfilerMetricsProviderTest, RecordData) {
const ProfilerEventProto::TrackedObject* tracked_object =
&uma_proto.profiler_event(0).tracked_object(0);
- EXPECT_EQ(metrics::HashMetricName("file.h"),
+ EXPECT_EQ(HashMetricName("file.h"),
tracked_object->source_file_name_hash());
- EXPECT_EQ(metrics::HashMetricName("function"),
+ EXPECT_EQ(HashMetricName("function"),
tracked_object->source_function_name_hash());
EXPECT_EQ(1337, tracked_object->source_line_number());
- EXPECT_EQ(metrics::HashMetricName("birth_thread"),
+ EXPECT_EQ(HashMetricName("birth_thread"),
tracked_object->birth_thread_name_hash());
EXPECT_EQ(37, tracked_object->exec_count());
EXPECT_EQ(31, tracked_object->exec_time_total());
EXPECT_EQ(13, tracked_object->exec_time_sampled());
EXPECT_EQ(8, tracked_object->queue_time_total());
EXPECT_EQ(3, tracked_object->queue_time_sampled());
- EXPECT_EQ(metrics::HashMetricName("Still_Alive"),
+ EXPECT_EQ(HashMetricName("Still_Alive"),
tracked_object->exec_thread_name_hash());
EXPECT_EQ(177U, tracked_object->process_id());
EXPECT_EQ(ProfilerEventProto::TrackedObject::BROWSER,
tracked_object->process_type());
tracked_object = &uma_proto.profiler_event(0).tracked_object(1);
- EXPECT_EQ(metrics::HashMetricName("file2"),
+ EXPECT_EQ(HashMetricName("file2"),
tracked_object->source_file_name_hash());
- EXPECT_EQ(metrics::HashMetricName("function2"),
+ EXPECT_EQ(HashMetricName("function2"),
tracked_object->source_function_name_hash());
EXPECT_EQ(1773, tracked_object->source_line_number());
- EXPECT_EQ(metrics::HashMetricName("birth_thread*"),
+ EXPECT_EQ(HashMetricName("birth_thread*"),
tracked_object->birth_thread_name_hash());
EXPECT_EQ(19, tracked_object->exec_count());
EXPECT_EQ(23, tracked_object->exec_time_total());
EXPECT_EQ(7, tracked_object->exec_time_sampled());
EXPECT_EQ(0, tracked_object->queue_time_total());
EXPECT_EQ(0, tracked_object->queue_time_sampled());
- EXPECT_EQ(metrics::HashMetricName("death_thread"),
+ EXPECT_EQ(HashMetricName("death_thread"),
tracked_object->exec_thread_name_hash());
EXPECT_EQ(177U, tracked_object->process_id());
EXPECT_EQ(ProfilerEventProto::TrackedObject::BROWSER,
tracked_object->process_type());
tracked_object = &uma_proto.profiler_event(0).tracked_object(2);
- EXPECT_EQ(metrics::HashMetricName("file3"),
+ EXPECT_EQ(HashMetricName("file3"),
tracked_object->source_file_name_hash());
- EXPECT_EQ(metrics::HashMetricName("function3"),
+ EXPECT_EQ(HashMetricName("function3"),
tracked_object->source_function_name_hash());
EXPECT_EQ(7331, tracked_object->source_line_number());
- EXPECT_EQ(metrics::HashMetricName("birth_thread*"),
+ EXPECT_EQ(HashMetricName("birth_thread*"),
tracked_object->birth_thread_name_hash());
EXPECT_EQ(137, tracked_object->exec_count());
EXPECT_EQ(131, tracked_object->exec_time_total());
EXPECT_EQ(113, tracked_object->exec_time_sampled());
EXPECT_EQ(108, tracked_object->queue_time_total());
EXPECT_EQ(103, tracked_object->queue_time_sampled());
- EXPECT_EQ(metrics::HashMetricName("death_thread*"),
+ EXPECT_EQ(HashMetricName("death_thread*"),
tracked_object->exec_thread_name_hash());
EXPECT_EQ(1177U, tracked_object->process_id());
EXPECT_EQ(ProfilerEventProto::TrackedObject::RENDERER,
tracked_object->process_type());
tracked_object = &uma_proto.profiler_event(0).tracked_object(3);
- EXPECT_EQ(metrics::HashMetricName(""),
+ EXPECT_EQ(HashMetricName(""),
tracked_object->source_file_name_hash());
- EXPECT_EQ(metrics::HashMetricName(""),
+ EXPECT_EQ(HashMetricName(""),
tracked_object->source_function_name_hash());
EXPECT_EQ(7332, tracked_object->source_line_number());
- EXPECT_EQ(metrics::HashMetricName(""),
+ EXPECT_EQ(HashMetricName(""),
tracked_object->birth_thread_name_hash());
EXPECT_EQ(138, tracked_object->exec_count());
EXPECT_EQ(132, tracked_object->exec_time_total());
EXPECT_EQ(114, tracked_object->exec_time_sampled());
EXPECT_EQ(109, tracked_object->queue_time_total());
EXPECT_EQ(104, tracked_object->queue_time_sampled());
- EXPECT_EQ(metrics::HashMetricName(""),
+ EXPECT_EQ(HashMetricName(""),
tracked_object->exec_thread_name_hash());
EXPECT_EQ(ProfilerEventProto::TrackedObject::RENDERER,
tracked_object->process_type());
}
}
+
+} // namespace metrics
diff --git a/chrome/browser/metrics/tracking_synchronizer.cc b/components/metrics/profiler/tracking_synchronizer.cc
index fd4505a..a6ed609 100644
--- a/chrome/browser/metrics/tracking_synchronizer.cc
+++ b/components/metrics/profiler/tracking_synchronizer.cc
@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/metrics/tracking_synchronizer.h"
+#include "components/metrics/profiler/tracking_synchronizer.h"
#include "base/bind.h"
#include "base/metrics/histogram.h"
#include "base/threading/thread.h"
#include "base/tracked_objects.h"
-#include "chrome/browser/metrics/tracking_synchronizer_observer.h"
+#include "components/metrics/profiler/tracking_synchronizer_observer.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/profiler_controller.h"
#include "content/public/common/process_type.h"
@@ -30,12 +30,12 @@ const int kNeverUsableSequenceNumber = -2;
// calls. This object is created on the UI thread, and it is destroyed after
// all the other threads have gone away. As a result, it is ok to call it
// from the UI thread, or for about:profiler.
-static chrome_browser_metrics::TrackingSynchronizer* g_tracking_synchronizer =
+static metrics::TrackingSynchronizer* g_tracking_synchronizer =
NULL;
} // anonymous namespace
-namespace chrome_browser_metrics {
+namespace metrics {
// The "RequestContext" structure describes an individual request received
// from the UI. All methods are accessible on UI thread.
@@ -294,4 +294,4 @@ int TrackingSynchronizer::GetNextAvailableSequenceNumber() {
return last_used_sequence_number_;
}
-} // namespace chrome_browser_metrics
+} // namespace metrics
diff --git a/chrome/browser/metrics/tracking_synchronizer.h b/components/metrics/profiler/tracking_synchronizer.h
index 2fcfebb..75f1f33 100644
--- a/chrome/browser/metrics/tracking_synchronizer.h
+++ b/components/metrics/profiler/tracking_synchronizer.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_METRICS_TRACKING_SYNCHRONIZER_H_
-#define CHROME_BROWSER_METRICS_TRACKING_SYNCHRONIZER_H_
+#ifndef COMPONENTS_METRICS_PROFILER_TRACKING_SYNCHRONIZER_H_
+#define COMPONENTS_METRICS_PROFILER_TRACKING_SYNCHRONIZER_H_
#include <map>
#include <string>
@@ -30,7 +30,7 @@
// associated with sequence number and send the unpickled profiler data to the
// |callback_object_|.
-namespace chrome_browser_metrics {
+namespace metrics {
class TrackingSynchronizerObserver;
@@ -112,6 +112,6 @@ class TrackingSynchronizer
DISALLOW_COPY_AND_ASSIGN(TrackingSynchronizer);
};
-} // namespace chrome_browser_metrics
+} // namespace metrics
-#endif // CHROME_BROWSER_METRICS_TRACKING_SYNCHRONIZER_H_
+#endif // COMPONENTS_METRICS_PROFILER_TRACKING_SYNCHRONIZER_H_
diff --git a/chrome/browser/metrics/tracking_synchronizer_observer.h b/components/metrics/profiler/tracking_synchronizer_observer.h
index 9dc1d75..b9301bb 100644
--- a/chrome/browser/metrics/tracking_synchronizer_observer.h
+++ b/components/metrics/profiler/tracking_synchronizer_observer.h
@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_METRICS_TRACKING_SYNCHRONIZER_OBSERVER_H_
-#define CHROME_BROWSER_METRICS_TRACKING_SYNCHRONIZER_OBSERVER_H_
+#ifndef COMPONENTS_METRICS_PROFILER_TRACKING_SYNCHRONIZER_OBSERVER_H_
+#define COMPONENTS_METRICS_PROFILER_TRACKING_SYNCHRONIZER_OBSERVER_H_
namespace tracked_objects {
struct ProcessDataSnapshot;
}
-namespace chrome_browser_metrics {
+namespace metrics {
// Observer for notifications from the TrackingSynchronizer class.
class TrackingSynchronizerObserver {
@@ -34,6 +34,6 @@ class TrackingSynchronizerObserver {
DISALLOW_COPY_AND_ASSIGN(TrackingSynchronizerObserver);
};
-} // namespace chrome_browser_metrics
+} // namespace metrics
-#endif // CHROME_BROWSER_METRICS_TRACKING_SYNCHRONIZER_OBSERVER_H_
+#endif // COMPONENTS_METRICS_PROFILER_TRACKING_SYNCHRONIZER_OBSERVER_H_