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

Unified Diff: include/v8.h

Issue 1017663002: add missing dcheck to ToLocalChecked (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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 | src/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 db625eeb4242be3d594628fdf8f2f450d0ef894e..10152f60e93eb51cf487522c1f65a156f9e48070 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -429,10 +429,7 @@ class MaybeLocal {
return !IsEmpty();
}
- V8_INLINE Local<T> ToLocalChecked() {
- // TODO(dcarney): add DCHECK.
- return Local<T>(val_);
- }
+ V8_INLINE Local<T> ToLocalChecked();
template <class S>
V8_INLINE Local<S> FromMaybe(Local<S> default_value) const {
@@ -5893,10 +5890,13 @@ class V8_EXPORT V8 {
static Local<Value> GetEternal(Isolate* isolate, int index);
static void CheckIsJust(bool is_just);
+ static void ToLocalEmpty();
template <class T> friend class Handle;
template <class T> friend class Local;
template <class T>
+ friend class MaybeLocal;
+ template <class T>
friend class Maybe;
template <class T> friend class Eternal;
template <class T> friend class PersistentBase;
@@ -6726,6 +6726,15 @@ Local<T> Eternal<T>::Get(Isolate* isolate) {
template <class T>
+Local<T> MaybeLocal<T>::ToLocalChecked() {
+#ifdef V8_ENABLE_CHECKS
+ if (val_ == nullptr) V8::ToLocalEmpty();
+#endif
+ return Local<T>(val_);
+}
+
+
+template <class T>
T* PersistentBase<T>::New(Isolate* isolate, T* that) {
if (that == NULL) return NULL;
internal::Object** p = reinterpret_cast<internal::Object**>(that);
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698