dom/indexedDB/IDBFileHandle.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/indexedDB/IDBFileHandle.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,67 @@
     1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* vim: set ts=2 et sw=2 tw=80: */
     1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     1.8 + * You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#ifndef mozilla_dom_indexeddb_idbfilehandle_h__
    1.11 +#define mozilla_dom_indexeddb_idbfilehandle_h__
    1.12 +
    1.13 +#include "IndexedDatabase.h"
    1.14 +
    1.15 +#include "mozilla/dom/file/FileHandle.h"
    1.16 +#include "mozilla/dom/indexedDB/FileInfo.h"
    1.17 +
    1.18 +BEGIN_INDEXEDDB_NAMESPACE
    1.19 +
    1.20 +class IDBDatabase;
    1.21 +
    1.22 +class IDBFileHandle : public file::FileHandle
    1.23 +{
    1.24 +  typedef mozilla::dom::file::LockedFile LockedFile;
    1.25 +
    1.26 +public:
    1.27 +  static already_AddRefed<IDBFileHandle>
    1.28 +  Create(IDBDatabase* aDatabase, const nsAString& aName,
    1.29 +         const nsAString& aType, already_AddRefed<FileInfo> aFileInfo);
    1.30 +
    1.31 +
    1.32 +  virtual int64_t
    1.33 +  GetFileId() MOZ_OVERRIDE
    1.34 +  {
    1.35 +    return mFileInfo->Id();
    1.36 +  }
    1.37 +
    1.38 +  virtual FileInfo*
    1.39 +  GetFileInfo() MOZ_OVERRIDE
    1.40 +  {
    1.41 +    return mFileInfo;
    1.42 +  }
    1.43 +
    1.44 +  virtual already_AddRefed<nsISupports>
    1.45 +  CreateStream(nsIFile* aFile, bool aReadOnly) MOZ_OVERRIDE;
    1.46 +
    1.47 +  virtual already_AddRefed<nsIDOMFile>
    1.48 +  CreateFileObject(LockedFile* aLockedFile, uint32_t aFileSize) MOZ_OVERRIDE;
    1.49 +
    1.50 +  // nsWrapperCache
    1.51 +  virtual JSObject*
    1.52 +  WrapObject(JSContext* aCx) MOZ_OVERRIDE;
    1.53 +
    1.54 +  // WebIDL
    1.55 +  IDBDatabase*
    1.56 +  Database();
    1.57 +
    1.58 +private:
    1.59 +  IDBFileHandle(IDBDatabase* aOwner);
    1.60 +
    1.61 +  ~IDBFileHandle()
    1.62 +  {
    1.63 +  }
    1.64 +
    1.65 +  nsRefPtr<FileInfo> mFileInfo;
    1.66 +};
    1.67 +
    1.68 +END_INDEXEDDB_NAMESPACE
    1.69 +
    1.70 +#endif // mozilla_dom_indexeddb_idbfilehandle_h__

mercurial