Bumping gaia.json for 2 gaia revision(s) a=gaia-bump
[gecko.git] / dom / indexedDB / FileSnapshot.h
blobc3aa2749dfe71a90dfa35535a78e02e092f8f0b3
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_filesnapshot_h__
8 #define mozilla_dom_indexeddb_filesnapshot_h__
10 #include "mozilla/Attributes.h"
11 #include "nsAutoPtr.h"
12 #include "nsCOMPtr.h"
13 #include "nsCycleCollectionParticipant.h"
14 #include "nsDOMFile.h"
16 namespace mozilla {
17 namespace dom {
18 namespace indexedDB {
20 class IDBFileHandle;
22 class FileImplSnapshot : public DOMFileImplBase
24 public:
25 NS_DECL_ISUPPORTS_INHERITED
27 // Create as a stored file
28 FileImplSnapshot(const nsAString& aName, const nsAString& aContentType,
29 uint64_t aLength, nsIFile* aFile, IDBFileHandle* aFileHandle,
30 FileInfo* aFileInfo);
32 // Overrides
33 virtual nsresult
34 GetMozFullPathInternal(nsAString& aFullPath) MOZ_OVERRIDE;
36 virtual nsresult
37 GetInternalStream(nsIInputStream** aStream) MOZ_OVERRIDE;
39 virtual void
40 Unlink() MOZ_OVERRIDE;
42 virtual void
43 Traverse(nsCycleCollectionTraversalCallback &aCb) MOZ_OVERRIDE;
45 virtual bool
46 IsCCed() const MOZ_OVERRIDE
48 return true;
51 protected:
52 // Create slice
53 FileImplSnapshot(const FileImplSnapshot* aOther, uint64_t aStart,
54 uint64_t aLength, const nsAString& aContentType);
56 virtual ~FileImplSnapshot();
58 virtual already_AddRefed<nsIDOMBlob>
59 CreateSlice(uint64_t aStart, uint64_t aLength,
60 const nsAString& aContentType) MOZ_OVERRIDE;
62 virtual bool
63 IsStoredFile() const MOZ_OVERRIDE
65 return true;
68 virtual bool
69 IsWholeFile() const MOZ_OVERRIDE
71 return mWholeFile;
74 virtual bool
75 IsSnapshot() const MOZ_OVERRIDE
77 return true;
80 private:
81 nsCOMPtr<nsIFile> mFile;
82 nsRefPtr<IDBFileHandle> mFileHandle;
84 bool mWholeFile;
87 } // namespace indexedDB
88 } // namespace dom
89 } // namespace mozilla
91 #endif // mozilla_dom_indexeddb_filesnapshot_h__