• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/base_javatests_jni_headers/EarlyNativeTest_jni.h"
6 #include "base/command_line.h"
7 #include "base/process/current_process.h"
8 #include "base/trace_event/trace_log.h"
9 #include "base/tracing_buildflags.h"
10 
11 namespace base {
12 
13 // Ensures that the LibraryLoader swapped over to the native command line.
JNI_EarlyNativeTest_IsCommandLineInitialized(JNIEnv * env)14 jboolean JNI_EarlyNativeTest_IsCommandLineInitialized(JNIEnv* env) {
15   return CommandLine::InitializedForCurrentProcess();
16 }
17 
18 // Ensures that native initialization took place, allowing early native code to
19 // use things like Tracing that don't depend on content initialization.
JNI_EarlyNativeTest_IsProcessNameEmpty(JNIEnv * env)20 jboolean JNI_EarlyNativeTest_IsProcessNameEmpty(JNIEnv* env) {
21 #if BUILDFLAG(ENABLE_BASE_TRACING)
22   return CurrentProcess::GetInstance().IsProcessNameEmpty();
23 #else   // BUILDFLAG(ENABLE_BASE_TRACING)
24   return false;
25 #endif  // BUILDFLAG(ENABLE_BASE_TRACING)
26 }
27 
28 }  // namespace base
29