2012-06-03 09:33:52 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
|
|
|
/* 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/. */
|
|
|
|
|
2014-07-17 09:40:54 -07:00
|
|
|
#ifndef mozilla_dom_indexeddb_filesnapshot_h__
|
|
|
|
#define mozilla_dom_indexeddb_filesnapshot_h__
|
2012-06-03 09:33:52 -07:00
|
|
|
|
2013-06-05 09:15:48 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2014-10-08 09:15:23 -07:00
|
|
|
#include "mozilla/dom/File.h"
|
2014-05-07 07:32:12 -07:00
|
|
|
#include "nsAutoPtr.h"
|
|
|
|
#include "nsCOMPtr.h"
|
2014-10-20 17:49:00 -07:00
|
|
|
#include "nsISupports.h"
|
|
|
|
|
|
|
|
#define FILEIMPLSNAPSHOT_IID \
|
|
|
|
{0x0dfc11b1, 0x75d3, 0x473b, {0x8c, 0x67, 0xb7, 0x23, 0xf4, 0x67, 0xd6, 0x73}}
|
|
|
|
|
|
|
|
class PIFileImplSnapshot : public nsISupports
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(FILEIMPLSNAPSHOT_IID)
|
|
|
|
};
|
|
|
|
|
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(PIFileImplSnapshot, FILEIMPLSNAPSHOT_IID)
|
2012-06-03 09:33:52 -07:00
|
|
|
|
2014-05-07 07:32:12 -07:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
2014-09-26 16:21:57 -07:00
|
|
|
|
|
|
|
class MetadataParameters;
|
|
|
|
|
2014-07-17 09:40:54 -07:00
|
|
|
namespace indexedDB {
|
2012-06-03 09:33:52 -07:00
|
|
|
|
2014-07-17 09:40:54 -07:00
|
|
|
class IDBFileHandle;
|
2012-06-03 09:33:52 -07:00
|
|
|
|
2014-09-26 16:21:57 -07:00
|
|
|
class FileImplSnapshot MOZ_FINAL
|
2014-10-08 09:15:23 -07:00
|
|
|
: public FileImplBase
|
2014-10-20 17:49:00 -07:00
|
|
|
, public PIFileImplSnapshot
|
2012-06-03 09:33:52 -07:00
|
|
|
{
|
2014-09-26 16:21:57 -07:00
|
|
|
typedef mozilla::dom::MetadataParameters MetadataParameters;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIFile> mFile;
|
|
|
|
nsRefPtr<IDBFileHandle> mFileHandle;
|
2014-09-13 09:12:19 -07:00
|
|
|
|
2014-09-26 16:21:57 -07:00
|
|
|
bool mWholeFile;
|
|
|
|
|
|
|
|
public:
|
2014-09-17 16:36:01 -07:00
|
|
|
// Create as a stored file
|
2014-09-26 16:21:57 -07:00
|
|
|
FileImplSnapshot(const nsAString& aName,
|
|
|
|
const nsAString& aContentType,
|
|
|
|
MetadataParameters* aMetadataParams,
|
|
|
|
nsIFile* aFile,
|
|
|
|
IDBFileHandle* aFileHandle,
|
2014-09-17 16:36:01 -07:00
|
|
|
FileInfo* aFileInfo);
|
2014-09-13 09:12:19 -07:00
|
|
|
|
2014-09-26 16:21:57 -07:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
|
|
|
private:
|
|
|
|
// Create slice
|
|
|
|
FileImplSnapshot(const FileImplSnapshot* aOther,
|
|
|
|
uint64_t aStart,
|
|
|
|
uint64_t aLength,
|
|
|
|
const nsAString& aContentType);
|
|
|
|
|
|
|
|
~FileImplSnapshot();
|
|
|
|
|
|
|
|
static void
|
|
|
|
AssertSanity()
|
|
|
|
#ifdef DEBUG
|
|
|
|
;
|
|
|
|
#else
|
|
|
|
{ }
|
|
|
|
#endif
|
|
|
|
|
2014-10-08 09:15:22 -07:00
|
|
|
virtual void
|
|
|
|
GetMozFullPathInternal(nsAString& aFullPath, ErrorResult& aRv) MOZ_OVERRIDE;
|
2014-07-17 09:40:54 -07:00
|
|
|
|
|
|
|
virtual nsresult
|
|
|
|
GetInternalStream(nsIInputStream** aStream) MOZ_OVERRIDE;
|
2014-06-26 09:47:44 -07:00
|
|
|
|
2014-07-17 09:40:54 -07:00
|
|
|
virtual void
|
|
|
|
Unlink() MOZ_OVERRIDE;
|
2012-06-03 09:33:52 -07:00
|
|
|
|
2014-07-17 09:40:54 -07:00
|
|
|
virtual void
|
|
|
|
Traverse(nsCycleCollectionTraversalCallback &aCb) MOZ_OVERRIDE;
|
2012-06-03 09:33:52 -07:00
|
|
|
|
2014-07-17 09:40:54 -07:00
|
|
|
virtual bool
|
2014-09-26 16:21:57 -07:00
|
|
|
IsCCed() const MOZ_OVERRIDE;
|
2012-06-03 09:33:52 -07:00
|
|
|
|
2014-10-08 09:15:23 -07:00
|
|
|
virtual already_AddRefed<FileImpl>
|
2014-09-26 16:21:57 -07:00
|
|
|
CreateSlice(uint64_t aStart,
|
|
|
|
uint64_t aLength,
|
2014-10-08 09:15:22 -07:00
|
|
|
const nsAString& aContentType,
|
|
|
|
ErrorResult& aRv) MOZ_OVERRIDE;
|
2012-06-03 09:33:52 -07:00
|
|
|
|
|
|
|
virtual bool
|
2014-09-26 16:21:57 -07:00
|
|
|
IsStoredFile() const MOZ_OVERRIDE;
|
2012-06-03 09:33:52 -07:00
|
|
|
|
|
|
|
virtual bool
|
2014-09-26 16:21:57 -07:00
|
|
|
IsWholeFile() const MOZ_OVERRIDE;
|
2012-06-03 09:33:52 -07:00
|
|
|
|
|
|
|
virtual bool
|
2014-09-26 16:21:57 -07:00
|
|
|
IsSnapshot() const MOZ_OVERRIDE;
|
2012-06-03 09:33:52 -07:00
|
|
|
};
|
|
|
|
|
2014-07-17 09:40:54 -07:00
|
|
|
} // namespace indexedDB
|
2014-05-07 07:32:12 -07:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
2012-06-03 09:33:52 -07:00
|
|
|
|
2014-07-17 09:40:54 -07:00
|
|
|
#endif // mozilla_dom_indexeddb_filesnapshot_h__
|