Avi Drissman | 4e1b7bc3 | 2022-09-15 14:03:50 | [diff] [blame] | 1 | // Copyright 2013 The Chromium Authors |
[email protected] | 57624ab | 2013-08-01 16:01:51 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
[email protected] | ddb4b20 | 2013-08-20 22:55:54 | [diff] [blame] | 5 | #include "content/browser/android/browser_startup_controller.h" |
[email protected] | 57624ab | 2013-08-01 16:01:51 | [diff] [blame] | 6 | |
7 | #include "base/android/jni_android.h" | ||||
[email protected] | 232e09d | 2013-08-27 15:29:56 | [diff] [blame] | 8 | #include "base/android/jni_string.h" |
9 | #include "content/browser/android/content_startup_flags.h" | ||||
Bo Liu | 79c92c3b | 2017-06-28 18:52:25 | [diff] [blame] | 10 | #include "content/browser/browser_main_loop.h" |
Andrew Grieve | ecb885bb | 2024-05-29 18:14:19 | [diff] [blame] | 11 | |
12 | // Must come after all headers that specialize FromJniType() / ToJniType(). | ||||
Andrew Grieve | 63cbd8ab | 2023-06-19 21:16:40 | [diff] [blame] | 13 | #include "content/public/android/content_main_dex_jni/BrowserStartupControllerImpl_jni.h" |
[email protected] | 57624ab | 2013-08-01 16:01:51 | [diff] [blame] | 14 | |
torne | 8656011 | 2016-08-04 15:59:04 | [diff] [blame] | 15 | using base::android::JavaParamRef; |
16 | |||||
[email protected] | 57624ab | 2013-08-01 16:01:51 | [diff] [blame] | 17 | namespace content { |
18 | |||||
Chidera Olibie | 76bdf2a | 2025-07-04 19:10:32 | [diff] [blame] | 19 | void BrowserStartupComplete(int result, |
20 | base::TimeDelta longest_blocking_duration) { | ||||
[email protected] | 57624ab | 2013-08-01 16:01:51 | [diff] [blame] | 21 | JNIEnv* env = base::android::AttachCurrentThread(); |
Chidera Olibie | 76bdf2a | 2025-07-04 19:10:32 | [diff] [blame] | 22 | Java_BrowserStartupControllerImpl_browserStartupComplete( |
23 | env, result, longest_blocking_duration.InMilliseconds()); | ||||
[email protected] | 57624ab | 2013-08-01 16:01:51 | [diff] [blame] | 24 | } |
25 | |||||
Ken Rockot | 5937501 | 2020-11-17 20:16:33 | [diff] [blame] | 26 | void MinimalBrowserStartupComplete() { |
Min Qin | 26d1c8e | 2018-06-20 05:19:39 | [diff] [blame] | 27 | JNIEnv* env = base::android::AttachCurrentThread(); |
Ken Rockot | 5937501 | 2020-11-17 20:16:33 | [diff] [blame] | 28 | Java_BrowserStartupControllerImpl_minimalBrowserStartupComplete(env); |
Min Qin | 26d1c8e | 2018-06-20 05:19:39 | [diff] [blame] | 29 | } |
30 | |||||
qinmin | e1b9680 | 2016-05-05 23:00:18 | [diff] [blame] | 31 | bool ShouldStartGpuProcessOnBrowserStartup() { |
32 | JNIEnv* env = base::android::AttachCurrentThread(); | ||||
Jinsuk Kim | 796efeaf | 2018-05-27 01:41:55 | [diff] [blame] | 33 | return Java_BrowserStartupControllerImpl_shouldStartGpuProcessOnBrowserStartup( |
qinmin | e1b9680 | 2016-05-05 23:00:18 | [diff] [blame] | 34 | env); |
35 | } | ||||
36 | |||||
Jinsuk Kim | 796efeaf | 2018-05-27 01:41:55 | [diff] [blame] | 37 | static void JNI_BrowserStartupControllerImpl_SetCommandLineFlags( |
torne | 89cc5d9 | 2015-09-04 11:16:35 | [diff] [blame] | 38 | JNIEnv* env, |
Peter Collingbourne | f8f19b4 | 2018-06-29 21:26:26 | [diff] [blame] | 39 | jboolean single_process) { |
40 | SetContentCommandLineFlags(static_cast<bool>(single_process)); | ||||
[email protected] | 232e09d | 2013-08-27 15:29:56 | [diff] [blame] | 41 | } |
42 | |||||
Aiden Benner | c99e905 | 2018-11-30 20:50:50 | [diff] [blame] | 43 | static void JNI_BrowserStartupControllerImpl_FlushStartupTasks(JNIEnv* env) { |
Bo Liu | 79c92c3b | 2017-06-28 18:52:25 | [diff] [blame] | 44 | BrowserMainLoop::GetInstance()->SynchronouslyFlushStartupTasks(); |
45 | } | ||||
46 | |||||
[email protected] | 57624ab | 2013-08-01 16:01:51 | [diff] [blame] | 47 | } // namespace content |