2010-06-23 19:46:08 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2015-05-03 19:32:37 +00:00
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 11:12:37 +00: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 19:46:08 +00:00
|
|
|
|
2016-02-16 21:46:08 +00:00
|
|
|
#ifndef mozilla_dom_indexeddatabase_h__
|
|
|
|
#define mozilla_dom_indexeddatabase_h__
|
2010-06-23 19:46:08 +00:00
|
|
|
|
2013-08-20 06:43:47 +00:00
|
|
|
#include "js/StructuredClone.h"
|
2010-06-23 19:46:08 +00:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsTArray.h"
|
|
|
|
|
2014-09-26 23:21:57 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
2014-10-08 16:15:22 +00:00
|
|
|
|
2015-05-12 12:09:51 +00:00
|
|
|
class Blob;
|
2016-02-16 21:46:08 +00:00
|
|
|
class IDBDatabase;
|
|
|
|
class IDBMutableFile;
|
2014-10-08 16:15:22 +00:00
|
|
|
|
2014-09-26 23:21:57 +00:00
|
|
|
namespace indexedDB {
|
2010-12-10 02:15:00 +00:00
|
|
|
|
2011-12-16 07:34:24 +00:00
|
|
|
class FileInfo;
|
2014-09-26 23:21:57 +00:00
|
|
|
class SerializedStructuredCloneReadInfo;
|
2012-06-03 16:33:52 +00:00
|
|
|
|
2012-08-02 06:02:29 +00:00
|
|
|
struct StructuredCloneFile {
|
2016-10-25 19:18:40 +00:00
|
|
|
enum FileType {
|
2016-10-25 19:18:03 +00:00
|
|
|
eBlob,
|
|
|
|
eMutableFile,
|
2016-10-25 19:18:22 +00:00
|
|
|
eStructuredClone,
|
2016-10-25 19:18:48 +00:00
|
|
|
eWasmBytecode,
|
|
|
|
eWasmCompiled,
|
2016-10-25 19:18:44 +00:00
|
|
|
eEndGuard
|
2016-10-25 19:18:03 +00:00
|
|
|
};
|
|
|
|
|
2015-10-18 05:24:48 +00:00
|
|
|
RefPtr<Blob> mBlob;
|
|
|
|
RefPtr<IDBMutableFile> mMutableFile;
|
|
|
|
RefPtr<FileInfo> mFileInfo;
|
2016-10-25 19:18:40 +00:00
|
|
|
FileType mType;
|
2012-06-03 16:33:52 +00:00
|
|
|
|
2014-09-13 16:12:19 +00:00
|
|
|
// In IndexedDatabaseInlines.h
|
2019-11-08 13:22:08 +00:00
|
|
|
inline explicit StructuredCloneFile(FileType aType, RefPtr<Blob> aBlob = {});
|
|
|
|
|
|
|
|
// In IndexedDatabaseInlines.h
|
|
|
|
inline explicit StructuredCloneFile(RefPtr<IDBMutableFile> aMutableFile);
|
2014-09-17 23:36:01 +00:00
|
|
|
|
2014-09-26 23:21:57 +00:00
|
|
|
// In IndexedDatabaseInlines.h
|
|
|
|
inline ~StructuredCloneFile();
|
2011-12-16 07:34:24 +00:00
|
|
|
|
2012-06-01 17:21:12 +00:00
|
|
|
// In IndexedDatabaseInlines.h
|
2014-09-26 23:21:57 +00:00
|
|
|
inline bool operator==(const StructuredCloneFile& aOther) const;
|
2014-09-17 23:36:01 +00:00
|
|
|
};
|
2012-06-01 17:21:12 +00:00
|
|
|
|
2014-09-26 23:21:57 +00:00
|
|
|
struct StructuredCloneReadInfo {
|
2016-06-07 08:49:43 +00:00
|
|
|
JSStructuredCloneData mData;
|
2014-09-26 23:21:57 +00:00
|
|
|
nsTArray<StructuredCloneFile> mFiles;
|
|
|
|
IDBDatabase* mDatabase;
|
2016-10-26 04:51:33 +00:00
|
|
|
bool mHasPreprocessInfo;
|
2012-06-01 17:21:12 +00:00
|
|
|
|
2018-04-03 18:17:33 +00:00
|
|
|
// In IndexedDatabaseInlines.h
|
|
|
|
inline explicit StructuredCloneReadInfo(JS::StructuredCloneScope aScope);
|
|
|
|
|
2012-06-01 17:21:12 +00:00
|
|
|
// In IndexedDatabaseInlines.h
|
2014-09-26 23:21:57 +00:00
|
|
|
inline StructuredCloneReadInfo();
|
2012-06-01 17:21:12 +00:00
|
|
|
|
2014-09-13 16:12:19 +00:00
|
|
|
// In IndexedDatabaseInlines.h
|
2019-11-08 13:22:08 +00:00
|
|
|
inline StructuredCloneReadInfo(JSStructuredCloneData&& aData,
|
|
|
|
nsTArray<StructuredCloneFile> aFiles,
|
|
|
|
IDBDatabase* aDatabase,
|
|
|
|
bool aHasPreprocessInfo);
|
2011-12-16 07:34:24 +00:00
|
|
|
|
2019-11-08 13:22:08 +00:00
|
|
|
#ifdef NS_BUILD_REFCNT_LOGGING
|
2016-08-10 06:18:29 +00:00
|
|
|
// In IndexedDatabaseInlines.h
|
2019-11-08 13:22:08 +00:00
|
|
|
inline ~StructuredCloneReadInfo();
|
2016-08-10 06:18:29 +00:00
|
|
|
|
2014-09-26 23:21:57 +00:00
|
|
|
// In IndexedDatabaseInlines.h
|
2019-11-08 13:22:08 +00: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-17 23:36:01 +00:00
|
|
|
|
2014-09-26 23:21:57 +00:00
|
|
|
// In IndexedDatabaseInlines.h
|
2019-11-08 13:22:08 +00: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 12:40:58 +00:00
|
|
|
|
|
|
|
// In IndexedDatabaseInlines.h
|
|
|
|
inline size_t Size() const;
|
2012-06-01 17:21:12 +00:00
|
|
|
};
|
2010-12-10 02:15:00 +00:00
|
|
|
|
2014-09-26 23:21:57 +00:00
|
|
|
} // namespace indexedDB
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
2010-12-10 02:15:00 +00:00
|
|
|
|
2016-02-16 21:46:08 +00:00
|
|
|
#endif // mozilla_dom_indexeddatabase_h__
|