2010-06-23 23:46:08 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2015-05-03 22:32:37 +03:00
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-06-23 23:46:08 +04:00
|
|
|
|
2016-02-17 00:46:08 +03:00
|
|
|
#ifndef mozilla_dom_indexeddatabase_h__
|
|
|
|
#define mozilla_dom_indexeddatabase_h__
|
2010-06-23 23:46:08 +04:00
|
|
|
|
2013-08-20 10:43:47 +04:00
|
|
|
#include "js/StructuredClone.h"
|
2010-06-23 23:46:08 +04:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsTArray.h"
|
|
|
|
|
2014-09-27 03:21:57 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
2014-10-08 20:15:22 +04:00
|
|
|
|
2015-05-12 15:09:51 +03:00
|
|
|
class Blob;
|
2016-02-17 00:46:08 +03:00
|
|
|
class IDBDatabase;
|
|
|
|
class IDBMutableFile;
|
2014-10-08 20:15:22 +04:00
|
|
|
|
2014-09-27 03:21:57 +04:00
|
|
|
namespace indexedDB {
|
2010-12-10 05:15:00 +03:00
|
|
|
|
2011-12-16 11:34:24 +04:00
|
|
|
class FileInfo;
|
2014-09-27 03:21:57 +04:00
|
|
|
class SerializedStructuredCloneReadInfo;
|
2012-06-03 20:33:52 +04:00
|
|
|
|
2012-08-02 10:02:29 +04:00
|
|
|
struct StructuredCloneFile {
|
2016-10-25 22:18:40 +03:00
|
|
|
enum FileType {
|
2016-10-25 22:18:03 +03:00
|
|
|
eBlob,
|
|
|
|
eMutableFile,
|
2016-10-25 22:18:22 +03:00
|
|
|
eStructuredClone,
|
2016-10-25 22:18:48 +03:00
|
|
|
eWasmBytecode,
|
|
|
|
eWasmCompiled,
|
2016-10-25 22:18:44 +03:00
|
|
|
eEndGuard
|
2016-10-25 22:18:03 +03:00
|
|
|
};
|
|
|
|
|
2020-03-06 18:57:23 +03:00
|
|
|
RefPtr<Blob> mBlob;
|
|
|
|
RefPtr<IDBMutableFile> mMutableFile;
|
|
|
|
RefPtr<FileInfo> mFileInfo;
|
|
|
|
FileType mType;
|
2020-03-06 15:30:35 +03:00
|
|
|
|
2020-03-06 18:34:18 +03:00
|
|
|
// In IndexedDatabaseInlines.h
|
2020-03-06 18:57:23 +03:00
|
|
|
inline explicit StructuredCloneFile(FileType aType, RefPtr<Blob> aBlob = {});
|
2020-03-06 18:34:18 +03:00
|
|
|
|
2019-11-08 16:22:08 +03:00
|
|
|
// In IndexedDatabaseInlines.h
|
|
|
|
inline explicit StructuredCloneFile(RefPtr<IDBMutableFile> aMutableFile);
|
2014-09-18 03:36:01 +04:00
|
|
|
|
2014-09-27 03:21:57 +04:00
|
|
|
// In IndexedDatabaseInlines.h
|
|
|
|
inline ~StructuredCloneFile();
|
2011-12-16 11:34:24 +04:00
|
|
|
|
2012-06-01 21:21:12 +04:00
|
|
|
// In IndexedDatabaseInlines.h
|
2014-09-27 03:21:57 +04:00
|
|
|
inline bool operator==(const StructuredCloneFile& aOther) const;
|
2014-09-18 03:36:01 +04:00
|
|
|
};
|
2012-06-01 21:21:12 +04:00
|
|
|
|
2014-09-27 03:21:57 +04:00
|
|
|
struct StructuredCloneReadInfo {
|
2016-06-07 11:49:43 +03:00
|
|
|
JSStructuredCloneData mData;
|
2014-09-27 03:21:57 +04:00
|
|
|
nsTArray<StructuredCloneFile> mFiles;
|
|
|
|
IDBDatabase* mDatabase;
|
2016-10-26 07:51:33 +03:00
|
|
|
bool mHasPreprocessInfo;
|
2012-06-01 21:21:12 +04:00
|
|
|
|
2018-04-03 21:17:33 +03:00
|
|
|
// In IndexedDatabaseInlines.h
|
|
|
|
inline explicit StructuredCloneReadInfo(JS::StructuredCloneScope aScope);
|
|
|
|
|
2012-06-01 21:21:12 +04:00
|
|
|
// In IndexedDatabaseInlines.h
|
2014-09-27 03:21:57 +04:00
|
|
|
inline StructuredCloneReadInfo();
|
2012-06-01 21:21:12 +04:00
|
|
|
|
2014-09-13 20:12:19 +04:00
|
|
|
// In IndexedDatabaseInlines.h
|
2019-11-08 16:22:08 +03:00
|
|
|
inline StructuredCloneReadInfo(JSStructuredCloneData&& aData,
|
|
|
|
nsTArray<StructuredCloneFile> aFiles,
|
|
|
|
IDBDatabase* aDatabase,
|
|
|
|
bool aHasPreprocessInfo);
|
2011-12-16 11:34:24 +04:00
|
|
|
|
2019-11-08 16:22:08 +03:00
|
|
|
#ifdef NS_BUILD_REFCNT_LOGGING
|
2016-08-10 09:18:29 +03:00
|
|
|
// In IndexedDatabaseInlines.h
|
2019-11-08 16:22:08 +03:00
|
|
|
inline ~StructuredCloneReadInfo();
|
2016-08-10 09:18:29 +03:00
|
|
|
|
2014-09-27 03:21:57 +04:00
|
|
|
// In IndexedDatabaseInlines.h
|
2019-11-08 16:22:08 +03:00
|
|
|
//
|
|
|
|
// This custom implementation of the move ctor is only necessary because of
|
|
|
|
// MOZ_COUNT_CTOR. It is less efficient as the compiler-generated move ctor,
|
|
|
|
// since it unnecessarily clears elements on the source.
|
|
|
|
inline StructuredCloneReadInfo(StructuredCloneReadInfo&& aOther) noexcept;
|
2014-09-18 03:36:01 +04:00
|
|
|
|
2014-09-27 03:21:57 +04:00
|
|
|
// In IndexedDatabaseInlines.h
|
2019-11-08 16:22:08 +03:00
|
|
|
//
|
|
|
|
// This custom implementation of the move assignment operator is only there
|
|
|
|
// for symmetry with the move ctor. It is less efficient as the
|
|
|
|
// compiler-generated move assignment operator, since it unnecessarily clears
|
|
|
|
// elements on the source.
|
|
|
|
inline StructuredCloneReadInfo& operator=(
|
|
|
|
StructuredCloneReadInfo&& aOther) noexcept;
|
|
|
|
#else
|
|
|
|
StructuredCloneReadInfo(StructuredCloneReadInfo&& aOther) = default;
|
|
|
|
StructuredCloneReadInfo& operator=(StructuredCloneReadInfo&& aOther) =
|
|
|
|
default;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
StructuredCloneReadInfo(const StructuredCloneReadInfo& aOther) = delete;
|
|
|
|
StructuredCloneReadInfo& operator=(const StructuredCloneReadInfo& aOther) =
|
|
|
|
delete;
|
2018-01-27 15:40:58 +03:00
|
|
|
|
|
|
|
// In IndexedDatabaseInlines.h
|
|
|
|
inline size_t Size() const;
|
2012-06-01 21:21:12 +04:00
|
|
|
};
|
2010-12-10 05:15:00 +03:00
|
|
|
|
2014-09-27 03:21:57 +04:00
|
|
|
} // namespace indexedDB
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
2010-12-10 05:15:00 +03:00
|
|
|
|
2016-02-17 00:46:08 +03:00
|
|
|
#endif // mozilla_dom_indexeddatabase_h__
|