Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / modules / indexeddb / IDBCursor.h
index be9afbc..b44a442 100644 (file)
 #ifndef IDBCursor_h
 #define IDBCursor_h
 
-#include "bindings/v8/ScriptValue.h"
-#include "bindings/v8/ScriptWrappable.h"
+#include "bindings/core/v8/ScriptValue.h"
+#include "bindings/core/v8/ScriptWrappable.h"
 #include "modules/indexeddb/IDBKey.h"
 #include "modules/indexeddb/IDBRequest.h"
 #include "modules/indexeddb/IndexedDB.h"
 #include "public/platform/WebIDBCursor.h"
+#include "public/platform/WebIDBTypes.h"
 #include "wtf/PassRefPtr.h"
-#include "wtf/RefCounted.h"
 #include "wtf/RefPtr.h"
 
 namespace blink {
 
-class WebBlobInfo;
-
-} // namespace blink
-
-namespace WebCore {
-
 class ExceptionState;
 class IDBAny;
 class IDBTransaction;
-class ExecutionContext;
+class ScriptState;
 class SharedBuffer;
+class WebBlobInfo;
 
-#if ENABLE(OILPAN)
-typedef GarbageCollectedFinalized<IDBCursor> IDBCursorBase;
-#else
-typedef WTF::RefCountedBase IDBCursorBase;
-#endif
-
-class IDBCursor : public IDBCursorBase, public ScriptWrappable {
+class IDBCursor : public GarbageCollectedFinalized<IDBCursor>, public ScriptWrappable {
+    DEFINE_WRAPPERTYPEINFO();
+    USING_PRE_FINALIZER(IDBCursor, dispose);
 public:
-    static const AtomicString& directionNext();
-    static const AtomicString& directionNextUnique();
-    static const AtomicString& directionPrev();
-    static const AtomicString& directionPrevUnique();
-
-    static blink::WebIDBCursor::Direction stringToDirection(const String& modeString, ExceptionState&);
-    static const AtomicString& directionToString(unsigned short mode);
+    static WebIDBCursorDirection stringToDirection(const String& modeString, ExceptionState&);
 
-    static PassRefPtrWillBeRawPtr<IDBCursor> create(PassOwnPtr<blink::WebIDBCursor>, blink::WebIDBCursor::Direction, IDBRequest*, IDBAny* source, IDBTransaction*);
+    static IDBCursor* create(PassOwnPtr<WebIDBCursor>, WebIDBCursorDirection, IDBRequest*, IDBAny* source, IDBTransaction*);
     virtual ~IDBCursor();
     void trace(Visitor*);
     void contextWillBeDestroyed() { m_backend.clear(); }
 
     // Implement the IDL
-    const String& direction() const { return directionToString(m_direction); }
+    const String& direction() const;
     ScriptValue key(ScriptState*);
     ScriptValue primaryKey(ScriptState*);
     ScriptValue value(ScriptState*);
     ScriptValue source(ScriptState*) const;
 
-    PassRefPtrWillBeRawPtr<IDBRequest> update(ExecutionContext*, ScriptValue&, ExceptionState&);
+    IDBRequest* update(ScriptState*, const ScriptValue&, ExceptionState&);
     void advance(unsigned long, ExceptionState&);
-    void continueFunction(ExecutionContext*, const ScriptValue& key, ExceptionState&);
-    void continuePrimaryKey(ExecutionContext*, const ScriptValue& key, const ScriptValue& primaryKey, ExceptionState&);
-    PassRefPtrWillBeRawPtr<IDBRequest> deleteFunction(ExecutionContext*, ExceptionState&);
+    void continueFunction(ScriptState*, const ScriptValue& key, ExceptionState&);
+    void continuePrimaryKey(ScriptState*, const ScriptValue& key, const ScriptValue& primaryKey, ExceptionState&);
+    IDBRequest* deleteFunction(ScriptState*, ExceptionState&);
 
     bool isKeyDirty() const { return m_keyDirty; }
     bool isPrimaryKeyDirty() const { return m_primaryKeyDirty; }
     bool isValueDirty() const { return m_valueDirty; }
 
-    void continueFunction(PassRefPtrWillBeRawPtr<IDBKey>, PassRefPtrWillBeRawPtr<IDBKey> primaryKey, ExceptionState&);
+    void continueFunction(IDBKey*, IDBKey* primaryKey, ExceptionState&);
     void postSuccessHandlerCallback();
     bool isDeleted() const;
     void close();
-    void setValueReady(PassRefPtrWillBeRawPtr<IDBKey>, PassRefPtrWillBeRawPtr<IDBKey> primaryKey, PassRefPtr<SharedBuffer> value, PassOwnPtr<Vector<blink::WebBlobInfo> >);
-    PassRefPtrWillBeRawPtr<IDBKey> idbPrimaryKey() const { return m_primaryKey; }
+    void setValueReady(IDBKey*, IDBKey* primaryKey, PassRefPtr<SharedBuffer> value, PassOwnPtr<Vector<WebBlobInfo> >);
+    IDBKey* idbPrimaryKey() const { return m_primaryKey; }
     IDBRequest* request() const { return m_request.get(); }
     virtual bool isKeyCursor() const { return true; }
     virtual bool isCursorWithValue() const { return false; }
 
-#if !ENABLE(OILPAN)
-    void deref()
-    {
-        if (derefBase())
-            delete this;
-        else if (hasOneRef())
-            checkForReferenceCycle();
-    }
-#endif
-
 protected:
-    IDBCursor(PassOwnPtr<blink::WebIDBCursor>, blink::WebIDBCursor::Direction, IDBRequest*, IDBAny* source, IDBTransaction*);
+    IDBCursor(PassOwnPtr<WebIDBCursor>, WebIDBCursorDirection, IDBRequest*, IDBAny* source, IDBTransaction*);
 
 private:
-    PassRefPtrWillBeRawPtr<IDBObjectStore> effectiveObjectStore() const;
+    void dispose();
+    IDBObjectStore* effectiveObjectStore() const;
     void handleBlobAcks();
 
-#if !ENABLE(OILPAN)
-    void checkForReferenceCycle();
-#endif
-
-    OwnPtr<blink::WebIDBCursor> m_backend;
-    RefPtrWillBeMember<IDBRequest> m_request;
-    const blink::WebIDBCursor::Direction m_direction;
-    RefPtrWillBeMember<IDBAny> m_source;
-    RefPtrWillBeMember<IDBTransaction> m_transaction;
+    OwnPtr<WebIDBCursor> m_backend;
+    Member<IDBRequest> m_request;
+    const WebIDBCursorDirection m_direction;
+    Member<IDBAny> m_source;
+    Member<IDBTransaction> m_transaction;
     bool m_gotValue;
     bool m_keyDirty;
     bool m_primaryKeyDirty;
     bool m_valueDirty;
-    RefPtrWillBeMember<IDBKey> m_key;
-    RefPtrWillBeMember<IDBKey> m_primaryKey;
+    Member<IDBKey> m_key;
+    Member<IDBKey> m_primaryKey;
     RefPtr<SharedBuffer> m_value;
-    OwnPtr<Vector<blink::WebBlobInfo> > m_blobInfo;
+    OwnPtr<Vector<WebBlobInfo> > m_blobInfo;
 };
 
-} // namespace WebCore
+} // namespace blink
 
 #endif // IDBCursor_h