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 IndexedDatabaseInlines_h
8 #define IndexedDatabaseInlines_h
10 #ifndef mozilla_dom_indexeddb_indexeddatabase_h__
11 #error Must include IndexedDatabase.h first
14 BEGIN_INDEXEDDB_NAMESPACE
17 StructuredCloneWriteInfo::StructuredCloneWriteInfo()
18 : mTransaction(nullptr),
24 StructuredCloneWriteInfo::StructuredCloneWriteInfo(
25 StructuredCloneWriteInfo
&& aCloneWriteInfo
)
26 : mCloneBuffer(Move(aCloneWriteInfo
.mCloneBuffer
))
27 , mTransaction(aCloneWriteInfo
.mTransaction
)
28 , mOffsetToKeyProp(aCloneWriteInfo
.mOffsetToKeyProp
)
30 mFiles
.SwapElements(aCloneWriteInfo
.mFiles
);
31 aCloneWriteInfo
.mTransaction
= nullptr;
32 aCloneWriteInfo
.mOffsetToKeyProp
= 0;
37 StructuredCloneWriteInfo::SetFromSerialized(
38 const SerializedStructuredCloneWriteInfo
& aOther
)
40 if (!aOther
.dataLength
) {
43 else if (!mCloneBuffer
.copy(aOther
.data
, aOther
.dataLength
)) {
48 mOffsetToKeyProp
= aOther
.offsetToKeyProp
;
53 StructuredCloneReadInfo::StructuredCloneReadInfo()
58 inline StructuredCloneReadInfo
&
59 StructuredCloneReadInfo::operator=(StructuredCloneReadInfo
&& aCloneReadInfo
)
61 MOZ_ASSERT(&aCloneReadInfo
!= this);
63 mCloneBuffer
= Move(aCloneReadInfo
.mCloneBuffer
);
65 mFiles
.SwapElements(aCloneReadInfo
.mFiles
);
66 mDatabase
= aCloneReadInfo
.mDatabase
;
67 aCloneReadInfo
.mDatabase
= nullptr;
73 StructuredCloneReadInfo::SetFromSerialized(
74 const SerializedStructuredCloneReadInfo
& aOther
)
76 if (aOther
.dataLength
&&
77 !mCloneBuffer
.copy(aOther
.data
, aOther
.dataLength
)) {
87 AppendConditionClause(const nsACString
& aColumnName
,
88 const nsACString
& aArgName
,
93 aResult
+= NS_LITERAL_CSTRING(" AND ") + aColumnName
+
94 NS_LITERAL_CSTRING(" ");
107 aResult
+= NS_LITERAL_CSTRING(" :") + aArgName
;
110 END_INDEXEDDB_NAMESPACE