1 // Copyright 2019 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "base/command_line.h" 6 #include "base/process/current_process.h" 7 #include "base/trace_event/trace_log.h" 8 #include "base/tracing_buildflags.h" 9 10 // Must come after all headers that specialize FromJniType() / ToJniType(). 11 #include "base/base_javatests_jni/EarlyNativeTest_jni.h" 12 13 namespace base { 14 15 // Ensures that the LibraryLoader swapped over to the native command line. JNI_EarlyNativeTest_IsCommandLineInitialized(JNIEnv * env)16jboolean JNI_EarlyNativeTest_IsCommandLineInitialized(JNIEnv* env) { 17 return CommandLine::InitializedForCurrentProcess(); 18 } 19 20 // Ensures that native initialization took place, allowing early native code to 21 // use things like Tracing that don't depend on content initialization. JNI_EarlyNativeTest_IsProcessNameEmpty(JNIEnv * env)22jboolean JNI_EarlyNativeTest_IsProcessNameEmpty(JNIEnv* env) { 23 #if BUILDFLAG(ENABLE_BASE_TRACING) 24 return CurrentProcess::GetInstance().IsProcessNameEmpty(); 25 #else // BUILDFLAG(ENABLE_BASE_TRACING) 26 return false; 27 #endif // BUILDFLAG(ENABLE_BASE_TRACING) 28 } 29 30 } // namespace base 31