[M85 Dev][EFL] Fix errors to generate ninja files
[platform/framework/web/chromium-efl.git] / chrome / browser / after_startup_task_utils.h
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.
4
5 #ifndef CHROME_BROWSER_AFTER_STARTUP_TASK_UTILS_H_
6 #define CHROME_BROWSER_AFTER_STARTUP_TASK_UTILS_H_
7
8 #include "base/bind.h"
9 #include "base/callback.h"
10 #include "base/location.h"
11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h"
13
14 namespace android {
15 class AfterStartupTaskUtilsJNI;
16 }
17
18 namespace base {
19 class SequencedTaskRunner;
20 }
21
22 class AfterStartupTaskUtils {
23  public:
24   // Observes startup and when complete runs tasks that have accrued.
25   static void StartMonitoringStartup();
26
27   // Used to augment the behavior of BrowserThread::PostAfterStartupTask
28   // for chrome. Tasks are queued until startup is complete.
29   // Note: see browser_thread.h
30   static void PostTask(
31       const base::Location& from_here,
32       const scoped_refptr<base::SequencedTaskRunner>& destination_runner,
33       base::OnceClosure task);
34
35   // Returns true if browser startup is complete. Only use this on a one-off
36   // basis; If you need to poll this function constantly, use the above
37   // PostTask() API instead.
38   static bool IsBrowserStartupComplete();
39
40   // For use by unit tests where we don't have normal content loading
41   // infrastructure and thus StartMonitoringStartup() is unsuitable.
42   static void SetBrowserStartupIsCompleteForTesting();
43
44   static void UnsafeResetForTesting();
45
46   // Normally on startup, some tasks are scheduled with a random delay. This is
47   // not desirable during testing where it adds non-determinism and slows down
48   // test execution.
49   static void DisableScheduleTaskDelayForTesting();
50
51  private:
52   // TODO(wkorman): Look into why Android calls
53   // SetBrowserStartupIsComplete() directly. Ideally it would use
54   // StartMonitoringStartup() as the normal approach.
55   friend class android::AfterStartupTaskUtilsJNI;
56
57   static void SetBrowserStartupIsComplete();
58
59   DISALLOW_IMPLICIT_CONSTRUCTORS(AfterStartupTaskUtils);
60 };
61
62 #endif  // CHROME_BROWSER_AFTER_STARTUP_TASK_UTILS_H_