| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 class ExecutionContext; | 53 class ExecutionContext; |
| 54 | 54 |
| 55 class MODULES_EXPORT IDBDatabase final | 55 class MODULES_EXPORT IDBDatabase final |
| 56 : public RefCountedGarbageCollectedEventTargetWithInlineData<IDBDatabase> | 56 : public RefCountedGarbageCollectedEventTargetWithInlineData<IDBDatabase> |
| 57 , public ActiveDOMObject { | 57 , public ActiveDOMObject { |
| 58 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(IDBDatabase); | 58 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(IDBDatabase); |
| 59 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(IDBDatabase); | 59 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(IDBDatabase); |
| 60 DEFINE_WRAPPERTYPEINFO(); | 60 DEFINE_WRAPPERTYPEINFO(); |
| 61 public: | 61 public: |
| 62 static IDBDatabase* create(ExecutionContext*, PassOwnPtr<WebIDBDatabase>, ID
BDatabaseCallbacks*); | 62 static IDBDatabase* create(ExecutionContext*, PassOwnPtr<WebIDBDatabase>, ID
BDatabaseCallbacks*); |
| 63 virtual ~IDBDatabase(); | 63 ~IDBDatabase() override; |
| 64 DECLARE_VIRTUAL_TRACE(); | 64 DECLARE_VIRTUAL_TRACE(); |
| 65 | 65 |
| 66 void setMetadata(const IDBDatabaseMetadata& metadata) { m_metadata = metadat
a; } | 66 void setMetadata(const IDBDatabaseMetadata& metadata) { m_metadata = metadat
a; } |
| 67 void indexCreated(int64_t objectStoreId, const IDBIndexMetadata&); | 67 void indexCreated(int64_t objectStoreId, const IDBIndexMetadata&); |
| 68 void indexDeleted(int64_t objectStoreId, int64_t indexId); | 68 void indexDeleted(int64_t objectStoreId, int64_t indexId); |
| 69 void transactionCreated(IDBTransaction*); | 69 void transactionCreated(IDBTransaction*); |
| 70 void transactionFinished(const IDBTransaction*); | 70 void transactionFinished(const IDBTransaction*); |
| 71 | 71 |
| 72 // Implement the IDL | 72 // Implement the IDL |
| 73 const String& name() const { return m_metadata.name; } | 73 const String& name() const { return m_metadata.name; } |
| 74 void version(UnsignedLongLongOrString& result) const; | 74 void version(UnsignedLongLongOrString& result) const; |
| 75 PassRefPtrWillBeRawPtr<DOMStringList> objectStoreNames() const; | 75 PassRefPtrWillBeRawPtr<DOMStringList> objectStoreNames() const; |
| 76 | 76 |
| 77 IDBObjectStore* createObjectStore(const String& name, const IDBObjectStorePa
rameters& options, ExceptionState& exceptionState) { return createObjectStore(na
me, IDBKeyPath(options.keyPath()), options.autoIncrement(), exceptionState); } | 77 IDBObjectStore* createObjectStore(const String& name, const IDBObjectStorePa
rameters& options, ExceptionState& exceptionState) { return createObjectStore(na
me, IDBKeyPath(options.keyPath()), options.autoIncrement(), exceptionState); } |
| 78 IDBTransaction* transaction(ScriptState*, const StringOrStringSequenceOrDOMS
tringList&, const String& mode, ExceptionState&); | 78 IDBTransaction* transaction(ScriptState*, const StringOrStringSequenceOrDOMS
tringList&, const String& mode, ExceptionState&); |
| 79 void deleteObjectStore(const String& name, ExceptionState&); | 79 void deleteObjectStore(const String& name, ExceptionState&); |
| 80 void close(); | 80 void close(); |
| 81 | 81 |
| 82 DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); | 82 DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); |
| 83 DEFINE_ATTRIBUTE_EVENT_LISTENER(close); | 83 DEFINE_ATTRIBUTE_EVENT_LISTENER(close); |
| 84 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); | 84 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); |
| 85 DEFINE_ATTRIBUTE_EVENT_LISTENER(versionchange); | 85 DEFINE_ATTRIBUTE_EVENT_LISTENER(versionchange); |
| 86 | 86 |
| 87 // IDBDatabaseCallbacks | 87 // IDBDatabaseCallbacks |
| 88 void onVersionChange(int64_t oldVersion, int64_t newVersion); | 88 void onVersionChange(int64_t oldVersion, int64_t newVersion); |
| 89 void onAbort(int64_t, DOMError*); | 89 void onAbort(int64_t, DOMError*); |
| 90 void onComplete(int64_t); | 90 void onComplete(int64_t); |
| 91 | 91 |
| 92 // ActiveDOMObject | 92 // ActiveDOMObject |
| 93 virtual bool hasPendingActivity() const override; | 93 bool hasPendingActivity() const override; |
| 94 virtual void stop() override; | 94 void stop() override; |
| 95 | 95 |
| 96 // EventTarget | 96 // EventTarget |
| 97 virtual const AtomicString& interfaceName() const override; | 97 const AtomicString& interfaceName() const override; |
| 98 virtual ExecutionContext* executionContext() const override; | 98 ExecutionContext* executionContext() const override; |
| 99 | 99 |
| 100 bool isClosePending() const { return m_closePending; } | 100 bool isClosePending() const { return m_closePending; } |
| 101 void forceClose(); | 101 void forceClose(); |
| 102 const IDBDatabaseMetadata& metadata() const { return m_metadata; } | 102 const IDBDatabaseMetadata& metadata() const { return m_metadata; } |
| 103 void enqueueEvent(PassRefPtrWillBeRawPtr<Event>); | 103 void enqueueEvent(PassRefPtrWillBeRawPtr<Event>); |
| 104 | 104 |
| 105 using EventTarget::dispatchEvent; | 105 using EventTarget::dispatchEvent; |
| 106 virtual bool dispatchEvent(PassRefPtrWillBeRawPtr<Event>) override; | 106 bool dispatchEvent(PassRefPtrWillBeRawPtr<Event>) override; |
| 107 | 107 |
| 108 int64_t findObjectStoreId(const String& name) const; | 108 int64_t findObjectStoreId(const String& name) const; |
| 109 bool containsObjectStore(const String& name) const | 109 bool containsObjectStore(const String& name) const |
| 110 { | 110 { |
| 111 return findObjectStoreId(name) != IDBObjectStoreMetadata::InvalidId; | 111 return findObjectStoreId(name) != IDBObjectStoreMetadata::InvalidId; |
| 112 } | 112 } |
| 113 | 113 |
| 114 // Will return nullptr if this database is stopped. | 114 // Will return nullptr if this database is stopped. |
| 115 WebIDBDatabase* backend() const { return m_backend.get(); } | 115 WebIDBDatabase* backend() const { return m_backend.get(); } |
| 116 | 116 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 // Keep track of the versionchange events waiting to be fired on this | 151 // Keep track of the versionchange events waiting to be fired on this |
| 152 // database so that we can cancel them if the database closes. | 152 // database so that we can cancel them if the database closes. |
| 153 WillBeHeapVector<RefPtrWillBeMember<Event>> m_enqueuedEvents; | 153 WillBeHeapVector<RefPtrWillBeMember<Event>> m_enqueuedEvents; |
| 154 | 154 |
| 155 Member<IDBDatabaseCallbacks> m_databaseCallbacks; | 155 Member<IDBDatabaseCallbacks> m_databaseCallbacks; |
| 156 }; | 156 }; |
| 157 | 157 |
| 158 } // namespace blink | 158 } // namespace blink |
| 159 | 159 |
| 160 #endif // IDBDatabase_h | 160 #endif // IDBDatabase_h |
| OLD | NEW |