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

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

Issue 2334123002: Web Animations: Support iterator protocol in property indexed keyframe values (Closed)
Patch Set: Add missing null check Created 4 years, 3 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
Index: third_party/WebKit/Source/bindings/core/v8/DictionaryIterator.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/DictionaryIterator.cpp b/third_party/WebKit/Source/bindings/core/v8/DictionaryIterator.cpp
index 7c85bc76ff47db7a822f9729436399313816c058..089d49da898b0f6dafa154fa73f9a6e1b9624d62 100644
--- a/third_party/WebKit/Source/bindings/core/v8/DictionaryIterator.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/DictionaryIterator.cpp
@@ -8,6 +8,8 @@
#include "bindings/core/v8/ExceptionState.h"
#include "bindings/core/v8/ScriptController.h"
#include "bindings/core/v8/V8Binding.h"
+#include "bindings/core/v8/V8StringResource.h"
+#include "wtf/text/WTFString.h"
namespace blink {
@@ -19,12 +21,12 @@ DictionaryIterator::DictionaryIterator(v8::Local<v8::Object> iterator, v8::Isola
, m_valueKey(v8String(isolate, "value"))
, m_done(false)
{
- ASSERT(!iterator.IsEmpty());
+ DCHECK(!iterator.IsEmpty());
}
bool DictionaryIterator::next(ExecutionContext* executionContext, ExceptionState& exceptionState)
{
- ASSERT(!isNull());
+ DCHECK(!isNull());
v8::Local<v8::Value> next;
// TODO(alancutter): Support callable objects as well as functions.
@@ -56,8 +58,8 @@ bool DictionaryIterator::next(ExecutionContext* executionContext, ExceptionState
bool DictionaryIterator::valueAsDictionary(Dictionary& result, ExceptionState& exceptionState)
{
- ASSERT(!isNull());
- ASSERT(!m_done);
+ DCHECK(!isNull());
+ DCHECK(!m_done);
v8::Local<v8::Value> value;
if (!v8Call(m_value, value) || !value->IsObject())
@@ -67,5 +69,22 @@ bool DictionaryIterator::valueAsDictionary(Dictionary& result, ExceptionState& e
return true;
}
+bool DictionaryIterator::valueAsString(String& result)
+{
+ DCHECK(!isNull());
+ DCHECK(!m_done);
+
+ v8::Local<v8::Value> value;
+ if (!v8Call(m_value, value))
+ return false;
+
+ V8StringResource<> stringValue(value);
+ if (!stringValue.prepare())
+ return false;
+ result = stringValue;
+ return true;
+
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698