|
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/. */ |
|
6 |
|
7 #ifndef mozilla_dom_indexeddb_client_h__ |
|
8 #define mozilla_dom_indexeddb_client_h__ |
|
9 |
|
10 #include "IndexedDatabase.h" |
|
11 |
|
12 #include "mozilla/dom/quota/Client.h" |
|
13 |
|
14 #define JOURNAL_DIRECTORY_NAME "journals" |
|
15 |
|
16 BEGIN_INDEXEDDB_NAMESPACE |
|
17 |
|
18 class Client : public mozilla::dom::quota::Client |
|
19 { |
|
20 typedef mozilla::dom::quota::OriginOrPatternString OriginOrPatternString; |
|
21 typedef mozilla::dom::quota::PersistenceType PersistenceType; |
|
22 typedef mozilla::dom::quota::UsageInfo UsageInfo; |
|
23 |
|
24 public: |
|
25 NS_IMETHOD_(MozExternalRefCountType) |
|
26 AddRef() MOZ_OVERRIDE; |
|
27 |
|
28 NS_IMETHOD_(MozExternalRefCountType) |
|
29 Release() MOZ_OVERRIDE; |
|
30 |
|
31 virtual Type |
|
32 GetType() MOZ_OVERRIDE |
|
33 { |
|
34 return IDB; |
|
35 } |
|
36 |
|
37 virtual nsresult |
|
38 InitOrigin(PersistenceType aPersistenceType, |
|
39 const nsACString& aGroup, |
|
40 const nsACString& aOrigin, |
|
41 UsageInfo* aUsageInfo) MOZ_OVERRIDE; |
|
42 |
|
43 virtual nsresult |
|
44 GetUsageForOrigin(PersistenceType aPersistenceType, |
|
45 const nsACString& aGroup, |
|
46 const nsACString& aOrigin, |
|
47 UsageInfo* aUsageInfo) MOZ_OVERRIDE; |
|
48 |
|
49 virtual void |
|
50 OnOriginClearCompleted(PersistenceType aPersistenceType, |
|
51 const OriginOrPatternString& aOriginOrPattern) |
|
52 MOZ_OVERRIDE; |
|
53 |
|
54 virtual void |
|
55 ReleaseIOThreadObjects() MOZ_OVERRIDE; |
|
56 |
|
57 virtual bool |
|
58 IsFileServiceUtilized() MOZ_OVERRIDE |
|
59 { |
|
60 return true; |
|
61 } |
|
62 |
|
63 virtual bool |
|
64 IsTransactionServiceActivated() MOZ_OVERRIDE; |
|
65 |
|
66 virtual void |
|
67 WaitForStoragesToComplete(nsTArray<nsIOfflineStorage*>& aStorages, |
|
68 nsIRunnable* aCallback) MOZ_OVERRIDE; |
|
69 |
|
70 virtual void |
|
71 AbortTransactionsForStorage(nsIOfflineStorage* aStorage) MOZ_OVERRIDE; |
|
72 |
|
73 virtual bool |
|
74 HasTransactionsForStorage(nsIOfflineStorage* aStorage) MOZ_OVERRIDE; |
|
75 |
|
76 virtual void |
|
77 ShutdownTransactionService() MOZ_OVERRIDE; |
|
78 |
|
79 private: |
|
80 nsresult |
|
81 GetDirectory(PersistenceType aPersistenceType, const nsACString& aOrigin, |
|
82 nsIFile** aDirectory); |
|
83 |
|
84 nsresult |
|
85 GetUsageForDirectoryInternal(nsIFile* aDirectory, |
|
86 UsageInfo* aUsageInfo, |
|
87 bool aDatabaseFiles); |
|
88 |
|
89 nsAutoRefCnt mRefCnt; |
|
90 NS_DECL_OWNINGTHREAD |
|
91 }; |
|
92 |
|
93 END_INDEXEDDB_NAMESPACE |
|
94 |
|
95 #endif // mozilla_dom_indexeddb_client_h__ |