| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 #include "wtf/PassOwnPtr.h" | 43 #include "wtf/PassOwnPtr.h" |
| 44 #include "wtf/PassRefPtr.h" | 44 #include "wtf/PassRefPtr.h" |
| 45 #include "wtf/RefPtr.h" | 45 #include "wtf/RefPtr.h" |
| 46 | 46 |
| 47 namespace blink { | 47 namespace blink { |
| 48 | 48 |
| 49 class DOMError; | 49 class DOMError; |
| 50 class ExceptionState; | 50 class ExceptionState; |
| 51 class ExecutionContext; | 51 class ExecutionContext; |
| 52 | 52 |
| 53 class IDBDatabase FINAL | 53 class IDBDatabase final |
| 54 : public RefCountedGarbageCollectedWillBeGarbageCollectedFinalized<IDBDataba
se> | 54 : public RefCountedGarbageCollectedWillBeGarbageCollectedFinalized<IDBDataba
se> |
| 55 , public EventTargetWithInlineData | 55 , public EventTargetWithInlineData |
| 56 , public ActiveDOMObject { | 56 , public ActiveDOMObject { |
| 57 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<I
DBDatabase>); | 57 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<I
DBDatabase>); |
| 58 DEFINE_WRAPPERTYPEINFO(); | 58 DEFINE_WRAPPERTYPEINFO(); |
| 59 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(IDBDatabase); | 59 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(IDBDatabase); |
| 60 public: | 60 public: |
| 61 static IDBDatabase* create(ExecutionContext*, PassOwnPtr<WebIDBDatabase>, ID
BDatabaseCallbacks*); | 61 static IDBDatabase* create(ExecutionContext*, PassOwnPtr<WebIDBDatabase>, ID
BDatabaseCallbacks*); |
| 62 virtual ~IDBDatabase(); | 62 virtual ~IDBDatabase(); |
| 63 virtual void trace(Visitor*) OVERRIDE; | 63 virtual void trace(Visitor*) override; |
| 64 | 64 |
| 65 void setMetadata(const IDBDatabaseMetadata& metadata) { m_metadata = metadat
a; } | 65 void setMetadata(const IDBDatabaseMetadata& metadata) { m_metadata = metadat
a; } |
| 66 void indexCreated(int64_t objectStoreId, const IDBIndexMetadata&); | 66 void indexCreated(int64_t objectStoreId, const IDBIndexMetadata&); |
| 67 void indexDeleted(int64_t objectStoreId, int64_t indexId); | 67 void indexDeleted(int64_t objectStoreId, int64_t indexId); |
| 68 void transactionCreated(IDBTransaction*); | 68 void transactionCreated(IDBTransaction*); |
| 69 void transactionFinished(const IDBTransaction*); | 69 void transactionFinished(const IDBTransaction*); |
| 70 | 70 |
| 71 // Implement the IDL | 71 // Implement the IDL |
| 72 const String& name() const { return m_metadata.name; } | 72 const String& name() const { return m_metadata.name; } |
| 73 ScriptValue version(ScriptState*) const; | 73 ScriptValue version(ScriptState*) const; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 85 DEFINE_ATTRIBUTE_EVENT_LISTENER(close); | 85 DEFINE_ATTRIBUTE_EVENT_LISTENER(close); |
| 86 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); | 86 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); |
| 87 DEFINE_ATTRIBUTE_EVENT_LISTENER(versionchange); | 87 DEFINE_ATTRIBUTE_EVENT_LISTENER(versionchange); |
| 88 | 88 |
| 89 // IDBDatabaseCallbacks | 89 // IDBDatabaseCallbacks |
| 90 void onVersionChange(int64_t oldVersion, int64_t newVersion); | 90 void onVersionChange(int64_t oldVersion, int64_t newVersion); |
| 91 void onAbort(int64_t, DOMError*); | 91 void onAbort(int64_t, DOMError*); |
| 92 void onComplete(int64_t); | 92 void onComplete(int64_t); |
| 93 | 93 |
| 94 // ActiveDOMObject | 94 // ActiveDOMObject |
| 95 virtual bool hasPendingActivity() const OVERRIDE; | 95 virtual bool hasPendingActivity() const override; |
| 96 virtual void stop() OVERRIDE; | 96 virtual void stop() override; |
| 97 | 97 |
| 98 // EventTarget | 98 // EventTarget |
| 99 virtual const AtomicString& interfaceName() const OVERRIDE; | 99 virtual const AtomicString& interfaceName() const override; |
| 100 virtual ExecutionContext* executionContext() const OVERRIDE; | 100 virtual ExecutionContext* executionContext() const override; |
| 101 | 101 |
| 102 bool isClosePending() const { return m_closePending; } | 102 bool isClosePending() const { return m_closePending; } |
| 103 void forceClose(); | 103 void forceClose(); |
| 104 const IDBDatabaseMetadata& metadata() const { return m_metadata; } | 104 const IDBDatabaseMetadata& metadata() const { return m_metadata; } |
| 105 void enqueueEvent(PassRefPtrWillBeRawPtr<Event>); | 105 void enqueueEvent(PassRefPtrWillBeRawPtr<Event>); |
| 106 | 106 |
| 107 using EventTarget::dispatchEvent; | 107 using EventTarget::dispatchEvent; |
| 108 virtual bool dispatchEvent(PassRefPtrWillBeRawPtr<Event>) OVERRIDE; | 108 virtual bool dispatchEvent(PassRefPtrWillBeRawPtr<Event>) override; |
| 109 | 109 |
| 110 int64_t findObjectStoreId(const String& name) const; | 110 int64_t findObjectStoreId(const String& name) const; |
| 111 bool containsObjectStore(const String& name) const | 111 bool containsObjectStore(const String& name) const |
| 112 { | 112 { |
| 113 return findObjectStoreId(name) != IDBObjectStoreMetadata::InvalidId; | 113 return findObjectStoreId(name) != IDBObjectStoreMetadata::InvalidId; |
| 114 } | 114 } |
| 115 | 115 |
| 116 // Will return nullptr if this database is stopped. | 116 // Will return nullptr if this database is stopped. |
| 117 WebIDBDatabase* backend() const { return m_backend.get(); } | 117 WebIDBDatabase* backend() const { return m_backend.get(); } |
| 118 | 118 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 // Keep track of the versionchange events waiting to be fired on this | 153 // Keep track of the versionchange events waiting to be fired on this |
| 154 // database so that we can cancel them if the database closes. | 154 // database so that we can cancel them if the database closes. |
| 155 WillBeHeapVector<RefPtrWillBeMember<Event> > m_enqueuedEvents; | 155 WillBeHeapVector<RefPtrWillBeMember<Event> > m_enqueuedEvents; |
| 156 | 156 |
| 157 Member<IDBDatabaseCallbacks> m_databaseCallbacks; | 157 Member<IDBDatabaseCallbacks> m_databaseCallbacks; |
| 158 }; | 158 }; |
| 159 | 159 |
| 160 } // namespace blink | 160 } // namespace blink |
| 161 | 161 |
| 162 #endif // IDBDatabase_h | 162 #endif // IDBDatabase_h |
| OLD | NEW |