| 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 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 IDBVersionChangeEvent::IDBVersionChangeEvent() | 32 IDBVersionChangeEvent::IDBVersionChangeEvent() |
| 33 : data_loss_(kWebIDBDataLossNone) {} | 33 : data_loss_(kWebIDBDataLossNone) {} |
| 34 | 34 |
| 35 IDBVersionChangeEvent::IDBVersionChangeEvent( | 35 IDBVersionChangeEvent::IDBVersionChangeEvent( |
| 36 const AtomicString& event_type, | 36 const AtomicString& event_type, |
| 37 unsigned long long old_version, | 37 unsigned long long old_version, |
| 38 const Nullable<unsigned long long>& new_version, | 38 const Nullable<unsigned long long>& new_version, |
| 39 WebIDBDataLoss data_loss, | 39 WebIDBDataLoss data_loss, |
| 40 const String& data_loss_message) | 40 const String& data_loss_message) |
| 41 : Event(event_type, false /*canBubble*/, false /*cancelable*/), | 41 : Event(event_type, /*can_bubble=*/false, /*cancelable=*/false), |
| 42 old_version_(old_version), | 42 old_version_(old_version), |
| 43 new_version_(new_version), | 43 new_version_(new_version), |
| 44 data_loss_(data_loss), | 44 data_loss_(data_loss), |
| 45 data_loss_message_(data_loss_message) {} | 45 data_loss_message_(data_loss_message) {} |
| 46 | 46 |
| 47 IDBVersionChangeEvent::IDBVersionChangeEvent( | 47 IDBVersionChangeEvent::IDBVersionChangeEvent( |
| 48 const AtomicString& event_type, | 48 const AtomicString& event_type, |
| 49 const IDBVersionChangeEventInit& initializer) | 49 const IDBVersionChangeEventInit& initializer) |
| 50 : Event(event_type, false /*canBubble*/, false /*cancelable*/), | 50 : Event(event_type, /*can_bubble=*/false, /*cancelable=*/false), |
| 51 old_version_(initializer.oldVersion()), | 51 old_version_(initializer.oldVersion()), |
| 52 new_version_(nullptr), | 52 new_version_(nullptr), |
| 53 data_loss_(kWebIDBDataLossNone) { | 53 data_loss_(kWebIDBDataLossNone) { |
| 54 if (initializer.hasNewVersion()) | 54 if (initializer.hasNewVersion()) |
| 55 new_version_ = initializer.newVersion(); | 55 new_version_ = initializer.newVersion(); |
| 56 if (initializer.dataLoss() == "total") | 56 if (initializer.dataLoss() == "total") |
| 57 data_loss_ = kWebIDBDataLossTotal; | 57 data_loss_ = kWebIDBDataLossTotal; |
| 58 } | 58 } |
| 59 | 59 |
| 60 unsigned long long IDBVersionChangeEvent::newVersion(bool& is_null) const { | 60 unsigned long long IDBVersionChangeEvent::newVersion(bool& is_null) const { |
| 61 is_null = new_version_.IsNull(); | 61 is_null = new_version_.IsNull(); |
| 62 return is_null ? 0 : new_version_.Get(); | 62 return is_null ? 0 : new_version_.Get(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 const AtomicString& IDBVersionChangeEvent::dataLoss() const { | 65 const AtomicString& IDBVersionChangeEvent::dataLoss() const { |
| 66 if (data_loss_ == kWebIDBDataLossTotal) | 66 if (data_loss_ == kWebIDBDataLossTotal) |
| 67 return IndexedDBNames::total; | 67 return IndexedDBNames::total; |
| 68 return IndexedDBNames::none; | 68 return IndexedDBNames::none; |
| 69 } | 69 } |
| 70 | 70 |
| 71 const AtomicString& IDBVersionChangeEvent::InterfaceName() const { | 71 const AtomicString& IDBVersionChangeEvent::InterfaceName() const { |
| 72 return EventNames::IDBVersionChangeEvent; | 72 return EventNames::IDBVersionChangeEvent; |
| 73 } | 73 } |
| 74 | 74 |
| 75 DEFINE_TRACE(IDBVersionChangeEvent) { | 75 DEFINE_TRACE(IDBVersionChangeEvent) { |
| 76 Event::Trace(visitor); | 76 Event::Trace(visitor); |
| 77 } | 77 } |
| 78 | 78 |
| 79 } // namespace blink | 79 } // namespace blink |
| OLD | NEW |