Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Side by Side Diff: base/android/auto_global_jobject.h

Issue 7480016: Add AutoJObject and AutoGlobalJObject (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Removed FromLocalRef() Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | base/android/auto_global_jobject.cc » ('j') | base/android/auto_jobject.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef BASE_ANDROID_AUTO_GLOBAL_JOBJECT_H_
6 #define BASE_ANDROID_AUTO_GLOBAL_JOBJECT_H_
7
8 #include <jni.h>
9
10 #include "base/android/auto_jobject.h"
11 #include "base/basictypes.h"
12
13 namespace base {
14 namespace android {
15
16 // Holds a global reference to a Java object. The global reference is scoped
17 // to the lifetime of this object.
18 class AutoGlobalJObject {
19 public:
20 // Holds a NULL reference.
21 AutoGlobalJObject();
22 // Takes a new global reference to the Java object held by obj. The global
23 // reference is deleted when this object goes out of scope.
24 explicit AutoGlobalJObject(const AutoJObject& obj);
25 ~AutoGlobalJObject();
26
27 void Reset();
28 void Reset(const AutoGlobalJObject& other);
29 inline jobject obj() const { return obj_; }
30
31 private:
32 DISALLOW_COPY_AND_ASSIGN(AutoGlobalJObject);
brettw 2011/08/02 15:55:39 This should be last.
33
34 JNIEnv* env_;
35 jobject obj_;
36 };
37
38 } // namespace android
39 } // namespace base
40
41 #endif // BASE_ANDROID_AUTO_GLOBAL_JOBJECT_H_
OLDNEW
« no previous file with comments | « no previous file | base/android/auto_global_jobject.cc » ('j') | base/android/auto_jobject.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698