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

Unified Diff: base/android/scoped_java_ref.h

Issue 1308413003: Inline constructors/destructor for JavaRef. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: also comment .cc file Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/android/scoped_java_ref.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/android/scoped_java_ref.h
diff --git a/base/android/scoped_java_ref.h b/base/android/scoped_java_ref.h
index 8047ee8c16725ab0470acc1b71dfb77f5594e439..9f816216cf13abfd7ed64adf62a8aa3bc6eb0194 100644
--- a/base/android/scoped_java_ref.h
+++ b/base/android/scoped_java_ref.h
@@ -10,6 +10,7 @@
#include "base/base_export.h"
#include "base/basictypes.h"
+#include "base/logging.h"
namespace base {
namespace android {
@@ -45,14 +46,21 @@ class BASE_EXPORT JavaRef<jobject> {
bool is_null() const { return obj_ == NULL; }
protected:
- // Initializes a NULL reference.
- JavaRef();
+ // Initializes a NULL reference. Don't add anything else here; it's inlined.
+ JavaRef() : obj_(NULL) {}
// Takes ownership of the |obj| reference passed; requires it to be a local
// reference type.
+#if DCHECK_IS_ON()
+ // Implementation contains a DCHECK; implement out-of-line when DCHECK_IS_ON.
JavaRef(JNIEnv* env, jobject obj);
+#else
+ // Don't add anything else here; it's inlined.
+ JavaRef(JNIEnv* env, jobject obj) : obj_(obj) {}
+#endif
- ~JavaRef();
+ // Don't add anything else here; it's inlined.
+ ~JavaRef() {}
// The following are implementation detail convenience methods, for
// use by the sub-classes.
« no previous file with comments | « no previous file | base/android/scoped_java_ref.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698