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

Unified Diff: mandoline/ui/browser/browser_manager.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 | « mandoline/ui/browser/DEPS ('k') | mojo/common/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mandoline/ui/browser/browser_manager.cc
diff --git a/mandoline/ui/browser/browser_manager.cc b/mandoline/ui/browser/browser_manager.cc
index a4f9c63142dd95529150a30a70b9c7b5ecd091d7..ae81588ceecdc90578713759c9a675eea53716ec 100644
--- a/mandoline/ui/browser/browser_manager.cc
+++ b/mandoline/ui/browser/browser_manager.cc
@@ -5,9 +5,12 @@
#include "mandoline/ui/browser/browser_manager.h"
#include "base/command_line.h"
+#include "base/time/time.h"
#include "components/view_manager/public/cpp/view.h"
#include "components/view_manager/public/cpp/view_observer.h"
#include "mandoline/ui/browser/browser.h"
+#include "mojo/services/tracing/public/cpp/switches.h"
+#include "mojo/services/tracing/public/interfaces/tracing.mojom.h"
namespace mandoline {
@@ -54,6 +57,24 @@ void BrowserManager::Initialize(mojo::ApplicationImpl* app) {
// default URL.
if (browsers_.empty())
CreateBrowser(GURL(kGoogleURL));
+
+ // Record the browser startup time metrics for performance testing.
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ tracing::kEnableStatsCollectionBindings)) {
+ mojo::URLRequestPtr request(mojo::URLRequest::New());
+ request->url = mojo::String::From("mojo:tracing");
+ tracing::StartupPerformanceDataCollectorPtr collector;
+ app_->ConnectToService(request.Pass(), &collector);
+ // TODO(msw): When to record the browser message loop start time?
+ const base::Time startup_time = base::Time::Now();
+ collector->SetBrowserMessageLoopStartTime(startup_time.ToInternalValue());
+ // TODO(msw): When to record the browser window display time?
+ const base::Time display_time = base::Time::Now();
+ collector->SetBrowserWindowDisplayTime(display_time.ToInternalValue());
+ // TODO(msw): When to record the browser open tabs time?
+ const base::Time open_tabs_time = base::Time::Now();
+ collector->SetBrowserOpenTabsTime(open_tabs_time.ToInternalValue());
+ }
}
bool BrowserManager::ConfigureIncomingConnection(
« no previous file with comments | « mandoline/ui/browser/DEPS ('k') | mojo/common/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698