summaryrefslogtreecommitdiffstats
path: root/chrome/service
diff options
context:
space:
mode:
authorvitalybuka@chromium.org <vitalybuka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-24 20:29:36 +0000
committervitalybuka@chromium.org <vitalybuka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-24 20:29:36 +0000
commita30798372912744d643c58ddc61c6c7eabab2e51 (patch)
treee5768ac7ce0302b12780ba515fba52fe3ff4abae /chrome/service
parent786d75cb93ca798afa23e1f5c548e102b7ede6d5 (diff)
downloadchromium_src-a30798372912744d643c58ddc61c6c7eabab2e51.zip
chromium_src-a30798372912744d643c58ddc61c6c7eabab2e51.tar.gz
chromium_src-a30798372912744d643c58ddc61c6c7eabab2e51.tar.bz2
Collect metrics data from service process.
MetricsService in browser process sends request for histograms to service process if service is running. Request is called in parallel with requests to other browser child processes. Service process still loses all data collected after browser process is gone. BUG=305019 Review URL: https://codereview.chromium.org/26779002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@230796 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/service')
-rw-r--r--chrome/service/service_ipc_server.cc12
-rw-r--r--chrome/service/service_ipc_server.h4
-rw-r--r--chrome/service/service_main.cc2
3 files changed, 18 insertions, 0 deletions
diff --git a/chrome/service/service_ipc_server.cc b/chrome/service/service_ipc_server.cc
index f05bf4b..b700c57 100644
--- a/chrome/service/service_ipc_server.cc
+++ b/chrome/service/service_ipc_server.cc
@@ -4,6 +4,7 @@
#include "chrome/service/service_ipc_server.h"
+#include "base/metrics/histogram_delta_serialization.h"
#include "chrome/common/service_messages.h"
#include "chrome/service/cloud_print/cloud_print_proxy.h"
#include "chrome/service/service_process.h"
@@ -98,6 +99,7 @@ bool ServiceIPCServer::OnMessageReceived(const IPC::Message& msg) {
OnDisableCloudPrintProxy)
IPC_MESSAGE_HANDLER(ServiceMsg_GetCloudPrintProxyInfo,
OnGetCloudPrintProxyInfo)
+ IPC_MESSAGE_HANDLER(ServiceMsg_GetHistograms, OnGetHistograms)
IPC_MESSAGE_HANDLER(ServiceMsg_Shutdown, OnShutdown);
IPC_MESSAGE_HANDLER(ServiceMsg_UpdateAvailable, OnUpdateAvailable);
IPC_MESSAGE_UNHANDLED(handled = false)
@@ -120,6 +122,16 @@ void ServiceIPCServer::OnGetCloudPrintProxyInfo() {
channel_->Send(new ServiceHostMsg_CloudPrintProxy_Info(info));
}
+void ServiceIPCServer::OnGetHistograms() {
+ if (!histogram_delta_serializer_) {
+ histogram_delta_serializer_.reset(
+ new base::HistogramDeltaSerialization("ServiceProcess"));
+ }
+ std::vector<std::string> deltas;
+ histogram_delta_serializer_->PrepareAndSerializeDeltas(&deltas);
+ channel_->Send(new ServiceHostMsg_Histograms(deltas));
+}
+
void ServiceIPCServer::OnDisableCloudPrintProxy() {
// User disabled CloudPrint proxy explicitly. Delete printers
// registered from this proxy and disable proxy.
diff --git a/chrome/service/service_ipc_server.h b/chrome/service/service_ipc_server.h
index 28fe4b4..c265a98 100644
--- a/chrome/service/service_ipc_server.h
+++ b/chrome/service/service_ipc_server.h
@@ -18,6 +18,7 @@
namespace base {
class DictionaryValue;
+class HistogramDeltaSerialization;
} // namespace base
@@ -58,6 +59,7 @@ class ServiceIPCServer : public IPC::Listener, public IPC::Sender {
const std::string& user_email,
const base::DictionaryValue& user_settings);
void OnGetCloudPrintProxyInfo();
+ void OnGetHistograms();
void OnDisableCloudPrintProxy();
void OnShutdown();
@@ -74,6 +76,8 @@ class ServiceIPCServer : public IPC::Listener, public IPC::Sender {
// Allows threads other than the main thread to send sync messages.
scoped_refptr<IPC::SyncMessageFilter> sync_message_filter_;
+ // Calculates histograms deltas.
+ scoped_ptr<base::HistogramDeltaSerialization> histogram_delta_serializer_;
DISALLOW_COPY_AND_ASSIGN(ServiceIPCServer);
};
diff --git a/chrome/service/service_main.cc b/chrome/service/service_main.cc
index 99e680b..e6d0142 100644
--- a/chrome/service/service_main.cc
+++ b/chrome/service/service_main.cc
@@ -4,6 +4,7 @@
#include "base/debug/debugger.h"
#include "base/message_loop/message_loop.h"
+#include "base/metrics/statistics_recorder.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/service_process_util.h"
#include "chrome/service/service_process.h"
@@ -37,6 +38,7 @@ int ServiceProcessMain(const content::MainFunctionParams& parameters) {
<< parameters.command_line.GetCommandLineString();
base::PlatformThread::SetName("CrServiceMain");
+ base::StatisticsRecorder::Initialize();
// If there is already a service process running, quit now.
scoped_ptr<ServiceProcessState> state(new ServiceProcessState);