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/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_dom_indexeddb_idbfilehandle_h__
|
|
|
|
#define mozilla_dom_indexeddb_idbfilehandle_h__
|
|
|
|
|
|
|
|
#include "IndexedDatabase.h"
|
|
|
|
|
|
|
|
#include "mozilla/dom/file/FileHandle.h"
|
|
|
|
#include "mozilla/dom/indexedDB/FileInfo.h"
|
|
|
|
|
|
|
|
BEGIN_INDEXEDDB_NAMESPACE
|
|
|
|
|
2013-07-31 08:48:46 -07:00
|
|
|
class IDBDatabase;
|
|
|
|
|
2014-01-06 18:53:23 -08:00
|
|
|
class IDBFileHandle : public file::FileHandle
|
2012-06-03 09:33:52 -07:00
|
|
|
{
|
2014-02-24 12:56:13 -08:00
|
|
|
typedef mozilla::dom::file::LockedFile LockedFile;
|
|
|
|
|
2012-06-03 09:33:52 -07:00
|
|
|
public:
|
2014-02-24 12:56:13 -08:00
|
|
|
static already_AddRefed<IDBFileHandle>
|
|
|
|
Create(IDBDatabase* aDatabase, const nsAString& aName,
|
|
|
|
const nsAString& aType, already_AddRefed<FileInfo> aFileInfo);
|
2012-06-03 09:33:52 -07:00
|
|
|
|
2014-02-24 12:56:13 -08:00
|
|
|
|
|
|
|
virtual int64_t
|
|
|
|
GetFileId() MOZ_OVERRIDE
|
2012-06-03 09:33:52 -07:00
|
|
|
{
|
|
|
|
return mFileInfo->Id();
|
|
|
|
}
|
|
|
|
|
2014-02-24 12:56:13 -08:00
|
|
|
virtual FileInfo*
|
|
|
|
GetFileInfo() MOZ_OVERRIDE
|
2012-06-03 09:33:52 -07:00
|
|
|
{
|
|
|
|
return mFileInfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual already_AddRefed<nsISupports>
|
2014-02-24 12:56:13 -08:00
|
|
|
CreateStream(nsIFile* aFile, bool aReadOnly) MOZ_OVERRIDE;
|
2012-06-03 09:33:52 -07:00
|
|
|
|
|
|
|
virtual already_AddRefed<nsIDOMFile>
|
2014-02-24 12:56:13 -08:00
|
|
|
CreateFileObject(LockedFile* aLockedFile, uint32_t aFileSize) MOZ_OVERRIDE;
|
|
|
|
|
|
|
|
// nsWrapperCache
|
|
|
|
virtual JSObject*
|
2014-04-08 15:27:18 -07:00
|
|
|
WrapObject(JSContext* aCx) MOZ_OVERRIDE;
|
2012-06-03 09:33:52 -07:00
|
|
|
|
2014-02-24 12:56:13 -08:00
|
|
|
// WebIDL
|
2013-07-31 08:48:46 -07:00
|
|
|
IDBDatabase*
|
|
|
|
Database();
|
2013-07-01 00:02:37 -07:00
|
|
|
|
2012-06-03 09:33:52 -07:00
|
|
|
private:
|
2014-01-06 18:53:23 -08:00
|
|
|
IDBFileHandle(IDBDatabase* aOwner);
|
2012-06-03 09:33:52 -07:00
|
|
|
|
|
|
|
~IDBFileHandle()
|
2014-02-24 12:56:13 -08:00
|
|
|
{
|
|
|
|
}
|
2012-06-03 09:33:52 -07:00
|
|
|
|
|
|
|
nsRefPtr<FileInfo> mFileInfo;
|
|
|
|
};
|
|
|
|
|
|
|
|
END_INDEXEDDB_NAMESPACE
|
|
|
|
|
|
|
|
#endif // mozilla_dom_indexeddb_idbfilehandle_h__
|