• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2018 The Android Open Source Project
3  *
4  * This code is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License version 2 only, as
6  * published by the Free Software Foundation.  The Android Open Source
7  * Project designates this particular file as subject to the "Classpath"
8  * exception as provided by The Android Open Source Project in the LICENSE
9  * file that accompanied this code.
10  *
11  * This code is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14  * version 2 for more details (a copy is included in the LICENSE file that
15  * accompanied this code).
16  *
17  * You should have received a copy of the GNU General Public License version
18  * 2 along with this work; if not, write to the Free Software Foundation,
19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20  */
21 
22 #ifndef JNI_CONSTANTS_H_included
23 #define JNI_CONSTANTS_H_included
24 
25 #include <jni.h>
26 
27 /**
28  * A cache to avoid calling FindClass at runtime.
29  */
30 struct JniConstants {
31     // Initialized cached heap objects. This should be called in JNI_OnLoad.
32     static void Initialize(JNIEnv* env);
33 
34     // Invalidate cached heap objects. This should be called in JNI_OnUnload.
35     static void Invalidate();
36 
37     // Gets class representing SocketTagger from cache.
38     static jclass GetSocketTaggerClass(JNIEnv* env);
39 };
40 
41 #endif  // JNI_CONSTANTS_H_included
42