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

Unified Diff: include/v8.h

Issue 1145063002: Update ReturnValue to take non-deprecated versions of handles (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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 | no next file » | 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 55e86b3de82a55540bdc8dd6a865e7e585d1e75e..f52f8b8cfc6b8725748de27ae5896924d222aa07 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -835,8 +835,11 @@ class Global : public PersistentBase<T> {
typedef void MoveOnlyTypeForCPP03;
private:
+ template <class F>
+ friend class ReturnValue;
Global(Global&) = delete;
void operator=(Global&) = delete;
+ V8_INLINE T* operator*() const { return this->val_; }
};
@@ -2973,8 +2976,13 @@ class ReturnValue {
TYPE_CHECK(T, S);
}
// Handle setters
- template <typename S> V8_INLINE void Set(const Persistent<S>& handle);
- template <typename S> V8_INLINE void Set(const Handle<S> handle);
+ template <typename S>
+ V8_INLINE V8_DEPRECATE_SOON("Use Global<> instead",
+ void Set(const Persistent<S>& handle));
+ template <typename S>
+ V8_INLINE void Set(const Global<S>& handle);
+ template <typename S>
+ V8_INLINE void Set(const Local<S> handle);
// Fast primitive setters
V8_INLINE void Set(bool value);
V8_INLINE void Set(double i);
@@ -7130,9 +7138,20 @@ void ReturnValue<T>::Set(const Persistent<S>& handle) {
}
}
-template<typename T>
-template<typename S>
-void ReturnValue<T>::Set(const Handle<S> handle) {
+template <typename T>
+template <typename S>
+void ReturnValue<T>::Set(const Global<S>& handle) {
+ TYPE_CHECK(T, S);
+ if (V8_UNLIKELY(handle.IsEmpty())) {
+ *value_ = GetDefaultValue();
+ } else {
+ *value_ = *reinterpret_cast<internal::Object**>(*handle);
+ }
+}
+
+template <typename T>
+template <typename S>
+void ReturnValue<T>::Set(const Local<S> handle) {
TYPE_CHECK(T, S);
if (V8_UNLIKELY(handle.IsEmpty())) {
*value_ = GetDefaultValue();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698