OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 12 matching lines...) Expand all Loading... |
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #include "config.h" | 26 #include "config.h" |
27 #include "modules/indexeddb/IDBVersionChangeEvent.h" | 27 #include "modules/indexeddb/IDBVersionChangeEvent.h" |
28 | 28 |
29 #include "modules/IndexedDBNames.h" | 29 #include "modules/IndexedDBNames.h" |
30 | 30 |
31 namespace blink { | 31 namespace blink { |
32 | 32 |
33 | |
34 IDBVersionChangeEventInit::IDBVersionChangeEventInit() | 33 IDBVersionChangeEventInit::IDBVersionChangeEventInit() |
35 : oldVersion(0) | 34 : oldVersion(0) |
36 { | 35 { |
37 } | 36 } |
38 | 37 |
39 IDBVersionChangeEvent::IDBVersionChangeEvent() | 38 IDBVersionChangeEvent::IDBVersionChangeEvent() |
40 : m_dataLoss(blink::WebIDBDataLossNone) | 39 : m_dataLoss(WebIDBDataLossNone) |
41 { | 40 { |
42 ScriptWrappable::init(this); | 41 ScriptWrappable::init(this); |
43 } | 42 } |
44 | 43 |
45 IDBVersionChangeEvent::IDBVersionChangeEvent(const AtomicString& eventType, unsi
gned long long oldVersion, const Nullable<unsigned long long>& newVersion, blink
::WebIDBDataLoss dataLoss, const String& dataLossMessage) | 44 IDBVersionChangeEvent::IDBVersionChangeEvent(const AtomicString& eventType, unsi
gned long long oldVersion, const Nullable<unsigned long long>& newVersion, WebID
BDataLoss dataLoss, const String& dataLossMessage) |
46 : Event(eventType, false /*canBubble*/, false /*cancelable*/) | 45 : Event(eventType, false /*canBubble*/, false /*cancelable*/) |
47 , m_oldVersion(oldVersion) | 46 , m_oldVersion(oldVersion) |
48 , m_newVersion(newVersion) | 47 , m_newVersion(newVersion) |
49 , m_dataLoss(dataLoss) | 48 , m_dataLoss(dataLoss) |
50 , m_dataLossMessage(dataLossMessage) | 49 , m_dataLossMessage(dataLossMessage) |
51 { | 50 { |
52 ScriptWrappable::init(this); | 51 ScriptWrappable::init(this); |
53 } | 52 } |
54 | 53 |
55 IDBVersionChangeEvent::IDBVersionChangeEvent(const AtomicString& eventType, cons
t IDBVersionChangeEventInit& initializer) | 54 IDBVersionChangeEvent::IDBVersionChangeEvent(const AtomicString& eventType, cons
t IDBVersionChangeEventInit& initializer) |
56 : Event(eventType, false /*canBubble*/, false /*cancelable*/) | 55 : Event(eventType, false /*canBubble*/, false /*cancelable*/) |
57 , m_oldVersion(initializer.oldVersion) | 56 , m_oldVersion(initializer.oldVersion) |
58 , m_newVersion(initializer.newVersion) | 57 , m_newVersion(initializer.newVersion) |
59 , m_dataLoss(blink::WebIDBDataLossNone) | 58 , m_dataLoss(WebIDBDataLossNone) |
60 { | 59 { |
61 if (initializer.dataLoss.isEmpty() || initializer.dataLoss == "none") | 60 if (initializer.dataLoss.isEmpty() || initializer.dataLoss == "none") |
62 m_dataLoss = blink::WebIDBDataLossNone; | 61 m_dataLoss = WebIDBDataLossNone; |
63 else if (initializer.dataLoss == "total") | 62 else if (initializer.dataLoss == "total") |
64 m_dataLoss = blink::WebIDBDataLossTotal; | 63 m_dataLoss = WebIDBDataLossTotal; |
65 ScriptWrappable::init(this); | 64 ScriptWrappable::init(this); |
66 } | 65 } |
67 | 66 |
68 unsigned long long IDBVersionChangeEvent::newVersion(bool& isNull) const | 67 unsigned long long IDBVersionChangeEvent::newVersion(bool& isNull) const |
69 { | 68 { |
70 isNull = m_newVersion.isNull(); | 69 isNull = m_newVersion.isNull(); |
71 return isNull ? 0 : m_newVersion.get(); | 70 return isNull ? 0 : m_newVersion.get(); |
72 } | 71 } |
73 | 72 |
74 const AtomicString& IDBVersionChangeEvent::dataLoss() const | 73 const AtomicString& IDBVersionChangeEvent::dataLoss() const |
75 { | 74 { |
76 if (m_dataLoss == blink::WebIDBDataLossTotal) | 75 if (m_dataLoss == WebIDBDataLossTotal) |
77 return IndexedDBNames::total; | 76 return IndexedDBNames::total; |
78 return IndexedDBNames::none; | 77 return IndexedDBNames::none; |
79 } | 78 } |
80 | 79 |
81 const AtomicString& IDBVersionChangeEvent::interfaceName() const | 80 const AtomicString& IDBVersionChangeEvent::interfaceName() const |
82 { | 81 { |
83 return EventNames::IDBVersionChangeEvent; | 82 return EventNames::IDBVersionChangeEvent; |
84 } | 83 } |
85 | 84 |
86 void IDBVersionChangeEvent::trace(Visitor* visitor) | 85 void IDBVersionChangeEvent::trace(Visitor* visitor) |
87 { | 86 { |
88 Event::trace(visitor); | 87 Event::trace(visitor); |
89 } | 88 } |
90 | 89 |
91 } // namespace blink | 90 } // namespace blink |
OLD | NEW |