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

Unified Diff: Source/modules/webdatabase/SQLResultSetRowList.cpp

Issue 972153002: [bindings] Remove custom binding usage in SQLResultSetRowList. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@test
Patch Set: Created 5 years, 10 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: Source/modules/webdatabase/SQLResultSetRowList.cpp
diff --git a/Source/modules/webdatabase/SQLResultSetRowList.cpp b/Source/modules/webdatabase/SQLResultSetRowList.cpp
index 1d16c5e4e84cfb40825699f0a7e9d65809161d43..c78b22e008a8adb2311c610cd3657b82800d735c 100644
--- a/Source/modules/webdatabase/SQLResultSetRowList.cpp
+++ b/Source/modules/webdatabase/SQLResultSetRowList.cpp
@@ -29,6 +29,8 @@
#include "config.h"
#include "modules/webdatabase/SQLResultSetRowList.h"
+#include "bindings/core/v8/V8Binding.h"
+
namespace blink {
unsigned SQLResultSetRowList::length() const
@@ -41,4 +43,32 @@ unsigned SQLResultSetRowList::length() const
return m_result.size() / m_columns.size();
}
+ScriptValue SQLResultSetRowList::item(unsigned index, ExceptionState&)
haraken 2015/03/03 15:02:00 This function contains a bunch of V8 APIs. In term
+{
+ v8::Isolate* isolate = v8::Isolate::GetCurrent();
+ v8::Local<v8::Object> item = v8::Object::New(isolate);
+ unsigned numColumns = m_columns.size();
+ unsigned valuesIndex = index * numColumns;
+
+ for (unsigned i = 0; i < numColumns; ++i) {
+ const SQLValue& sqlValue = m_result[valuesIndex + i];
+ v8::Local<v8::Value> value;
+ switch (sqlValue.type()) {
+ case SQLValue::StringValue:
+ value = v8String(isolate, sqlValue.string());
+ break;
+ case SQLValue::NullValue:
+ value = v8::Null(isolate);
+ break;
+ case SQLValue::NumberValue:
+ value = v8::Number::New(isolate, sqlValue.number());
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+ item->ForceSet(v8String(isolate, m_columns[i]), value, static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::ReadOnly));
haraken 2015/03/04 04:06:35 I'm wondering why this is using ForceSet. I think
+ }
+ return ScriptValue(ScriptState::current(isolate), item);
+}
+
}
« no previous file with comments | « Source/modules/webdatabase/SQLResultSetRowList.h ('k') | Source/modules/webdatabase/SQLResultSetRowList.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698