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

Unified Diff: Source/core/dom/SomeDictionaryUser.cpp

Issue 386963003: [WIP][NotForLand] IDL dictionary support (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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/core/dom/SomeDictionaryUser.cpp
diff --git a/Source/core/dom/SomeDictionaryUser.cpp b/Source/core/dom/SomeDictionaryUser.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..e617c3e64beaafefc6e198af1f298e513825d33e
--- /dev/null
+++ b/Source/core/dom/SomeDictionaryUser.cpp
@@ -0,0 +1,41 @@
+// NOT FOR LAND
+#include "config.h"
+#include "SomeDictionaryUser.h"
+
+namespace WebCore {
+
+SomeDictionaryUser::SomeDictionaryUser()
+ : m_a(0)
+ , m_hasA(false)
+ , m_b(0)
haraken 2014/07/21 16:11:59 This should be m_b(2). The default value of m_b is
bashi 2014/07/22 02:33:58 Yes. But actually, there is no need for the defaul
+{
+ ScriptWrappable::init(this);
+}
+
+SomeDictionaryUser::~SomeDictionaryUser()
+{
+}
+
+void SomeDictionaryUser::set(const SomeDictionary* someDictionary)
+{
+ if (someDictionary->hasA()) {
+ m_a = someDictionary->a();
+ m_hasA = true;
+ }
+ m_b = someDictionary->b();
+ m_stringMember = someDictionary->stringMember();
+ m_element = someDictionary->element();
+}
+
+SomeDictionary* SomeDictionaryUser::get()
+{
+ SomeDictionary* result = SomeDictionary::create();
+ if (m_hasA)
+ result->setA(m_a);
+ result->setB(m_b);
haraken 2014/07/21 16:11:59 If introducing m_hasB makes things more consistent
bashi 2014/07/22 02:33:58 Yes. I should have introduced m_hasB for consisten
+ result->setStringMember(m_stringMember);
+ result->setElement(m_element);
+ return result;
+}
+
+}

Powered by Google App Engine
This is Rietveld 408576698