Bumping manifests a=b2g-bump
[gecko.git] / dom / indexedDB / IndexedDatabase.h
blob1afeab71b0def9cb43c3439efb260c32c17309f6
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_indexeddb_indexeddatabase_h__
8 #define mozilla_dom_indexeddb_indexeddatabase_h__
10 #include "nsIProgrammingLanguage.h"
12 #include "mozilla/Attributes.h"
13 #include "js/StructuredClone.h"
14 #include "nsAutoPtr.h"
15 #include "nsCOMPtr.h"
16 #include "nsDebug.h"
17 #include "nsError.h"
18 #include "nsString.h"
19 #include "nsTArray.h"
20 #include "nsIInputStream.h"
22 #define BEGIN_INDEXEDDB_NAMESPACE \
23 namespace mozilla { namespace dom { namespace indexedDB {
25 #define END_INDEXEDDB_NAMESPACE \
26 } /* namespace indexedDB */ } /* namepsace dom */ } /* namespace mozilla */
28 #define USING_INDEXEDDB_NAMESPACE \
29 using namespace mozilla::dom::indexedDB;
31 class nsIDOMBlob;
33 BEGIN_INDEXEDDB_NAMESPACE
35 class FileInfo;
36 class IDBDatabase;
37 class IDBTransaction;
39 struct StructuredCloneFile
41 bool operator==(const StructuredCloneFile& aOther) const
43 return this->mFile == aOther.mFile &&
44 this->mFileInfo == aOther.mFileInfo &&
45 this->mInputStream == aOther.mInputStream;
48 nsCOMPtr<nsIDOMBlob> mFile;
49 nsRefPtr<FileInfo> mFileInfo;
50 nsCOMPtr<nsIInputStream> mInputStream;
53 struct SerializedStructuredCloneReadInfo;
55 struct StructuredCloneReadInfo
57 // In IndexedDatabaseInlines.h
58 inline StructuredCloneReadInfo();
60 inline StructuredCloneReadInfo&
61 operator=(StructuredCloneReadInfo&& aCloneReadInfo);
63 // In IndexedDatabaseInlines.h
64 inline bool
65 SetFromSerialized(const SerializedStructuredCloneReadInfo& aOther);
67 JSAutoStructuredCloneBuffer mCloneBuffer;
68 nsTArray<StructuredCloneFile> mFiles;
69 IDBDatabase* mDatabase;
72 struct SerializedStructuredCloneReadInfo
74 SerializedStructuredCloneReadInfo()
75 : data(nullptr), dataLength(0)
76 { }
78 bool
79 operator==(const SerializedStructuredCloneReadInfo& aOther) const
81 return this->data == aOther.data &&
82 this->dataLength == aOther.dataLength;
85 SerializedStructuredCloneReadInfo&
86 operator=(const StructuredCloneReadInfo& aOther)
88 data = aOther.mCloneBuffer.data();
89 dataLength = aOther.mCloneBuffer.nbytes();
90 return *this;
93 // Make sure to update ipc/SerializationHelpers.h when changing members here!
94 uint64_t* data;
95 size_t dataLength;
98 struct SerializedStructuredCloneWriteInfo;
100 struct StructuredCloneWriteInfo
102 // In IndexedDatabaseInlines.h
103 inline StructuredCloneWriteInfo();
104 inline StructuredCloneWriteInfo(StructuredCloneWriteInfo&& aCloneWriteInfo);
106 bool operator==(const StructuredCloneWriteInfo& aOther) const
108 return this->mCloneBuffer.nbytes() == aOther.mCloneBuffer.nbytes() &&
109 this->mCloneBuffer.data() == aOther.mCloneBuffer.data() &&
110 this->mFiles == aOther.mFiles &&
111 this->mTransaction == aOther.mTransaction &&
112 this->mOffsetToKeyProp == aOther.mOffsetToKeyProp;
115 // In IndexedDatabaseInlines.h
116 inline bool
117 SetFromSerialized(const SerializedStructuredCloneWriteInfo& aOther);
119 JSAutoStructuredCloneBuffer mCloneBuffer;
120 nsTArray<StructuredCloneFile> mFiles;
121 IDBTransaction* mTransaction;
122 uint64_t mOffsetToKeyProp;
125 struct SerializedStructuredCloneWriteInfo
127 SerializedStructuredCloneWriteInfo()
128 : data(nullptr), dataLength(0), offsetToKeyProp(0)
131 bool
132 operator==(const SerializedStructuredCloneWriteInfo& aOther) const
134 return this->data == aOther.data &&
135 this->dataLength == aOther.dataLength &&
136 this->offsetToKeyProp == aOther.offsetToKeyProp;
139 SerializedStructuredCloneWriteInfo&
140 operator=(const StructuredCloneWriteInfo& aOther)
142 data = aOther.mCloneBuffer.data();
143 dataLength = aOther.mCloneBuffer.nbytes();
144 offsetToKeyProp = aOther.mOffsetToKeyProp;
145 return *this;
148 // Make sure to update ipc/SerializationHelpers.h when changing members here!
149 uint64_t* data;
150 size_t dataLength;
151 uint64_t offsetToKeyProp;
154 END_INDEXEDDB_NAMESPACE
156 #endif // mozilla_dom_indexeddb_indexeddatabase_h__