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

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: Fixed nitts Created 9 years, 5 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
12 namespace base {
13 namespace android {
14
15 // A global reference to a Java object which is cleaned up automatically when
16 // this object gets deleted.
17 class AutoGlobalJObject {
18 public:
19 // Takes ownership of |obj|.
20 static AutoGlobalJObject FromLocalRef(JNIEnv* env, jobject obj);
brettw 2011/08/01 16:03:54 There's not a defined place for this in the header
steveblock 2011/08/02 15:05:46 Done.
21
22 AutoGlobalJObject();
23 AutoGlobalJObject(const AutoGlobalJObject& other);
brettw 2011/08/01 16:03:54 Do you need an implicit copy constructor? These ar
steveblock 2011/08/02 15:05:46 We don't need one for AutoGlobalJObject (other tha
brettw 2011/08/02 15:55:39 If you're going to be returning these by value, it
24 explicit AutoGlobalJObject(const AutoJObject& obj);
25 ~AutoGlobalJObject();
26
27 void Reset();
28 void Reset(const AutoGlobalJObject& other);
29 jobject obj() const;
brettw 2011/08/01 16:03:54 This should be inline. If it can't be, it should b
steveblock 2011/08/02 15:05:46 Done.
30
31 private:
32 // Not permitted.
33 AutoGlobalJObject& operator=(const AutoGlobalJObject& other);
34
35 JNIEnv* env_;
36 jobject obj_;
37 };
38
39 } // namespace android
40 } // namespace base
41
42 #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