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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/V8IteratorResultValue.cpp

Issue 1492763002: Add a utility class to call stream methods implemented with v8 extras. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@v8-extra-switch
Patch Set: Created 5 years 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
Index: third_party/WebKit/Source/bindings/core/v8/V8IteratorResultValue.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8IteratorResultValue.cpp b/third_party/WebKit/Source/bindings/core/v8/V8IteratorResultValue.cpp
index 739e3a075c546e8039e9ae376604ed72ff869d5f..e2ef6733833451d55b0e292510f2eec26efa1d13 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8IteratorResultValue.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8IteratorResultValue.cpp
@@ -18,4 +18,20 @@ v8::Local<v8::Object> v8IteratorResultValue(v8::Isolate* isolate, bool done, v8:
return result;
}
+v8::MaybeLocal<v8::Value> v8IteratorUnpack(ScriptState* scriptState, v8::Local<v8::Value> iterator, bool* done)
haraken 2015/12/04 01:41:05 I don't fully understand why this method is needed
yhirano 2015/12/04 05:55:47 I plan to use it in the future, but moving it back
+{
+ if (!iterator->IsObject()) {
+ V8ThrowException::throwTypeError(scriptState->isolate(), "The iterator is not an object.");
+ return v8::MaybeLocal<v8::Value>();
+ }
+ v8::Local<v8::Object> object = iterator.As<v8::Object>();
+ v8::Local<v8::Value> doneValue;
+ if (!object->Get(scriptState->context(), v8String(scriptState->isolate(), "done")).ToLocal(&doneValue))
+ return v8::MaybeLocal<v8::Value>();
+ v8::MaybeLocal<v8::Value> r = object->Get(scriptState->context(), v8String(scriptState->isolate(), "value"));
+ if (!r.IsEmpty())
+ *done = doneValue->ToBoolean()->Value();
+ return r;
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698