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

Unified Diff: Source/modules/indexeddb/IDBVersionChangeEvent.cpp

Issue 386883008: Converted IDBVersionChangeEvent.dataLoss to an enumeration: IDBDataLossAmount (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added link to W3C's IDL spec Created 6 years, 5 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/indexeddb/IDBVersionChangeEvent.cpp
diff --git a/Source/modules/indexeddb/IDBVersionChangeEvent.cpp b/Source/modules/indexeddb/IDBVersionChangeEvent.cpp
index e55fdfca2febe05a495a1d15b9a8b6c59ba666f5..499c2aa8ad0f67d2f04fae4d4a9dd1488b22741c 100644
--- a/Source/modules/indexeddb/IDBVersionChangeEvent.cpp
+++ b/Source/modules/indexeddb/IDBVersionChangeEvent.cpp
@@ -26,6 +26,7 @@
#include "config.h"
#include "modules/indexeddb/IDBVersionChangeEvent.h"
+#include "bindings/core/v8/V8Binding.h"
#include "bindings/modules/v8/IDBBindingUtilities.h"
namespace WebCore {
@@ -33,6 +34,7 @@ namespace WebCore {
IDBVersionChangeEventInit::IDBVersionChangeEventInit()
: oldVersion(0)
+ , dataLoss(blink::WebIDBDataLossNone)
{
}
@@ -56,7 +58,7 @@ IDBVersionChangeEvent::IDBVersionChangeEvent(const AtomicString& eventType, cons
: Event(eventType, false /*canBubble*/, false /*cancelable*/)
, m_oldVersion(initializer.oldVersion)
, m_newVersion(initializer.newVersion)
- , m_dataLoss(blink::WebIDBDataLossNone)
+ , m_dataLoss(initializer.dataLoss)
{
ScriptWrappable::init(this);
}
@@ -86,4 +88,18 @@ void IDBVersionChangeEvent::trace(Visitor* visitor)
Event::trace(visitor);
}
+bool IDBVersionChangeEvent::toNativeDataLoss(v8::Handle<v8::Value> value, blink::WebIDBDataLoss* dataLoss)
+{
+ String strValue = toCoreStringWithUndefinedOrNullCheck(value);
+ if (strValue == "none") {
+ *dataLoss = blink::WebIDBDataLossNone;
+ return true;
+ }
+ if (strValue == "total") {
+ *dataLoss = blink::WebIDBDataLossTotal;
+ return true;
+ }
+ return false;
+}
+
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698