Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set ts=8 sts=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/. */
6 :
7 : #ifndef IndexedDatabaseInlines_h
8 : #define IndexedDatabaseInlines_h
9 :
10 : #ifndef mozilla_dom_indexeddatabase_h__
11 : #error Must include IndexedDatabase.h first
12 : #endif
13 :
14 : #include "FileInfo.h"
15 : #include "IDBMutableFile.h"
16 : #include "mozilla/dom/indexedDB/PBackgroundIDBSharedTypes.h"
17 : #include "mozilla/dom/File.h"
18 : #include "nsIInputStream.h"
19 :
20 : namespace mozilla {
21 : namespace dom {
22 : namespace indexedDB {
23 :
24 : inline
25 0 : StructuredCloneFile::StructuredCloneFile()
26 0 : : mType(eBlob)
27 : {
28 0 : MOZ_COUNT_CTOR(StructuredCloneFile);
29 0 : }
30 :
31 : inline
32 0 : StructuredCloneFile::~StructuredCloneFile()
33 : {
34 0 : MOZ_COUNT_DTOR(StructuredCloneFile);
35 0 : }
36 :
37 : inline
38 : bool
39 : StructuredCloneFile::operator==(const StructuredCloneFile& aOther) const
40 : {
41 : return this->mBlob == aOther.mBlob &&
42 : this->mMutableFile == aOther.mMutableFile &&
43 : this->mFileInfo == aOther.mFileInfo &&
44 : this->mType == aOther.mType;
45 : }
46 :
47 : inline
48 0 : StructuredCloneReadInfo::StructuredCloneReadInfo()
49 : : mDatabase(nullptr)
50 0 : , mHasPreprocessInfo(false)
51 : {
52 0 : MOZ_COUNT_CTOR(StructuredCloneReadInfo);
53 0 : }
54 :
55 : inline
56 0 : StructuredCloneReadInfo::StructuredCloneReadInfo(
57 0 : StructuredCloneReadInfo&& aCloneReadInfo)
58 0 : : mData(Move(aCloneReadInfo.mData))
59 : {
60 0 : MOZ_ASSERT(&aCloneReadInfo != this);
61 0 : MOZ_COUNT_CTOR(StructuredCloneReadInfo);
62 :
63 0 : mFiles.Clear();
64 0 : mFiles.SwapElements(aCloneReadInfo.mFiles);
65 0 : mDatabase = aCloneReadInfo.mDatabase;
66 0 : aCloneReadInfo.mDatabase = nullptr;
67 0 : mHasPreprocessInfo = aCloneReadInfo.mHasPreprocessInfo;
68 0 : aCloneReadInfo.mHasPreprocessInfo = false;
69 0 : }
70 :
71 : inline
72 0 : StructuredCloneReadInfo::StructuredCloneReadInfo(
73 0 : SerializedStructuredCloneReadInfo&& aCloneReadInfo)
74 0 : : mData(Move(aCloneReadInfo.data().data))
75 : , mDatabase(nullptr)
76 0 : , mHasPreprocessInfo(aCloneReadInfo.hasPreprocessInfo())
77 : {
78 0 : MOZ_COUNT_CTOR(StructuredCloneReadInfo);
79 0 : }
80 :
81 : inline
82 0 : StructuredCloneReadInfo::~StructuredCloneReadInfo()
83 : {
84 0 : MOZ_COUNT_DTOR(StructuredCloneReadInfo);
85 0 : }
86 :
87 : inline StructuredCloneReadInfo&
88 0 : StructuredCloneReadInfo::operator=(StructuredCloneReadInfo&& aCloneReadInfo)
89 : {
90 0 : MOZ_ASSERT(&aCloneReadInfo != this);
91 :
92 0 : mData = Move(aCloneReadInfo.mData);
93 0 : mFiles.Clear();
94 0 : mFiles.SwapElements(aCloneReadInfo.mFiles);
95 0 : mDatabase = aCloneReadInfo.mDatabase;
96 0 : aCloneReadInfo.mDatabase = nullptr;
97 0 : mHasPreprocessInfo = aCloneReadInfo.mHasPreprocessInfo;
98 0 : aCloneReadInfo.mHasPreprocessInfo = false;
99 0 : return *this;
100 : }
101 :
102 : } // namespace indexedDB
103 : } // namespace dom
104 : } // namespace mozilla
105 :
106 : #endif // IndexedDatabaseInlines_h
|