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/PassRefPtr.h" | 43 #include "wtf/PassRefPtr.h" |
44 #include "wtf/RefCounted.h" | 44 #include "wtf/RefCounted.h" |
45 #include "wtf/RefPtr.h" | 45 #include "wtf/RefPtr.h" |
46 | 46 |
47 namespace WebCore { | 47 namespace WebCore { |
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 : public RefCounted<IDBDatabase>, public ScriptWrappable, publ
ic EventTargetWithInlineData, public ActiveDOMObject { | 53 class IDBDatabase FINAL : public RefCounted<IDBDatabase>, public ScriptWrappable
, public EventTargetWithInlineData, public ActiveDOMObject { |
54 REFCOUNTED_EVENT_TARGET(IDBDatabase); | 54 REFCOUNTED_EVENT_TARGET(IDBDatabase); |
55 | 55 |
56 public: | 56 public: |
57 static PassRefPtr<IDBDatabase> create(ExecutionContext*, PassOwnPtr<blink::W
ebIDBDatabase>, PassRefPtr<IDBDatabaseCallbacks>); | 57 static PassRefPtr<IDBDatabase> create(ExecutionContext*, PassOwnPtr<blink::W
ebIDBDatabase>, PassRefPtr<IDBDatabaseCallbacks>); |
58 ~IDBDatabase(); | 58 virtual ~IDBDatabase(); |
59 | 59 |
60 void setMetadata(const IDBDatabaseMetadata& metadata) { m_metadata = metadat
a; } | 60 void setMetadata(const IDBDatabaseMetadata& metadata) { m_metadata = metadat
a; } |
61 void indexCreated(int64_t objectStoreId, const IDBIndexMetadata&); | 61 void indexCreated(int64_t objectStoreId, const IDBIndexMetadata&); |
62 void indexDeleted(int64_t objectStoreId, int64_t indexId); | 62 void indexDeleted(int64_t objectStoreId, int64_t indexId); |
63 void transactionCreated(IDBTransaction*); | 63 void transactionCreated(IDBTransaction*); |
64 void transactionFinished(const IDBTransaction*); | 64 void transactionFinished(const IDBTransaction*); |
65 | 65 |
66 // Implement the IDL | 66 // Implement the IDL |
67 const String& name() const { return m_metadata.name; } | 67 const String& name() const { return m_metadata.name; } |
68 ScriptValue version(ExecutionContext*) const; | 68 ScriptValue version(ExecutionContext*) const; |
69 PassRefPtr<DOMStringList> objectStoreNames() const; | 69 PassRefPtr<DOMStringList> objectStoreNames() const; |
70 | 70 |
71 PassRefPtr<IDBObjectStore> createObjectStore(const String& name, const Dicti
onary&, ExceptionState&); | 71 PassRefPtr<IDBObjectStore> createObjectStore(const String& name, const Dicti
onary&, ExceptionState&); |
72 PassRefPtr<IDBObjectStore> createObjectStore(const String& name, const IDBKe
yPath&, bool autoIncrement, ExceptionState&); | 72 PassRefPtr<IDBObjectStore> createObjectStore(const String& name, const IDBKe
yPath&, bool autoIncrement, ExceptionState&); |
73 PassRefPtr<IDBTransaction> transaction(ExecutionContext* context, PassRefPtr
<DOMStringList> scope, const String& mode, ExceptionState& exceptionState) { ret
urn transaction(context, *scope, mode, exceptionState); } | 73 PassRefPtr<IDBTransaction> transaction(ExecutionContext* context, PassRefPtr
<DOMStringList> scope, const String& mode, ExceptionState& exceptionState) { ret
urn transaction(context, *scope, mode, exceptionState); } |
74 PassRefPtr<IDBTransaction> transaction(ExecutionContext*, const Vector<Strin
g>&, const String& mode, ExceptionState&); | 74 PassRefPtr<IDBTransaction> transaction(ExecutionContext*, const Vector<Strin
g>&, const String& mode, ExceptionState&); |
75 PassRefPtr<IDBTransaction> transaction(ExecutionContext*, const String&, con
st String& mode, ExceptionState&); | 75 PassRefPtr<IDBTransaction> transaction(ExecutionContext*, const String&, con
st String& mode, ExceptionState&); |
76 void deleteObjectStore(const String& name, ExceptionState&); | 76 void deleteObjectStore(const String& name, ExceptionState&); |
77 void close(); | 77 void close(); |
78 | 78 |
79 DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); | 79 DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); |
80 DEFINE_ATTRIBUTE_EVENT_LISTENER(close); | 80 DEFINE_ATTRIBUTE_EVENT_LISTENER(close); |
81 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); | 81 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); |
82 DEFINE_ATTRIBUTE_EVENT_LISTENER(versionchange); | 82 DEFINE_ATTRIBUTE_EVENT_LISTENER(versionchange); |
83 | 83 |
84 // IDBDatabaseCallbacks | 84 // IDBDatabaseCallbacks |
85 virtual void onVersionChange(int64_t oldVersion, int64_t newVersion); | 85 void onVersionChange(int64_t oldVersion, int64_t newVersion); |
86 virtual void onAbort(int64_t, PassRefPtr<DOMError>); | 86 void onAbort(int64_t, PassRefPtr<DOMError>); |
87 virtual void onComplete(int64_t); | 87 void onComplete(int64_t); |
88 | 88 |
89 // ActiveDOMObject | 89 // ActiveDOMObject |
90 virtual bool hasPendingActivity() const OVERRIDE; | 90 virtual bool hasPendingActivity() const OVERRIDE; |
91 virtual void stop() OVERRIDE; | 91 virtual void stop() OVERRIDE; |
92 | 92 |
93 // EventTarget | 93 // EventTarget |
94 virtual const AtomicString& interfaceName() const OVERRIDE; | 94 virtual const AtomicString& interfaceName() const OVERRIDE; |
95 virtual ExecutionContext* executionContext() const OVERRIDE; | 95 virtual ExecutionContext* executionContext() const OVERRIDE; |
96 | 96 |
97 bool isClosePending() const { return m_closePending; } | 97 bool isClosePending() const { return m_closePending; } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 // Keep track of the versionchange events waiting to be fired on this | 143 // Keep track of the versionchange events waiting to be fired on this |
144 // database so that we can cancel them if the database closes. | 144 // database so that we can cancel them if the database closes. |
145 Vector<RefPtr<Event> > m_enqueuedEvents; | 145 Vector<RefPtr<Event> > m_enqueuedEvents; |
146 | 146 |
147 RefPtr<IDBDatabaseCallbacks> m_databaseCallbacks; | 147 RefPtr<IDBDatabaseCallbacks> m_databaseCallbacks; |
148 }; | 148 }; |
149 | 149 |
150 } // namespace WebCore | 150 } // namespace WebCore |
151 | 151 |
152 #endif // IDBDatabase_h | 152 #endif // IDBDatabase_h |
OLD | NEW |