| 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 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 #include "bindings/core/v8/ScriptWrappable.h" | 29 #include "bindings/core/v8/ScriptWrappable.h" |
| 30 #include "modules/indexeddb/IDBKey.h" | 30 #include "modules/indexeddb/IDBKey.h" |
| 31 #include "modules/indexeddb/IDBKeyPath.h" | 31 #include "modules/indexeddb/IDBKeyPath.h" |
| 32 #include "platform/SharedBuffer.h" | 32 #include "platform/SharedBuffer.h" |
| 33 #include "wtf/Forward.h" | 33 #include "wtf/Forward.h" |
| 34 #include "wtf/text/WTFString.h" | 34 #include "wtf/text/WTFString.h" |
| 35 | 35 |
| 36 namespace blink { | 36 namespace blink { |
| 37 | 37 |
| 38 class WebBlobInfo; | |
| 39 | |
| 40 } | |
| 41 | |
| 42 namespace blink { | |
| 43 | |
| 44 class DOMStringList; | 38 class DOMStringList; |
| 45 class IDBCursor; | 39 class IDBCursor; |
| 46 class IDBCursorWithValue; | 40 class IDBCursorWithValue; |
| 47 class IDBDatabase; | 41 class IDBDatabase; |
| 48 class IDBIndex; | 42 class IDBIndex; |
| 49 class IDBKeyPath; | 43 class IDBKeyPath; |
| 50 class IDBObjectStore; | 44 class IDBObjectStore; |
| 51 class IDBTransaction; | 45 class IDBTransaction; |
| 46 class WebBlobInfo; |
| 52 | 47 |
| 53 class IDBAny : public GarbageCollectedFinalized<IDBAny> { | 48 class IDBAny : public GarbageCollectedFinalized<IDBAny> { |
| 54 public: | 49 public: |
| 55 static IDBAny* createUndefined(); | 50 static IDBAny* createUndefined(); |
| 56 static IDBAny* createNull(); | 51 static IDBAny* createNull(); |
| 57 static IDBAny* createString(const String&); | 52 static IDBAny* createString(const String&); |
| 58 template<typename T> | 53 template<typename T> |
| 59 static IDBAny* create(T* idbObject) | 54 static IDBAny* create(T* idbObject) |
| 60 { | 55 { |
| 61 return new IDBAny(idbObject); | 56 return new IDBAny(idbObject); |
| 62 } | 57 } |
| 63 template<typename T> | 58 template<typename T> |
| 64 static IDBAny* create(const T& idbObject) | 59 static IDBAny* create(const T& idbObject) |
| 65 { | 60 { |
| 66 return new IDBAny(idbObject); | 61 return new IDBAny(idbObject); |
| 67 } | 62 } |
| 68 static IDBAny* create(PassRefPtr<SharedBuffer> value, const Vector<blink::We
bBlobInfo>* blobInfo) | 63 static IDBAny* create(PassRefPtr<SharedBuffer> value, const Vector<WebBlobIn
fo>* blobInfo) |
| 69 { | 64 { |
| 70 return new IDBAny(value, blobInfo); | 65 return new IDBAny(value, blobInfo); |
| 71 } | 66 } |
| 72 template<typename T> | 67 template<typename T> |
| 73 static IDBAny* create(PassRefPtr<T> idbObject) | 68 static IDBAny* create(PassRefPtr<T> idbObject) |
| 74 { | 69 { |
| 75 return new IDBAny(idbObject); | 70 return new IDBAny(idbObject); |
| 76 } | 71 } |
| 77 static IDBAny* create(int64_t value) | 72 static IDBAny* create(int64_t value) |
| 78 { | 73 { |
| 79 return new IDBAny(value); | 74 return new IDBAny(value); |
| 80 } | 75 } |
| 81 static IDBAny* create(PassRefPtr<SharedBuffer> value, const Vector<blink::We
bBlobInfo>* blobInfo, IDBKey* key, const IDBKeyPath& keyPath) | 76 static IDBAny* create(PassRefPtr<SharedBuffer> value, const Vector<WebBlobIn
fo>* blobInfo, IDBKey* key, const IDBKeyPath& keyPath) |
| 82 { | 77 { |
| 83 return new IDBAny(value, blobInfo, key, keyPath); | 78 return new IDBAny(value, blobInfo, key, keyPath); |
| 84 } | 79 } |
| 85 ~IDBAny(); | 80 ~IDBAny(); |
| 86 void trace(Visitor*); | 81 void trace(Visitor*); |
| 87 void contextWillBeDestroyed(); | 82 void contextWillBeDestroyed(); |
| 88 | 83 |
| 89 enum Type { | 84 enum Type { |
| 90 UndefinedType = 0, | 85 UndefinedType = 0, |
| 91 NullType, | 86 NullType, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 107 Type type() const { return m_type; } | 102 Type type() const { return m_type; } |
| 108 // Use type() to figure out which one of these you're allowed to call. | 103 // Use type() to figure out which one of these you're allowed to call. |
| 109 DOMStringList* domStringList() const; | 104 DOMStringList* domStringList() const; |
| 110 IDBCursor* idbCursor() const; | 105 IDBCursor* idbCursor() const; |
| 111 IDBCursorWithValue* idbCursorWithValue() const; | 106 IDBCursorWithValue* idbCursorWithValue() const; |
| 112 IDBDatabase* idbDatabase() const; | 107 IDBDatabase* idbDatabase() const; |
| 113 IDBIndex* idbIndex() const; | 108 IDBIndex* idbIndex() const; |
| 114 IDBObjectStore* idbObjectStore() const; | 109 IDBObjectStore* idbObjectStore() const; |
| 115 IDBTransaction* idbTransaction() const; | 110 IDBTransaction* idbTransaction() const; |
| 116 SharedBuffer* buffer() const; | 111 SharedBuffer* buffer() const; |
| 117 const Vector<blink::WebBlobInfo>* blobInfo() const; | 112 const Vector<WebBlobInfo>* blobInfo() const; |
| 118 int64_t integer() const; | 113 int64_t integer() const; |
| 119 const String& string() const; | 114 const String& string() const; |
| 120 const IDBKey* key() const; | 115 const IDBKey* key() const; |
| 121 const IDBKeyPath& keyPath() const; | 116 const IDBKeyPath& keyPath() const; |
| 122 | 117 |
| 123 private: | 118 private: |
| 124 explicit IDBAny(Type); | 119 explicit IDBAny(Type); |
| 125 explicit IDBAny(PassRefPtrWillBeRawPtr<DOMStringList>); | 120 explicit IDBAny(PassRefPtrWillBeRawPtr<DOMStringList>); |
| 126 explicit IDBAny(IDBCursor*); | 121 explicit IDBAny(IDBCursor*); |
| 127 explicit IDBAny(IDBDatabase*); | 122 explicit IDBAny(IDBDatabase*); |
| 128 explicit IDBAny(IDBIndex*); | 123 explicit IDBAny(IDBIndex*); |
| 129 explicit IDBAny(IDBObjectStore*); | 124 explicit IDBAny(IDBObjectStore*); |
| 130 explicit IDBAny(IDBTransaction*); | 125 explicit IDBAny(IDBTransaction*); |
| 131 explicit IDBAny(IDBKey*); | 126 explicit IDBAny(IDBKey*); |
| 132 explicit IDBAny(const IDBKeyPath&); | 127 explicit IDBAny(const IDBKeyPath&); |
| 133 explicit IDBAny(const String&); | 128 explicit IDBAny(const String&); |
| 134 IDBAny(PassRefPtr<SharedBuffer>, const Vector<blink::WebBlobInfo>*); | 129 IDBAny(PassRefPtr<SharedBuffer>, const Vector<WebBlobInfo>*); |
| 135 IDBAny(PassRefPtr<SharedBuffer>, const Vector<blink::WebBlobInfo>*, IDBKey*,
const IDBKeyPath&); | 130 IDBAny(PassRefPtr<SharedBuffer>, const Vector<WebBlobInfo>*, IDBKey*, const
IDBKeyPath&); |
| 136 explicit IDBAny(int64_t); | 131 explicit IDBAny(int64_t); |
| 137 | 132 |
| 138 const Type m_type; | 133 const Type m_type; |
| 139 | 134 |
| 140 // Only one of the following should ever be in use at any given time, except
that BufferType uses two and BufferKeyAndKeyPathType uses four. | 135 // Only one of the following should ever be in use at any given time, except
that BufferType uses two and BufferKeyAndKeyPathType uses four. |
| 141 const RefPtrWillBeMember<DOMStringList> m_domStringList; | 136 const RefPtrWillBeMember<DOMStringList> m_domStringList; |
| 142 const Member<IDBCursor> m_idbCursor; | 137 const Member<IDBCursor> m_idbCursor; |
| 143 const Member<IDBDatabase> m_idbDatabase; | 138 const Member<IDBDatabase> m_idbDatabase; |
| 144 const Member<IDBIndex> m_idbIndex; | 139 const Member<IDBIndex> m_idbIndex; |
| 145 const Member<IDBObjectStore> m_idbObjectStore; | 140 const Member<IDBObjectStore> m_idbObjectStore; |
| 146 const Member<IDBTransaction> m_idbTransaction; | 141 const Member<IDBTransaction> m_idbTransaction; |
| 147 const Member<IDBKey> m_idbKey; | 142 const Member<IDBKey> m_idbKey; |
| 148 const IDBKeyPath m_idbKeyPath; | 143 const IDBKeyPath m_idbKeyPath; |
| 149 const RefPtr<SharedBuffer> m_buffer; | 144 const RefPtr<SharedBuffer> m_buffer; |
| 150 const Vector<blink::WebBlobInfo>* m_blobInfo; | 145 const Vector<WebBlobInfo>* m_blobInfo; |
| 151 const String m_string; | 146 const String m_string; |
| 152 const int64_t m_integer; | 147 const int64_t m_integer; |
| 153 }; | 148 }; |
| 154 | 149 |
| 155 } // namespace blink | 150 } // namespace blink |
| 156 | 151 |
| 157 #endif // IDBAny_h | 152 #endif // IDBAny_h |
| OLD | NEW |