summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2010-04-16 17:44:12 -0700
committerElliott Hughes <enh@google.com>2010-04-16 17:44:12 -0700
commitc08f9fb2a3be82bb1a3f477ca1524ddcf7a1d4b8 (patch)
treecc325048a7dc4cb15eb2f39244c3b881b284644d /include
parent757a7942eed2b0aa457f8517a0259d2ac82c5b18 (diff)
downloadlibcore-c08f9fb2a3be82bb1a3f477ca1524ddcf7a1d4b8.zip
libcore-c08f9fb2a3be82bb1a3f477ca1524ddcf7a1d4b8.tar.gz
libcore-c08f9fb2a3be82bb1a3f477ca1524ddcf7a1d4b8.tar.bz2
Move the libcore registration out of libnativehelpers and into libcore.
Bug: 754114 Change-Id: Iaa03def509c10cbaa12fd2128584b93d4be4a6b7
Diffstat (limited to 'include')
-rw-r--r--include/ScopedLocalFrame.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/include/ScopedLocalFrame.h b/include/ScopedLocalFrame.h
new file mode 100644
index 0000000..35b6ad8
--- /dev/null
+++ b/include/ScopedLocalFrame.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SCOPED_LOCAL_FRAME_H_included
+#define SCOPED_LOCAL_FRAME_H_included
+
+#include "JNIHelp.h"
+
+class ScopedLocalFrame {
+public:
+ ScopedLocalFrame(JNIEnv* env) : mEnv(env) {
+ mEnv->PushLocalFrame(128);
+ }
+
+ ~ScopedLocalFrame() {
+ mEnv->PopLocalFrame(NULL);
+ }
+
+private:
+ JNIEnv* mEnv;
+
+ // Disallow copy and assignment.
+ ScopedLocalFrame(const ScopedLocalFrame&);
+ void operator=(const ScopedLocalFrame&);
+};
+
+#endif // SCOPED_LOCAL_FRAME_H_included