Wed, 31 Dec 2014 06:55:50 +0100
Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_indexeddb_idbfilehandle_h__
8 #define mozilla_dom_indexeddb_idbfilehandle_h__
10 #include "IndexedDatabase.h"
12 #include "mozilla/dom/file/FileHandle.h"
13 #include "mozilla/dom/indexedDB/FileInfo.h"
15 BEGIN_INDEXEDDB_NAMESPACE
17 class IDBDatabase;
19 class IDBFileHandle : public file::FileHandle
20 {
21 typedef mozilla::dom::file::LockedFile LockedFile;
23 public:
24 static already_AddRefed<IDBFileHandle>
25 Create(IDBDatabase* aDatabase, const nsAString& aName,
26 const nsAString& aType, already_AddRefed<FileInfo> aFileInfo);
29 virtual int64_t
30 GetFileId() MOZ_OVERRIDE
31 {
32 return mFileInfo->Id();
33 }
35 virtual FileInfo*
36 GetFileInfo() MOZ_OVERRIDE
37 {
38 return mFileInfo;
39 }
41 virtual already_AddRefed<nsISupports>
42 CreateStream(nsIFile* aFile, bool aReadOnly) MOZ_OVERRIDE;
44 virtual already_AddRefed<nsIDOMFile>
45 CreateFileObject(LockedFile* aLockedFile, uint32_t aFileSize) MOZ_OVERRIDE;
47 // nsWrapperCache
48 virtual JSObject*
49 WrapObject(JSContext* aCx) MOZ_OVERRIDE;
51 // WebIDL
52 IDBDatabase*
53 Database();
55 private:
56 IDBFileHandle(IDBDatabase* aOwner);
58 ~IDBFileHandle()
59 {
60 }
62 nsRefPtr<FileInfo> mFileInfo;
63 };
65 END_INDEXEDDB_NAMESPACE
67 #endif // mozilla_dom_indexeddb_idbfilehandle_h__