Chromium Code Reviews| 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 21 matching lines...) Expand all Loading... | |
| 32 #include "modules/indexeddb/IDBRequest.h" | 32 #include "modules/indexeddb/IDBRequest.h" |
| 33 #include "modules/indexeddb/IDBTransaction.h" | 33 #include "modules/indexeddb/IDBTransaction.h" |
| 34 #include "modules/indexeddb/IndexedDB.h" | 34 #include "modules/indexeddb/IndexedDB.h" |
| 35 #include "public/platform/WebIDBCursor.h" | 35 #include "public/platform/WebIDBCursor.h" |
| 36 #include "wtf/PassRefPtr.h" | 36 #include "wtf/PassRefPtr.h" |
| 37 #include "wtf/RefCounted.h" | 37 #include "wtf/RefCounted.h" |
| 38 #include "wtf/RefPtr.h" | 38 #include "wtf/RefPtr.h" |
| 39 | 39 |
| 40 namespace WebCore { | 40 namespace WebCore { |
| 41 | 41 |
| 42 class BlobInfo; | |
| 42 class DOMRequestState; | 43 class DOMRequestState; |
| 43 class ExceptionState; | 44 class ExceptionState; |
| 44 class IDBAny; | 45 class IDBAny; |
| 45 class ExecutionContext; | 46 class ExecutionContext; |
| 46 class SharedBuffer; | 47 class SharedBuffer; |
| 47 | 48 |
| 48 class IDBCursor : public ScriptWrappable, public WTF::RefCountedBase { | 49 class IDBCursor : public ScriptWrappable, public WTF::RefCountedBase { |
| 49 public: | 50 public: |
| 50 static const AtomicString& directionNext(); | 51 static const AtomicString& directionNext(); |
| 51 static const AtomicString& directionNextUnique(); | 52 static const AtomicString& directionNextUnique(); |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 70 void continueFunction(ExecutionContext*, const ScriptValue& key, ExceptionSt ate&); | 71 void continueFunction(ExecutionContext*, const ScriptValue& key, ExceptionSt ate&); |
| 71 PassRefPtr<IDBRequest> deleteFunction(ExecutionContext*, ExceptionState&); | 72 PassRefPtr<IDBRequest> deleteFunction(ExecutionContext*, ExceptionState&); |
| 72 | 73 |
| 73 bool isKeyDirty() const { return m_keyDirty; } | 74 bool isKeyDirty() const { return m_keyDirty; } |
| 74 bool isPrimaryKeyDirty() const { return m_primaryKeyDirty; } | 75 bool isPrimaryKeyDirty() const { return m_primaryKeyDirty; } |
| 75 bool isValueDirty() const { return m_valueDirty; } | 76 bool isValueDirty() const { return m_valueDirty; } |
| 76 | 77 |
| 77 void continueFunction(PassRefPtr<IDBKey>, ExceptionState&); | 78 void continueFunction(PassRefPtr<IDBKey>, ExceptionState&); |
| 78 void postSuccessHandlerCallback(); | 79 void postSuccessHandlerCallback(); |
| 79 void close(); | 80 void close(); |
| 80 void setValueReady(PassRefPtr<IDBKey>, PassRefPtr<IDBKey> primaryKey, PassRe fPtr<SharedBuffer> value); | 81 void setValueReady(PassRefPtr<IDBKey>, PassRefPtr<IDBKey> primaryKey, PassRe fPtr<SharedBuffer> value, PassOwnPtr<Vector<BlobInfo> >); |
|
jsbell
2013/12/20 19:13:54
We might be able to change this over to being an I
| |
| 81 PassRefPtr<IDBKey> idbPrimaryKey() const { return m_primaryKey; } | 82 PassRefPtr<IDBKey> idbPrimaryKey() const { return m_primaryKey; } |
| 82 IDBRequest* request() const { return m_request.get(); } | 83 IDBRequest* request() const { return m_request.get(); } |
| 83 virtual bool isKeyCursor() const { return true; } | 84 virtual bool isKeyCursor() const { return true; } |
| 84 virtual bool isCursorWithValue() const { return false; } | 85 virtual bool isCursorWithValue() const { return false; } |
| 85 | 86 |
| 86 void deref() | 87 void deref() |
| 87 { | 88 { |
| 88 if (derefBase()) | 89 if (derefBase()) |
| 89 delete this; | 90 delete this; |
| 90 else if (hasOneRef()) | 91 else if (hasOneRef()) |
| 91 checkForReferenceCycle(); | 92 checkForReferenceCycle(); |
| 92 } | 93 } |
| 93 | 94 |
| 94 protected: | 95 protected: |
| 95 IDBCursor(PassOwnPtr<blink::WebIDBCursor>, IndexedDB::CursorDirection, IDBRe quest*, IDBAny* source, IDBTransaction*); | 96 IDBCursor(PassOwnPtr<blink::WebIDBCursor>, IndexedDB::CursorDirection, IDBRe quest*, IDBAny* source, IDBTransaction*); |
| 96 | 97 |
| 97 private: | 98 private: |
| 98 PassRefPtr<IDBObjectStore> effectiveObjectStore(); | 99 PassRefPtr<IDBObjectStore> effectiveObjectStore(); |
| 99 | 100 |
| 100 void checkForReferenceCycle(); | 101 void checkForReferenceCycle(); |
| 101 bool isDeleted() const; | 102 bool isDeleted() const; |
| 103 void handleBlobAcks(); | |
| 102 | 104 |
| 103 OwnPtr<blink::WebIDBCursor> m_backend; | 105 OwnPtr<blink::WebIDBCursor> m_backend; |
| 104 RefPtr<IDBRequest> m_request; | 106 RefPtr<IDBRequest> m_request; |
| 105 const IndexedDB::CursorDirection m_direction; | 107 const IndexedDB::CursorDirection m_direction; |
| 106 RefPtr<IDBAny> m_source; | 108 RefPtr<IDBAny> m_source; |
| 107 RefPtr<IDBTransaction> m_transaction; | 109 RefPtr<IDBTransaction> m_transaction; |
| 108 bool m_gotValue; | 110 bool m_gotValue; |
| 109 bool m_keyDirty; | 111 bool m_keyDirty; |
| 110 bool m_primaryKeyDirty; | 112 bool m_primaryKeyDirty; |
| 111 bool m_valueDirty; | 113 bool m_valueDirty; |
| 112 RefPtr<IDBKey> m_key; | 114 RefPtr<IDBKey> m_key; |
| 113 RefPtr<IDBKey> m_primaryKey; | 115 RefPtr<IDBKey> m_primaryKey; |
| 114 RefPtr<SharedBuffer> m_value; | 116 RefPtr<SharedBuffer> m_value; |
| 117 OwnPtr<Vector<BlobInfo> > m_blobInfo; | |
| 115 }; | 118 }; |
| 116 | 119 |
| 117 } // namespace WebCore | 120 } // namespace WebCore |
| 118 | 121 |
| 119 #endif // IDBCursor_h | 122 #endif // IDBCursor_h |
| OLD | NEW |