Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // NOT FOR LAND | |
| 2 #include "config.h" | |
| 3 #include "SomeDictionaryUser.h" | |
| 4 | |
| 5 namespace WebCore { | |
| 6 | |
| 7 SomeDictionaryUser::SomeDictionaryUser() | |
| 8 : m_a(0) | |
| 9 , m_hasA(false) | |
| 10 , 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
| |
| 11 { | |
| 12 ScriptWrappable::init(this); | |
| 13 } | |
| 14 | |
| 15 SomeDictionaryUser::~SomeDictionaryUser() | |
| 16 { | |
| 17 } | |
| 18 | |
| 19 void SomeDictionaryUser::set(const SomeDictionary* someDictionary) | |
| 20 { | |
| 21 if (someDictionary->hasA()) { | |
| 22 m_a = someDictionary->a(); | |
| 23 m_hasA = true; | |
| 24 } | |
| 25 m_b = someDictionary->b(); | |
| 26 m_stringMember = someDictionary->stringMember(); | |
| 27 m_element = someDictionary->element(); | |
| 28 } | |
| 29 | |
| 30 SomeDictionary* SomeDictionaryUser::get() | |
| 31 { | |
| 32 SomeDictionary* result = SomeDictionary::create(); | |
| 33 if (m_hasA) | |
| 34 result->setA(m_a); | |
| 35 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
| |
| 36 result->setStringMember(m_stringMember); | |
| 37 result->setElement(m_element); | |
| 38 return result; | |
| 39 } | |
| 40 | |
| 41 } | |
| OLD | NEW |