1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_AFTER_STARTUP_TASK_UTILS_H_
6 #define CHROME_BROWSER_AFTER_STARTUP_TASK_UTILS_H_
8 #include "base/basictypes.h"
10 #include "base/gtest_prod_util.h"
11 #include "base/memory/ref_counted.h"
16 namespace tracked_objects
{
20 class AfterStartupTaskUtils
{
22 // Observes startup and when complete runs tasks that have accrued.
23 static void StartMonitoringStartup();
25 // Used to augment the behavior of BrowserThread::PostAfterStartupTask
26 // for chrome. Tasks are queued until startup is complete.
27 // Note: see browser_thread.h
28 static void PostTask(const tracked_objects::Location
& from_here
,
29 const scoped_refptr
<base::TaskRunner
>& task_runner
,
30 const base::Closure
& task
);
32 // Returns true if browser startup is complete. Only use this on a one-off
33 // basis; If you need to poll this function constantly, use the above
34 // PostTask() API instead.
35 static bool IsBrowserStartupComplete();
38 friend class AfterStartupTaskTest
;
39 FRIEND_TEST_ALL_PREFIXES(AfterStartupTaskTest
, IsStartupComplete
);
40 FRIEND_TEST_ALL_PREFIXES(AfterStartupTaskTest
, PostTask
);
42 static void SetBrowserStartupIsComplete();
43 static void UnsafeResetForTesting();
45 DISALLOW_IMPLICIT_CONSTRUCTORS(AfterStartupTaskUtils
);
48 #endif // CHROME_BROWSER_AFTER_STARTUP_TASK_UTILS_H_