blob: a6bbe44651542f1a6b4d821d1da804d2cbdfaacc [file] [log] [blame]
Avi Drissman4e1b7bc32022-09-15 14:03:501// Copyright 2013 The Chromium Authors
[email protected]57624ab2013-08-01 16:01:512// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]ddb4b202013-08-20 22:55:545#include "content/browser/android/browser_startup_controller.h"
[email protected]57624ab2013-08-01 16:01:516
7#include "base/android/jni_android.h"
[email protected]232e09d2013-08-27 15:29:568#include "base/android/jni_string.h"
9#include "content/browser/android/content_startup_flags.h"
Bo Liu79c92c3b2017-06-28 18:52:2510#include "content/browser/browser_main_loop.h"
Andrew Grieveecb885bb2024-05-29 18:14:1911
12// Must come after all headers that specialize FromJniType() / ToJniType().
Andrew Grieve63cbd8ab2023-06-19 21:16:4013#include "content/public/android/content_main_dex_jni/BrowserStartupControllerImpl_jni.h"
[email protected]57624ab2013-08-01 16:01:5114
torne86560112016-08-04 15:59:0415using base::android::JavaParamRef;
16
[email protected]57624ab2013-08-01 16:01:5117namespace content {
18
Chidera Olibie76bdf2a2025-07-04 19:10:3219void BrowserStartupComplete(int result,
20 base::TimeDelta longest_blocking_duration) {
[email protected]57624ab2013-08-01 16:01:5121 JNIEnv* env = base::android::AttachCurrentThread();
Chidera Olibie76bdf2a2025-07-04 19:10:3222 Java_BrowserStartupControllerImpl_browserStartupComplete(
23 env, result, longest_blocking_duration.InMilliseconds());
[email protected]57624ab2013-08-01 16:01:5124}
25
Ken Rockot59375012020-11-17 20:16:3326void MinimalBrowserStartupComplete() {
Min Qin26d1c8e2018-06-20 05:19:3927 JNIEnv* env = base::android::AttachCurrentThread();
Ken Rockot59375012020-11-17 20:16:3328 Java_BrowserStartupControllerImpl_minimalBrowserStartupComplete(env);
Min Qin26d1c8e2018-06-20 05:19:3929}
30
qinmine1b96802016-05-05 23:00:1831bool ShouldStartGpuProcessOnBrowserStartup() {
32 JNIEnv* env = base::android::AttachCurrentThread();
Jinsuk Kim796efeaf2018-05-27 01:41:5533 return Java_BrowserStartupControllerImpl_shouldStartGpuProcessOnBrowserStartup(
qinmine1b96802016-05-05 23:00:1834 env);
35}
36
Jinsuk Kim796efeaf2018-05-27 01:41:5537static void JNI_BrowserStartupControllerImpl_SetCommandLineFlags(
torne89cc5d92015-09-04 11:16:3538 JNIEnv* env,
Peter Collingbournef8f19b42018-06-29 21:26:2639 jboolean single_process) {
40 SetContentCommandLineFlags(static_cast<bool>(single_process));
[email protected]232e09d2013-08-27 15:29:5641}
42
Aiden Bennerc99e9052018-11-30 20:50:5043static void JNI_BrowserStartupControllerImpl_FlushStartupTasks(JNIEnv* env) {
Bo Liu79c92c3b2017-06-28 18:52:2544 BrowserMainLoop::GetInstance()->SynchronouslyFlushStartupTasks();
45}
46
[email protected]57624ab2013-08-01 16:01:5147} // namespace content