Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Side by Side Diff: Source/modules/indexeddb/IDBAny.h

Issue 235933013: Add the backchannel for Blobs to be received into Blink from the database backend. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove accidentally-included files Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
28 28
29 #include "bindings/v8/ScriptWrappable.h" 29 #include "bindings/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/PassRefPtr.h" 33 #include "wtf/PassRefPtr.h"
34 #include "wtf/RefCounted.h" 34 #include "wtf/RefCounted.h"
35 #include "wtf/RefPtr.h" 35 #include "wtf/RefPtr.h"
36 #include "wtf/text/WTFString.h" 36 #include "wtf/text/WTFString.h"
37 37
38 namespace blink {
39
40 class WebBlobInfo;
41
42 }
43
38 namespace WebCore { 44 namespace WebCore {
39 45
40 class DOMStringList; 46 class DOMStringList;
41 class IDBCursor; 47 class IDBCursor;
42 class IDBCursorWithValue; 48 class IDBCursorWithValue;
43 class IDBDatabase; 49 class IDBDatabase;
44 class IDBIndex; 50 class IDBIndex;
45 class IDBKeyPath; 51 class IDBKeyPath;
46 class IDBObjectStore; 52 class IDBObjectStore;
47 class IDBTransaction; 53 class IDBTransaction;
48 54
49 class IDBAny : public RefCounted<IDBAny> { 55 class IDBAny : public RefCounted<IDBAny> {
50 public: 56 public:
51 static PassRefPtr<IDBAny> createUndefined(); 57 static PassRefPtr<IDBAny> createUndefined();
52 static PassRefPtr<IDBAny> createNull(); 58 static PassRefPtr<IDBAny> createNull();
53 static PassRefPtr<IDBAny> createString(const String&); 59 static PassRefPtr<IDBAny> createString(const String&);
54 template<typename T> 60 template<typename T>
55 static PassRefPtr<IDBAny> create(T* idbObject) 61 static PassRefPtr<IDBAny> create(T* idbObject)
56 { 62 {
57 return adoptRef(new IDBAny(idbObject)); 63 return adoptRef(new IDBAny(idbObject));
58 } 64 }
59 template<typename T> 65 template<typename T>
60 static PassRefPtr<IDBAny> create(const T& idbObject) 66 static PassRefPtr<IDBAny> create(const T& idbObject)
61 { 67 {
62 return adoptRef(new IDBAny(idbObject)); 68 return adoptRef(new IDBAny(idbObject));
63 } 69 }
70 static PassRefPtr<IDBAny> create(PassRefPtr<SharedBuffer> value, const Vecto r<blink::WebBlobInfo>* blobInfo)
71 {
72 return adoptRef(new IDBAny(value, blobInfo));
73 }
64 template<typename T> 74 template<typename T>
65 static PassRefPtr<IDBAny> create(PassRefPtr<T> idbObject) 75 static PassRefPtr<IDBAny> create(PassRefPtr<T> idbObject)
66 { 76 {
67 return adoptRef(new IDBAny(idbObject)); 77 return adoptRef(new IDBAny(idbObject));
68 } 78 }
69 static PassRefPtr<IDBAny> create(int64_t value) 79 static PassRefPtr<IDBAny> create(int64_t value)
70 { 80 {
71 return adoptRef(new IDBAny(value)); 81 return adoptRef(new IDBAny(value));
72 } 82 }
73 static PassRefPtr<IDBAny> create(PassRefPtr<SharedBuffer> value, PassRefPtr< IDBKey> key, const IDBKeyPath& keyPath) 83 static PassRefPtr<IDBAny> create(PassRefPtr<SharedBuffer> value, const Vecto r<blink::WebBlobInfo>* blobInfo, PassRefPtr<IDBKey> key, const IDBKeyPath& keyPa th)
74 { 84 {
75 return adoptRef(new IDBAny(value, key, keyPath)); 85 return adoptRef(new IDBAny(value, blobInfo, key, keyPath));
76 } 86 }
77 ~IDBAny(); 87 ~IDBAny();
78 88
79 enum Type { 89 enum Type {
80 UndefinedType = 0, 90 UndefinedType = 0,
81 NullType, 91 NullType,
82 DOMStringListType, 92 DOMStringListType,
83 IDBCursorType, 93 IDBCursorType,
84 IDBCursorWithValueType, 94 IDBCursorWithValueType,
85 IDBDatabaseType, 95 IDBDatabaseType,
(...skipping 11 matching lines...) Expand all
97 Type type() const { return m_type; } 107 Type type() const { return m_type; }
98 // Use type() to figure out which one of these you're allowed to call. 108 // Use type() to figure out which one of these you're allowed to call.
99 DOMStringList* domStringList() const; 109 DOMStringList* domStringList() const;
100 IDBCursor* idbCursor() const; 110 IDBCursor* idbCursor() const;
101 IDBCursorWithValue* idbCursorWithValue() const; 111 IDBCursorWithValue* idbCursorWithValue() const;
102 IDBDatabase* idbDatabase() const; 112 IDBDatabase* idbDatabase() const;
103 IDBIndex* idbIndex() const; 113 IDBIndex* idbIndex() const;
104 IDBObjectStore* idbObjectStore() const; 114 IDBObjectStore* idbObjectStore() const;
105 IDBTransaction* idbTransaction() const; 115 IDBTransaction* idbTransaction() const;
106 SharedBuffer* buffer() const; 116 SharedBuffer* buffer() const;
117 const Vector<blink::WebBlobInfo>* blobInfo() const;
107 int64_t integer() const; 118 int64_t integer() const;
108 const String& string() const; 119 const String& string() const;
109 const IDBKey* key() const; 120 const IDBKey* key() const;
110 const IDBKeyPath& keyPath() const; 121 const IDBKeyPath& keyPath() const;
111 122
112 private: 123 private:
113 explicit IDBAny(Type); 124 explicit IDBAny(Type);
114 explicit IDBAny(PassRefPtr<DOMStringList>); 125 explicit IDBAny(PassRefPtr<DOMStringList>);
115 explicit IDBAny(PassRefPtr<IDBCursor>); 126 explicit IDBAny(PassRefPtr<IDBCursor>);
116 explicit IDBAny(PassRefPtr<IDBDatabase>); 127 explicit IDBAny(PassRefPtr<IDBDatabase>);
117 explicit IDBAny(PassRefPtr<IDBIndex>); 128 explicit IDBAny(PassRefPtr<IDBIndex>);
118 explicit IDBAny(PassRefPtr<IDBObjectStore>); 129 explicit IDBAny(PassRefPtr<IDBObjectStore>);
119 explicit IDBAny(PassRefPtr<IDBTransaction>); 130 explicit IDBAny(PassRefPtr<IDBTransaction>);
120 explicit IDBAny(PassRefPtr<IDBKey>); 131 explicit IDBAny(PassRefPtr<IDBKey>);
121 explicit IDBAny(const IDBKeyPath&); 132 explicit IDBAny(const IDBKeyPath&);
122 explicit IDBAny(const String&); 133 explicit IDBAny(const String&);
123 explicit IDBAny(PassRefPtr<SharedBuffer>); 134 IDBAny(PassRefPtr<SharedBuffer>, const Vector<blink::WebBlobInfo>*);
124 explicit IDBAny(PassRefPtr<SharedBuffer>, PassRefPtr<IDBKey>, const IDBKeyPa th&); 135 IDBAny(PassRefPtr<SharedBuffer>, const Vector<blink::WebBlobInfo>*, PassRefP tr<IDBKey>, const IDBKeyPath&);
125 explicit IDBAny(int64_t); 136 explicit IDBAny(int64_t);
126 137
127 const Type m_type; 138 const Type m_type;
128 139
129 // Only one of the following should ever be in use at any given time. 140 // Only one of the following should ever be in use at any given time, except that BufferType uses two and BufferKeyAndKeyPathType uses four.
130 const RefPtr<DOMStringList> m_domStringList; 141 const RefPtr<DOMStringList> m_domStringList;
131 const RefPtr<IDBCursor> m_idbCursor; 142 const RefPtr<IDBCursor> m_idbCursor;
132 const RefPtr<IDBDatabase> m_idbDatabase; 143 const RefPtr<IDBDatabase> m_idbDatabase;
133 const RefPtr<IDBIndex> m_idbIndex; 144 const RefPtr<IDBIndex> m_idbIndex;
134 const RefPtr<IDBObjectStore> m_idbObjectStore; 145 const RefPtr<IDBObjectStore> m_idbObjectStore;
135 const RefPtr<IDBTransaction> m_idbTransaction; 146 const RefPtr<IDBTransaction> m_idbTransaction;
136 const RefPtr<IDBKey> m_idbKey; 147 const RefPtr<IDBKey> m_idbKey;
137 const IDBKeyPath m_idbKeyPath; 148 const IDBKeyPath m_idbKeyPath;
138 const RefPtr<SharedBuffer> m_buffer; 149 const RefPtr<SharedBuffer> m_buffer;
150 const Vector<blink::WebBlobInfo>* m_blobInfo;
139 const String m_string; 151 const String m_string;
140 const int64_t m_integer; 152 const int64_t m_integer;
141 }; 153 };
142 154
143 } // namespace WebCore 155 } // namespace WebCore
144 156
145 #endif // IDBAny_h 157 #endif // IDBAny_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698