Bug 1025824 - Fix mHwcLayerMap handling r=sushil
[gecko.git] / dom / indexedDB / IndexedDatabaseInlines.h
blobb856af67d55df066cbb92852f7f59ca75a60038c
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
12 #endif
14 BEGIN_INDEXEDDB_NAMESPACE
16 inline
17 StructuredCloneWriteInfo::StructuredCloneWriteInfo()
18 : mTransaction(nullptr),
19 mOffsetToKeyProp(0)
23 inline
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;
35 inline
36 bool
37 StructuredCloneWriteInfo::SetFromSerialized(
38 const SerializedStructuredCloneWriteInfo& aOther)
40 if (!aOther.dataLength) {
41 mCloneBuffer.clear();
43 else if (!mCloneBuffer.copy(aOther.data, aOther.dataLength)) {
44 return false;
47 mFiles.Clear();
48 mOffsetToKeyProp = aOther.offsetToKeyProp;
49 return true;
52 inline
53 StructuredCloneReadInfo::StructuredCloneReadInfo()
54 : mDatabase(nullptr)
58 inline StructuredCloneReadInfo&
59 StructuredCloneReadInfo::operator=(StructuredCloneReadInfo&& aCloneReadInfo)
61 MOZ_ASSERT(&aCloneReadInfo != this);
63 mCloneBuffer = Move(aCloneReadInfo.mCloneBuffer);
64 mFiles.Clear();
65 mFiles.SwapElements(aCloneReadInfo.mFiles);
66 mDatabase = aCloneReadInfo.mDatabase;
67 aCloneReadInfo.mDatabase = nullptr;
68 return *this;
71 inline
72 bool
73 StructuredCloneReadInfo::SetFromSerialized(
74 const SerializedStructuredCloneReadInfo& aOther)
76 if (aOther.dataLength &&
77 !mCloneBuffer.copy(aOther.data, aOther.dataLength)) {
78 return false;
81 mFiles.Clear();
82 return true;
85 inline
86 void
87 AppendConditionClause(const nsACString& aColumnName,
88 const nsACString& aArgName,
89 bool aLessThan,
90 bool aEquals,
91 nsACString& aResult)
93 aResult += NS_LITERAL_CSTRING(" AND ") + aColumnName +
94 NS_LITERAL_CSTRING(" ");
96 if (aLessThan) {
97 aResult.Append('<');
99 else {
100 aResult.Append('>');
103 if (aEquals) {
104 aResult.Append('=');
107 aResult += NS_LITERAL_CSTRING(" :") + aArgName;
110 END_INDEXEDDB_NAMESPACE
112 #endif