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

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: Fix oilpan type merge 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
« no previous file with comments | « Source/bindings/v8/IDBBindingUtilities.cpp ('k') | Source/modules/indexeddb/IDBAny.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 RefCountedWillBeGarbageCollectedFinalized<IDBAny> { 55 class IDBAny : public RefCountedWillBeGarbageCollectedFinalized<IDBAny> {
50 public: 56 public:
51 static PassRefPtrWillBeRawPtr<IDBAny> createUndefined(); 57 static PassRefPtrWillBeRawPtr<IDBAny> createUndefined();
52 static PassRefPtrWillBeRawPtr<IDBAny> createNull(); 58 static PassRefPtrWillBeRawPtr<IDBAny> createNull();
53 static PassRefPtrWillBeRawPtr<IDBAny> createString(const String&); 59 static PassRefPtrWillBeRawPtr<IDBAny> createString(const String&);
54 template<typename T> 60 template<typename T>
55 static PassRefPtrWillBeRawPtr<IDBAny> create(T* idbObject) 61 static PassRefPtrWillBeRawPtr<IDBAny> create(T* idbObject)
56 { 62 {
57 return adoptRefWillBeNoop(new IDBAny(idbObject)); 63 return adoptRefWillBeNoop(new IDBAny(idbObject));
58 } 64 }
59 template<typename T> 65 template<typename T>
60 static PassRefPtrWillBeRawPtr<IDBAny> create(const T& idbObject) 66 static PassRefPtrWillBeRawPtr<IDBAny> create(const T& idbObject)
61 { 67 {
62 return adoptRefWillBeNoop(new IDBAny(idbObject)); 68 return adoptRefWillBeNoop(new IDBAny(idbObject));
63 } 69 }
70 static PassRefPtrWillBeRawPtr<IDBAny> create(PassRefPtr<SharedBuffer> value, const Vector<blink::WebBlobInfo>* blobInfo)
71 {
72 return adoptRefWillBeNoop(new IDBAny(value, blobInfo));
73 }
64 template<typename T> 74 template<typename T>
65 static PassRefPtrWillBeRawPtr<IDBAny> create(PassRefPtr<T> idbObject) 75 static PassRefPtrWillBeRawPtr<IDBAny> create(PassRefPtr<T> idbObject)
66 { 76 {
67 return adoptRefWillBeNoop(new IDBAny(idbObject)); 77 return adoptRefWillBeNoop(new IDBAny(idbObject));
68 } 78 }
69 static PassRefPtrWillBeRawPtr<IDBAny> create(int64_t value) 79 static PassRefPtrWillBeRawPtr<IDBAny> create(int64_t value)
70 { 80 {
71 return adoptRefWillBeNoop(new IDBAny(value)); 81 return adoptRefWillBeNoop(new IDBAny(value));
72 } 82 }
73 static PassRefPtrWillBeRawPtr<IDBAny> create(PassRefPtr<SharedBuffer> value, PassRefPtr<IDBKey> key, const IDBKeyPath& keyPath) 83 static PassRefPtrWillBeRawPtr<IDBAny> create(PassRefPtr<SharedBuffer> value, const Vector<blink::WebBlobInfo>* blobInfo, PassRefPtr<IDBKey> key, const IDBKe yPath& keyPath)
74 { 84 {
75 return adoptRefWillBeNoop(new IDBAny(value, key, keyPath)); 85 return adoptRefWillBeNoop(new IDBAny(value, blobInfo, key, keyPath));
76 } 86 }
77 ~IDBAny(); 87 ~IDBAny();
78 void trace(Visitor*); 88 void trace(Visitor*);
79 void contextWillBeDestroyed(); 89 void contextWillBeDestroyed();
80 90
81 enum Type { 91 enum Type {
82 UndefinedType = 0, 92 UndefinedType = 0,
83 NullType, 93 NullType,
84 DOMStringListType, 94 DOMStringListType,
85 IDBCursorType, 95 IDBCursorType,
(...skipping 13 matching lines...) Expand all
99 Type type() const { return m_type; } 109 Type type() const { return m_type; }
100 // Use type() to figure out which one of these you're allowed to call. 110 // Use type() to figure out which one of these you're allowed to call.
101 DOMStringList* domStringList() const; 111 DOMStringList* domStringList() const;
102 IDBCursor* idbCursor() const; 112 IDBCursor* idbCursor() const;
103 IDBCursorWithValue* idbCursorWithValue() const; 113 IDBCursorWithValue* idbCursorWithValue() const;
104 IDBDatabase* idbDatabase() const; 114 IDBDatabase* idbDatabase() const;
105 IDBIndex* idbIndex() const; 115 IDBIndex* idbIndex() const;
106 IDBObjectStore* idbObjectStore() const; 116 IDBObjectStore* idbObjectStore() const;
107 IDBTransaction* idbTransaction() const; 117 IDBTransaction* idbTransaction() const;
108 SharedBuffer* buffer() const; 118 SharedBuffer* buffer() const;
119 const Vector<blink::WebBlobInfo>* blobInfo() const;
109 int64_t integer() const; 120 int64_t integer() const;
110 const String& string() const; 121 const String& string() const;
111 const IDBKey* key() const; 122 const IDBKey* key() const;
112 const IDBKeyPath& keyPath() const; 123 const IDBKeyPath& keyPath() const;
113 124
114 private: 125 private:
115 explicit IDBAny(Type); 126 explicit IDBAny(Type);
116 explicit IDBAny(PassRefPtr<DOMStringList>); 127 explicit IDBAny(PassRefPtr<DOMStringList>);
117 explicit IDBAny(PassRefPtrWillBeRawPtr<IDBCursor>); 128 explicit IDBAny(PassRefPtrWillBeRawPtr<IDBCursor>);
118 explicit IDBAny(PassRefPtr<IDBDatabase>); 129 explicit IDBAny(PassRefPtr<IDBDatabase>);
119 explicit IDBAny(PassRefPtr<IDBIndex>); 130 explicit IDBAny(PassRefPtr<IDBIndex>);
120 explicit IDBAny(PassRefPtr<IDBObjectStore>); 131 explicit IDBAny(PassRefPtr<IDBObjectStore>);
121 explicit IDBAny(PassRefPtr<IDBTransaction>); 132 explicit IDBAny(PassRefPtr<IDBTransaction>);
122 explicit IDBAny(PassRefPtr<IDBKey>); 133 explicit IDBAny(PassRefPtr<IDBKey>);
123 explicit IDBAny(const IDBKeyPath&); 134 explicit IDBAny(const IDBKeyPath&);
124 explicit IDBAny(const String&); 135 explicit IDBAny(const String&);
125 explicit IDBAny(PassRefPtr<SharedBuffer>); 136 IDBAny(PassRefPtr<SharedBuffer>, const Vector<blink::WebBlobInfo>*);
126 explicit IDBAny(PassRefPtr<SharedBuffer>, PassRefPtr<IDBKey>, const IDBKeyPa th&); 137 IDBAny(PassRefPtr<SharedBuffer>, const Vector<blink::WebBlobInfo>*, PassRefP tr<IDBKey>, const IDBKeyPath&);
127 explicit IDBAny(int64_t); 138 explicit IDBAny(int64_t);
128 139
129 const Type m_type; 140 const Type m_type;
130 141
131 // Only one of the following should ever be in use at any given time. 142 // Only one of the following should ever be in use at any given time, except that BufferType uses two and BufferKeyAndKeyPathType uses four.
132 const RefPtr<DOMStringList> m_domStringList; 143 const RefPtr<DOMStringList> m_domStringList;
133 const RefPtrWillBeMember<IDBCursor> m_idbCursor; 144 const RefPtrWillBeMember<IDBCursor> m_idbCursor;
134 const RefPtr<IDBDatabase> m_idbDatabase; 145 const RefPtr<IDBDatabase> m_idbDatabase;
135 const RefPtr<IDBIndex> m_idbIndex; 146 const RefPtr<IDBIndex> m_idbIndex;
136 const RefPtr<IDBObjectStore> m_idbObjectStore; 147 const RefPtr<IDBObjectStore> m_idbObjectStore;
137 const RefPtr<IDBTransaction> m_idbTransaction; 148 const RefPtr<IDBTransaction> m_idbTransaction;
138 const RefPtr<IDBKey> m_idbKey; 149 const RefPtr<IDBKey> m_idbKey;
139 const IDBKeyPath m_idbKeyPath; 150 const IDBKeyPath m_idbKeyPath;
140 const RefPtr<SharedBuffer> m_buffer; 151 const RefPtr<SharedBuffer> m_buffer;
152 const Vector<blink::WebBlobInfo>* m_blobInfo;
141 const String m_string; 153 const String m_string;
142 const int64_t m_integer; 154 const int64_t m_integer;
143 }; 155 };
144 156
145 } // namespace WebCore 157 } // namespace WebCore
146 158
147 #endif // IDBAny_h 159 #endif // IDBAny_h
OLDNEW
« no previous file with comments | « Source/bindings/v8/IDBBindingUtilities.cpp ('k') | Source/modules/indexeddb/IDBAny.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698