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

Unified Diff: include/v8.h

Issue 22932004: Adding missing operator!= for Handle and Persistent. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: renamed test Created 7 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 | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index 3252602bcf19d8fabba52e0c7fbbd274615f7ff2..b81645081e577a21685f0f4d1f61ffb124e5c61f 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -303,7 +303,7 @@ template <class T> class Handle {
* to which they refer are identical.
* The handles' references are not checked.
*/
- template <class S> V8_INLINE(bool operator==(const Handle<S> that) const) {
+ template <class S> V8_INLINE(bool operator==(const Handle<S>& that) const) {
internal::Object** a = reinterpret_cast<internal::Object**>(**this);
internal::Object** b = reinterpret_cast<internal::Object**>(*that);
if (a == 0) return b == 0;
@@ -328,10 +328,17 @@ template <class T> class Handle {
* the objects to which they refer are different.
* The handles' references are not checked.
*/
- template <class S> V8_INLINE(bool operator!=(Handle<S> that) const) {
+ template <class S> V8_INLINE(bool operator!=(const Handle<S>& that) const) {
return !operator==(that);
}
+#ifndef V8_USE_UNSAFE_HANDLES
+ template <class S> V8_INLINE(
+ bool operator!=(const Persistent<S>& that) const) {
+ return !operator==(that);
+ }
+#endif
+
template <class S> V8_INLINE(static Handle<T> Cast(Handle<S> that)) {
#ifdef V8_ENABLE_CHECKS
// If we're going to perform the type check then we have to check
@@ -618,13 +625,22 @@ template <class T> class Persistent // NOLINT
return *a == *b;
}
- template <class S> V8_INLINE(bool operator==(const Handle<S> that) const) {
+ template <class S> V8_INLINE(bool operator==(const Handle<S>& that) const) {
internal::Object** a = reinterpret_cast<internal::Object**>(**this);
internal::Object** b = reinterpret_cast<internal::Object**>(*that);
if (a == 0) return b == 0;
if (b == 0) return false;
return *a == *b;
}
+
+ template <class S> V8_INLINE(
+ bool operator!=(const Persistent<S>& that) const) {
+ return !operator==(that);
+ }
+
+ template <class S> V8_INLINE(bool operator!=(const Handle<S>& that) const) {
+ return !operator==(that);
+ }
#endif
V8_INLINE(void Dispose());
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698