diff options
author | grt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-06 18:41:15 +0000 |
---|---|---|
committer | grt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-06 18:41:15 +0000 |
commit | 92c79d30b2d16cadd448c7cfd702f3ebd4e10bf5 (patch) | |
tree | 07ae765fb06593881920926459c339830d2fb339 | |
parent | 1baff834aaaadbcc16c340542da9dd0c8c1ad724 (diff) | |
download | chromium_src-92c79d30b2d16cadd448c7cfd702f3ebd4e10bf5.zip chromium_src-92c79d30b2d16cadd448c7cfd702f3ebd4e10bf5.tar.gz chromium_src-92c79d30b2d16cadd448c7cfd702f3ebd4e10bf5.tar.bz2 |
Remove locked histogram macros since jar@chromium.org made the base macros threadsafe in http://crrev.com/80412.
BUG=none
TEST=metrics should work as before
Review URL: http://codereview.chromium.org/6800008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80668 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome_frame/chrome_active_document.cc | 4 | ||||
-rw-r--r-- | chrome_frame/chrome_frame_activex.cc | 5 | ||||
-rw-r--r-- | chrome_frame/chrome_frame_activex_base.h | 10 | ||||
-rw-r--r-- | chrome_frame/chrome_frame_automation.cc | 29 | ||||
-rw-r--r-- | chrome_frame/chrome_frame_npapi.cc | 2 | ||||
-rw-r--r-- | chrome_frame/crash_reporting/crash_metrics.cc | 15 | ||||
-rw-r--r-- | chrome_frame/utils.h | 29 |
7 files changed, 30 insertions, 64 deletions
diff --git a/chrome_frame/chrome_active_document.cc b/chrome_frame/chrome_active_document.cc index f0f0fbb..a75a6cd 100644 --- a/chrome_frame/chrome_active_document.cc +++ b/chrome_frame/chrome_active_document.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -314,7 +314,7 @@ STDMETHODIMP ChromeActiveDocument::Load(BOOL fully_avalable, // When the code for the browser service patch and for the moniker patch is // removed, this conditional can also go away.) if (RENDERER_TYPE_UNDETERMINED != renderer_type) { - THREAD_SAFE_UMA_LAUNCH_TYPE_COUNT(renderer_type); + UMA_LAUNCH_TYPE_COUNT(renderer_type); } return S_OK; diff --git a/chrome_frame/chrome_frame_activex.cc b/chrome_frame/chrome_frame_activex.cc index f86eba3..eb1eb79 100644 --- a/chrome_frame/chrome_frame_activex.cc +++ b/chrome_frame/chrome_frame_activex.cc @@ -303,8 +303,7 @@ void ChromeFrameActivex::OnAutomationServerLaunchFailed( if (reason == AUTOMATION_VERSION_MISMATCH && ShouldShowVersionMismatchDialog(is_privileged(), m_spClientSite)) { - THREAD_SAFE_UMA_HISTOGRAM_COUNTS( - "ChromeFrame.VersionMismatchDisplayed", 1); + UMA_HISTOGRAM_COUNTS("ChromeFrame.VersionMismatchDisplayed", 1); DisplayVersionMismatchWarning(m_hWnd, server_version); } } @@ -490,7 +489,7 @@ HRESULT ChromeFrameActivex::IOleObject_SetClientSite( } // Log a metric that Chrome Frame is being used in Widget mode - THREAD_SAFE_UMA_LAUNCH_TYPE_COUNT(RENDERER_TYPE_CHROME_WIDGET); + UMA_LAUNCH_TYPE_COUNT(RENDERER_TYPE_CHROME_WIDGET); } return hr; diff --git a/chrome_frame/chrome_frame_activex_base.h b/chrome_frame/chrome_frame_activex_base.h index 820d038..bac9723 100644 --- a/chrome_frame/chrome_frame_activex_base.h +++ b/chrome_frame/chrome_frame_activex_base.h @@ -252,11 +252,11 @@ END_MSG_MAP() // Used to perform one time tasks. if (g_first_launch_by_process_) { g_first_launch_by_process_ = false; - THREAD_SAFE_UMA_HISTOGRAM_CUSTOM_COUNTS("ChromeFrame.IEVersion", - GetIEVersion(), - IE_INVALID, - IE_9, - IE_9 + 1); + UMA_HISTOGRAM_CUSTOM_COUNTS("ChromeFrame.IEVersion", + GetIEVersion(), + IE_INVALID, + IE_9, + IE_9 + 1); } return S_OK; diff --git a/chrome_frame/chrome_frame_automation.cc b/chrome_frame/chrome_frame_automation.cc index d3626eb..6024972 100644 --- a/chrome_frame/chrome_frame_automation.cc +++ b/chrome_frame/chrome_frame_automation.cc @@ -42,11 +42,6 @@ int kDefaultSendUMADataInterval = 20000; // in milliseconds. static const wchar_t kUmaSendIntervalValue[] = L"UmaSendInterval"; -// This lock ensures that histograms created by ChromeFrame are thread safe. -// The histograms created in ChromeFrame can be initialized on multiple -// threads. -base::Lock g_ChromeFrameHistogramLock; - class ChromeFrameAutomationProxyImpl::TabProxyNotificationMessageFilter : public IPC::ChannelProxy::MessageFilter { public: @@ -191,8 +186,7 @@ struct LaunchTimeStats { void Dump() { base::TimeDelta launch_time = base::Time::Now() - launch_time_begin_; - THREAD_SAFE_UMA_HISTOGRAM_TIMES("ChromeFrame.AutomationServerLaunchTime", - launch_time); + UMA_HISTOGRAM_TIMES("ChromeFrame.AutomationServerLaunchTime", launch_time); const int64 launch_milliseconds = launch_time.InMilliseconds(); if (launch_milliseconds > kAutomationServerReasonableLaunchDelay) { LOG(WARNING) << "Automation server launch took longer than expected: " << @@ -346,18 +340,18 @@ void AutomationProxyCacheEntry::CreateProxy(ChromeFrameLaunchParams* params, base::TimeTicks::Now() - automation_server_launch_start_time_; if (launch_result_ == AUTOMATION_SUCCESS) { - THREAD_SAFE_UMA_HISTOGRAM_TIMES( + UMA_HISTOGRAM_TIMES( "ChromeFrame.AutomationServerLaunchSuccessTime", delta); } else { - THREAD_SAFE_UMA_HISTOGRAM_TIMES( + UMA_HISTOGRAM_TIMES( "ChromeFrame.AutomationServerLaunchFailedTime", delta); } - THREAD_SAFE_UMA_HISTOGRAM_CUSTOM_COUNTS("ChromeFrame.LaunchResult", - launch_result_, - AUTOMATION_SUCCESS, - AUTOMATION_CREATE_TAB_FAILED, - AUTOMATION_CREATE_TAB_FAILED + 1); + UMA_HISTOGRAM_CUSTOM_COUNTS("ChromeFrame.LaunchResult", + launch_result_, + AUTOMATION_SUCCESS, + AUTOMATION_CREATE_TAB_FAILED, + AUTOMATION_CREATE_TAB_FAILED + 1); } TRACE_EVENT_END("chromeframe.createproxy", this, ""); @@ -873,12 +867,11 @@ void ChromeFrameAutomationClient::CreateExternalTab() { !chrome_launch_params_->widget_mode(), chrome_launch_params_->route_all_top_level_navigations()); - THREAD_SAFE_UMA_HISTOGRAM_CUSTOM_COUNTS( + UMA_HISTOGRAM_CUSTOM_COUNTS( "ChromeFrame.HostNetworking", !use_chrome_network_, 0, 1, 2); - THREAD_SAFE_UMA_HISTOGRAM_CUSTOM_COUNTS( - "ChromeFrame.HandleTopLevelRequests", handle_top_level_requests_, 0, 1, - 2); + UMA_HISTOGRAM_CUSTOM_COUNTS("ChromeFrame.HandleTopLevelRequests", + handle_top_level_requests_, 0, 1, 2); IPC::SyncMessage* message = new AutomationMsg_CreateExternalTab(settings, NULL, NULL, 0, 0); diff --git a/chrome_frame/chrome_frame_npapi.cc b/chrome_frame/chrome_frame_npapi.cc index 1dff49b..66817b5 100644 --- a/chrome_frame/chrome_frame_npapi.cc +++ b/chrome_frame/chrome_frame_npapi.cc @@ -865,7 +865,7 @@ void ChromeFrameNPAPI::OnAutomationServerLaunchFailed( // CF instance per Firefox window, so OK to show the warning there without // any further logic. if (reason == AUTOMATION_VERSION_MISMATCH) { - THREAD_SAFE_UMA_HISTOGRAM_COUNTS("ChromeFrame.VersionMismatchDisplayed", 1); + UMA_HISTOGRAM_COUNTS("ChromeFrame.VersionMismatchDisplayed", 1); DisplayVersionMismatchWarning(m_hWnd, server_version); } } diff --git a/chrome_frame/crash_reporting/crash_metrics.cc b/chrome_frame/crash_reporting/crash_metrics.cc index 8909162..8a103f1 100644 --- a/chrome_frame/crash_reporting/crash_metrics.cc +++ b/chrome_frame/crash_reporting/crash_metrics.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -72,29 +72,26 @@ int CrashMetricsReporter::IncrementMetric(Metric metric) { void CrashMetricsReporter::RecordCrashMetrics() { int navigation_count = GetMetric(NAVIGATION_COUNT); if (navigation_count > 0) { - THREAD_SAFE_UMA_HISTOGRAM_COUNTS("ChromeFrame.HostNavigationCount", - navigation_count); + UMA_HISTOGRAM_COUNTS("ChromeFrame.HostNavigationCount", navigation_count); SetMetric(NAVIGATION_COUNT, 0); } int chrome_frame_navigation_count = GetMetric(CHROME_FRAME_NAVIGATION_COUNT); if (chrome_frame_navigation_count > 0) { - THREAD_SAFE_UMA_HISTOGRAM_COUNTS("ChromeFrame.CFNavigationCount", - chrome_frame_navigation_count); + UMA_HISTOGRAM_COUNTS("ChromeFrame.CFNavigationCount", + chrome_frame_navigation_count); SetMetric(CHROME_FRAME_NAVIGATION_COUNT, 0); } int crash_count = GetMetric(CRASH_COUNT); if (crash_count > 0) { - THREAD_SAFE_UMA_HISTOGRAM_COUNTS("ChromeFrame.HostCrashCount", - crash_count); + UMA_HISTOGRAM_COUNTS("ChromeFrame.HostCrashCount", crash_count); SetMetric(CRASH_COUNT, 0); } int channel_error_count = GetMetric(CHANNEL_ERROR_COUNT); if (channel_error_count > 0) { - THREAD_SAFE_UMA_HISTOGRAM_COUNTS("ChromeFrame.ChannelErrorCount", - channel_error_count); + UMA_HISTOGRAM_COUNTS("ChromeFrame.ChannelErrorCount", channel_error_count); SetMetric(CHANNEL_ERROR_COUNT, 0); } } diff --git a/chrome_frame/utils.h b/chrome_frame/utils.h index 3e0035a..da5a2d2 100644 --- a/chrome_frame/utils.h +++ b/chrome_frame/utils.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -15,7 +15,6 @@ #include "base/basictypes.h" #include "base/logging.h" #include "base/metrics/histogram.h" -#include "base/synchronization/lock.h" #include "base/threading/thread.h" #include "base/win/scoped_comptr.h" #include "googleurl/src/gurl.h" @@ -195,8 +194,8 @@ enum RendererType { bool IsChrome(RendererType renderer_type); // Convenience macro for logging a sample for the launch type metric. -#define THREAD_SAFE_UMA_LAUNCH_TYPE_COUNT(sample) \ - THREAD_SAFE_UMA_HISTOGRAM_CUSTOM_COUNTS("ChromeFrame.LaunchType", sample, \ +#define UMA_LAUNCH_TYPE_COUNT(sample) \ + UMA_HISTOGRAM_CUSTOM_COUNTS("ChromeFrame.LaunchType", sample, \ RENDERER_TYPE_CHROME_MIN, RENDERER_TYPE_CHROME_MAX, \ RENDERER_TYPE_CHROME_MAX + 1 - RENDERER_TYPE_CHROME_MIN) @@ -426,28 +425,6 @@ bool IsTopLevelWindow(HWND window); // Seeks a stream back to position 0. HRESULT RewindStream(IStream* stream); -extern base::Lock g_ChromeFrameHistogramLock; - -// Thread safe versions of the UMA histogram macros we use for ChromeFrame. -// These should be used for histograms in ChromeFrame. If other histogram -// macros from base/metrics/histogram.h are needed then thread safe versions of -// those should be defined and used. -#define THREAD_SAFE_UMA_HISTOGRAM_CUSTOM_COUNTS(name, sample, min, max, \ - bucket_count) { \ - base::AutoLock lock(g_ChromeFrameHistogramLock); \ - UMA_HISTOGRAM_CUSTOM_COUNTS(name, sample, min, max, bucket_count); \ -} - -#define THREAD_SAFE_UMA_HISTOGRAM_TIMES(name, sample) { \ - base::AutoLock lock(g_ChromeFrameHistogramLock); \ - UMA_HISTOGRAM_TIMES(name, sample); \ -} - -#define THREAD_SAFE_UMA_HISTOGRAM_COUNTS(name, sample) { \ - base::AutoLock lock(g_ChromeFrameHistogramLock); \ - UMA_HISTOGRAM_COUNTS(name, sample); \ -} - // Fired when we want to notify IE about privacy changes. #define WM_FIRE_PRIVACY_CHANGE_NOTIFICATION (WM_APP + 1) |