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

Unified Diff: content/browser/browser_main_runner.cc

Issue 949293002: Implement a poor man's PostAfterStartupTask() function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
Index: content/browser/browser_main_runner.cc
diff --git a/content/browser/browser_main_runner.cc b/content/browser/browser_main_runner.cc
index b12ccd6da25c855ea0f831d2373e63d9ff04261f..6bfc7a6bab4c39005548bec2a99c9f1108a19989 100644
--- a/content/browser/browser_main_runner.cc
+++ b/content/browser/browser_main_runner.cc
@@ -10,10 +10,12 @@
#include "base/logging.h"
#include "base/metrics/histogram.h"
#include "base/metrics/statistics_recorder.h"
+#include "base/time/time.h"
#include "base/trace_event/trace_event.h"
#include "content/browser/browser_main_loop.h"
#include "content/browser/browser_shutdown_profile_dumper.h"
#include "content/browser/notification_service_impl.h"
+#include "content/public/browser/browser_main_runner.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/main_function_params.h"
#include "ui/base/ime/input_method_initializer.h"
@@ -111,6 +113,8 @@ void InstallSha256LegacyHooks() {
#endif // _WIN64
}
+base::TimeTicks g_process_startup_ticks;
+
} // namespace
#endif // OS_WIN
@@ -134,6 +138,8 @@ class BrowserMainRunnerImpl : public BrowserMainRunner {
if (!initialization_started_) {
initialization_started_ = true;
+ g_process_startup_ticks = base::TimeTicks::Now();
+
#if !defined(OS_IOS)
if (parameters.command_line.HasSwitch(switches::kWaitForDebugger))
base::debug::WaitForDebugger(60, true);
@@ -283,4 +289,10 @@ BrowserMainRunner* BrowserMainRunner::Create() {
return new BrowserMainRunnerImpl();
}
+// TODO(michaeln): Where should this go and what signal should be used?
+bool IsBrowserStartingUp() {
+ return base::TimeTicks::Now() - g_process_startup_ticks <
+ base::TimeDelta::FromSeconds(15);
cmumford 2015/02/26 23:47:45 Assuming the same 15 from above?
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698