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

Unified Diff: mojo/runner/context.cc

Issue 1278673002: Add stats collection for telemetry startup.warm.blank_page test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update comment. Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/runner/BUILD.gn ('k') | mojo/runner/switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/runner/context.cc
diff --git a/mojo/runner/context.cc b/mojo/runner/context.cc
index 40c62772cdaa23706a034b7670a9624a915595ae..73464b671030a2cf5b8f5b34686af524c074f326 100644
--- a/mojo/runner/context.cc
+++ b/mojo/runner/context.cc
@@ -14,6 +14,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
#include "base/path_service.h"
+#include "base/process/process_info.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
@@ -33,7 +34,8 @@
#include "mojo/runner/in_process_native_runner.h"
#include "mojo/runner/out_of_process_native_runner.h"
#include "mojo/runner/switches.h"
-#include "mojo/services/tracing/tracing.mojom.h"
+#include "mojo/services/tracing/public/cpp/switches.h"
+#include "mojo/services/tracing/public/interfaces/tracing.mojom.h"
#include "mojo/shell/application_loader.h"
#include "mojo/shell/application_manager.h"
#include "mojo/shell/switches.h"
@@ -304,15 +306,30 @@ bool Context::Init() {
InitContentHandlers(&application_manager_, command_line);
InitNativeOptions(&application_manager_, command_line);
+ ServiceProviderPtr service_provider_ptr;
ServiceProviderPtr tracing_service_provider_ptr;
new TracingServiceProvider(GetProxy(&tracing_service_provider_ptr));
mojo::URLRequestPtr request(mojo::URLRequest::New());
request->url = mojo::String::From("mojo:tracing");
application_manager_.ConnectToApplication(
- nullptr, request.Pass(), std::string(), GURL(""), nullptr,
- tracing_service_provider_ptr.Pass(),
+ nullptr, request.Pass(), std::string(), GURL(),
+ GetProxy(&service_provider_ptr), tracing_service_provider_ptr.Pass(),
shell::GetPermissiveCapabilityFilter(), base::Closure());
+// CurrentProcessInfo::CreationTime() is missing on some platforms.
+#if defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_LINUX)
+ // Record the shell process creation time for performance testing.
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ tracing::kEnableStatsCollectionBindings)) {
+ tracing::StartupPerformanceDataCollectorPtr collector;
+ service_provider_ptr->ConnectToService(
+ tracing::StartupPerformanceDataCollector::Name_,
+ GetProxy(&collector).PassMessagePipe());
+ const base::Time creation_time = base::CurrentProcessInfo::CreationTime();
+ collector->SetShellProcessCreationTime(creation_time.ToInternalValue());
+ }
+#endif
+
InitDevToolsServiceIfNeeded(&application_manager_, command_line);
return true;
« no previous file with comments | « mojo/runner/BUILD.gn ('k') | mojo/runner/switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698