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 29 matching lines...) Expand all Loading... |
40 | 40 |
41 class ExceptionState; | 41 class ExceptionState; |
42 class IDBAny; | 42 class IDBAny; |
43 class IDBTransaction; | 43 class IDBTransaction; |
44 class ExecutionContext; | 44 class ExecutionContext; |
45 class SharedBuffer; | 45 class SharedBuffer; |
46 class WebBlobInfo; | 46 class WebBlobInfo; |
47 | 47 |
48 class IDBCursor : public GarbageCollectedFinalized<IDBCursor>, public ScriptWrap
pable { | 48 class IDBCursor : public GarbageCollectedFinalized<IDBCursor>, public ScriptWrap
pable { |
49 DEFINE_WRAPPERTYPEINFO(); | 49 DEFINE_WRAPPERTYPEINFO(); |
| 50 USING_PRE_FINALIZER(IDBCursor, dispose); |
50 public: | 51 public: |
51 static WebIDBCursorDirection stringToDirection(const String& modeString, Exc
eptionState&); | 52 static WebIDBCursorDirection stringToDirection(const String& modeString, Exc
eptionState&); |
52 | 53 |
53 static IDBCursor* create(PassOwnPtr<WebIDBCursor>, WebIDBCursorDirection, ID
BRequest*, IDBAny* source, IDBTransaction*); | 54 static IDBCursor* create(PassOwnPtr<WebIDBCursor>, WebIDBCursorDirection, ID
BRequest*, IDBAny* source, IDBTransaction*); |
54 virtual ~IDBCursor(); | 55 virtual ~IDBCursor(); |
55 void dispose(); | |
56 void trace(Visitor*); | 56 void trace(Visitor*); |
57 void contextWillBeDestroyed() { m_backend.clear(); } | 57 void contextWillBeDestroyed() { m_backend.clear(); } |
58 | 58 |
59 // Implement the IDL | 59 // Implement the IDL |
60 const String& direction() const; | 60 const String& direction() const; |
61 ScriptValue key(ScriptState*); | 61 ScriptValue key(ScriptState*); |
62 ScriptValue primaryKey(ScriptState*); | 62 ScriptValue primaryKey(ScriptState*); |
63 ScriptValue value(ScriptState*); | 63 ScriptValue value(ScriptState*); |
64 ScriptValue source(ScriptState*) const; | 64 ScriptValue source(ScriptState*) const; |
65 | 65 |
(...skipping 14 matching lines...) Expand all Loading... |
80 void setValueReady(IDBKey*, IDBKey* primaryKey, PassRefPtr<SharedBuffer> val
ue, PassOwnPtr<Vector<WebBlobInfo> >); | 80 void setValueReady(IDBKey*, IDBKey* primaryKey, PassRefPtr<SharedBuffer> val
ue, PassOwnPtr<Vector<WebBlobInfo> >); |
81 IDBKey* idbPrimaryKey() const { return m_primaryKey; } | 81 IDBKey* idbPrimaryKey() const { return m_primaryKey; } |
82 IDBRequest* request() const { return m_request.get(); } | 82 IDBRequest* request() const { return m_request.get(); } |
83 virtual bool isKeyCursor() const { return true; } | 83 virtual bool isKeyCursor() const { return true; } |
84 virtual bool isCursorWithValue() const { return false; } | 84 virtual bool isCursorWithValue() const { return false; } |
85 | 85 |
86 protected: | 86 protected: |
87 IDBCursor(PassOwnPtr<WebIDBCursor>, WebIDBCursorDirection, IDBRequest*, IDBA
ny* source, IDBTransaction*); | 87 IDBCursor(PassOwnPtr<WebIDBCursor>, WebIDBCursorDirection, IDBRequest*, IDBA
ny* source, IDBTransaction*); |
88 | 88 |
89 private: | 89 private: |
| 90 void dispose(); |
90 IDBObjectStore* effectiveObjectStore() const; | 91 IDBObjectStore* effectiveObjectStore() const; |
91 void handleBlobAcks(); | 92 void handleBlobAcks(); |
92 | 93 |
93 OwnPtr<WebIDBCursor> m_backend; | 94 OwnPtr<WebIDBCursor> m_backend; |
94 Member<IDBRequest> m_request; | 95 Member<IDBRequest> m_request; |
95 const WebIDBCursorDirection m_direction; | 96 const WebIDBCursorDirection m_direction; |
96 Member<IDBAny> m_source; | 97 Member<IDBAny> m_source; |
97 Member<IDBTransaction> m_transaction; | 98 Member<IDBTransaction> m_transaction; |
98 bool m_gotValue; | 99 bool m_gotValue; |
99 bool m_keyDirty; | 100 bool m_keyDirty; |
100 bool m_primaryKeyDirty; | 101 bool m_primaryKeyDirty; |
101 bool m_valueDirty; | 102 bool m_valueDirty; |
102 Member<IDBKey> m_key; | 103 Member<IDBKey> m_key; |
103 Member<IDBKey> m_primaryKey; | 104 Member<IDBKey> m_primaryKey; |
104 RefPtr<SharedBuffer> m_value; | 105 RefPtr<SharedBuffer> m_value; |
105 OwnPtr<Vector<WebBlobInfo> > m_blobInfo; | 106 OwnPtr<Vector<WebBlobInfo> > m_blobInfo; |
106 }; | 107 }; |
107 | 108 |
108 } // namespace blink | 109 } // namespace blink |
109 | 110 |
110 #endif // IDBCursor_h | 111 #endif // IDBCursor_h |
OLD | NEW |