2012-06-03 20:33:52 +04: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 20:40:54 +04:00
|
|
|
#ifndef mozilla_dom_indexeddb_filesnapshot_h__
|
|
|
|
#define mozilla_dom_indexeddb_filesnapshot_h__
|
2012-06-03 20:33:52 +04:00
|
|
|
|
2013-06-05 20:15:48 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2014-10-08 20:15:23 +04:00
|
|
|
#include "mozilla/dom/File.h"
|
2014-05-07 18:32:12 +04:00
|
|
|
#include "nsAutoPtr.h"
|
|
|
|
#include "nsCOMPtr.h"
|
2012-06-03 20:33:52 +04:00
|
|
|
|
2014-05-07 18:32:12 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
2014-09-27 03:21:57 +04:00
|
|
|
|
|
|
|
class MetadataParameters;
|
|
|
|
|
2014-07-17 20:40:54 +04:00
|
|
|
namespace indexedDB {
|
2012-06-03 20:33:52 +04:00
|
|
|
|
2014-07-17 20:40:54 +04:00
|
|
|
class IDBFileHandle;
|
2012-06-03 20:33:52 +04:00
|
|
|
|
2014-09-27 03:21:57 +04:00
|
|
|
class FileImplSnapshot MOZ_FINAL
|
2014-10-08 20:15:23 +04:00
|
|
|
: public FileImplBase
|
2012-06-03 20:33:52 +04:00
|
|
|
{
|
2014-09-27 03:21:57 +04:00
|
|
|
typedef mozilla::dom::MetadataParameters MetadataParameters;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIFile> mFile;
|
|
|
|
nsRefPtr<IDBFileHandle> mFileHandle;
|
2014-09-13 20:12:19 +04:00
|
|
|
|
2014-09-27 03:21:57 +04:00
|
|
|
bool mWholeFile;
|
|
|
|
|
|
|
|
public:
|
2014-09-18 03:36:01 +04:00
|
|
|
// Create as a stored file
|
2014-09-27 03:21:57 +04:00
|
|
|
FileImplSnapshot(const nsAString& aName,
|
|
|
|
const nsAString& aContentType,
|
|
|
|
MetadataParameters* aMetadataParams,
|
|
|
|
nsIFile* aFile,
|
|
|
|
IDBFileHandle* aFileHandle,
|
2014-09-18 03:36:01 +04:00
|
|
|
FileInfo* aFileInfo);
|
2014-09-13 20:12:19 +04:00
|
|
|
|
2014-09-27 03:21:57 +04: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 20:15:22 +04:00
|
|
|
virtual void
|
|
|
|
GetMozFullPathInternal(nsAString& aFullPath, ErrorResult& aRv) MOZ_OVERRIDE;
|
2014-07-17 20:40:54 +04:00
|
|
|
|
|
|
|
virtual nsresult
|
|
|
|
GetInternalStream(nsIInputStream** aStream) MOZ_OVERRIDE;
|
2014-06-26 20:47:44 +04:00
|
|
|
|
2014-07-17 20:40:54 +04:00
|
|
|
virtual void
|
|
|
|
Unlink() MOZ_OVERRIDE;
|
2012-06-03 20:33:52 +04:00
|
|
|
|
2014-07-17 20:40:54 +04:00
|
|
|
virtual void
|
|
|
|
Traverse(nsCycleCollectionTraversalCallback &aCb) MOZ_OVERRIDE;
|
2012-06-03 20:33:52 +04:00
|
|
|
|
2014-07-17 20:40:54 +04:00
|
|
|
virtual bool
|
2014-09-27 03:21:57 +04:00
|
|
|
IsCCed() const MOZ_OVERRIDE;
|
2012-06-03 20:33:52 +04:00
|
|
|
|
2014-10-08 20:15:23 +04:00
|
|
|
virtual already_AddRefed<FileImpl>
|
2014-09-27 03:21:57 +04:00
|
|
|
CreateSlice(uint64_t aStart,
|
|
|
|
uint64_t aLength,
|
2014-10-08 20:15:22 +04:00
|
|
|
const nsAString& aContentType,
|
|
|
|
ErrorResult& aRv) MOZ_OVERRIDE;
|
2012-06-03 20:33:52 +04:00
|
|
|
|
|
|
|
virtual bool
|
2014-09-27 03:21:57 +04:00
|
|
|
IsStoredFile() const MOZ_OVERRIDE;
|
2012-06-03 20:33:52 +04:00
|
|
|
|
|
|
|
virtual bool
|
2014-09-27 03:21:57 +04:00
|
|
|
IsWholeFile() const MOZ_OVERRIDE;
|
2012-06-03 20:33:52 +04:00
|
|
|
|
|
|
|
virtual bool
|
2014-09-27 03:21:57 +04:00
|
|
|
IsSnapshot() const MOZ_OVERRIDE;
|
2012-06-03 20:33:52 +04:00
|
|
|
};
|
|
|
|
|
2014-07-17 20:40:54 +04:00
|
|
|
} // namespace indexedDB
|
2014-05-07 18:32:12 +04:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
2012-06-03 20:33:52 +04:00
|
|
|
|
2014-07-17 20:40:54 +04:00
|
|
|
#endif // mozilla_dom_indexeddb_filesnapshot_h__
|