Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/dom/indexedDB/FileSnapshot.h
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* vim: set ts=8 sts=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_filesnapshot_h__
8
#define mozilla_dom_indexeddb_filesnapshot_h__
9
10
#include "mozilla/Attributes.h"
11
#include "mozilla/dom/File.h"
12
#include "nsISupports.h"
13
#include "nsWeakPtr.h"
14
15
#define FILEIMPLSNAPSHOT_IID \
16
  {0x0dfc11b1, 0x75d3, 0x473b, {0x8c, 0x67, 0xb7, 0x23, 0xf4, 0x67, 0xd6, 0x73}}
17
18
class PIBlobImplSnapshot : public nsISupports
19
{
20
public:
21
  NS_DECLARE_STATIC_IID_ACCESSOR(FILEIMPLSNAPSHOT_IID)
22
23
  virtual mozilla::dom::BlobImpl*
24
  GetBlobImpl() const = 0;
25
};
26
27
NS_DEFINE_STATIC_IID_ACCESSOR(PIBlobImplSnapshot, FILEIMPLSNAPSHOT_IID)
28
29
namespace mozilla {
30
namespace dom {
31
32
class IDBFileHandle;
33
34
namespace indexedDB {
35
36
class BlobImplSnapshot final
37
  : public BlobImpl
38
  , public PIBlobImplSnapshot
39
{
40
  RefPtr<BlobImpl> mBlobImpl;
41
  nsWeakPtr mFileHandle;
42
43
public:
44
  BlobImplSnapshot(BlobImpl* aImpl,
45
                   IDBFileHandle* aFileHandle);
46
47
  NS_DECL_ISUPPORTS_INHERITED
48
49
private:
50
  BlobImplSnapshot(BlobImpl* aImpl,
51
                   nsIWeakReference* aFileHandle);
52
53
  ~BlobImplSnapshot();
54
55
  // BlobImpl
56
  virtual void
57
  GetName(nsAString& aName) const override
58
0
  {
59
0
    mBlobImpl->GetName(aName);
60
0
  }
61
62
  virtual void
63
  GetDOMPath(nsAString& aPath) const override
64
0
  {
65
0
    mBlobImpl->GetDOMPath(aPath);
66
0
  }
67
68
  virtual void
69
  SetDOMPath(const nsAString& aPath) override
70
0
  {
71
0
    mBlobImpl->SetDOMPath(aPath);
72
0
  }
73
74
  virtual int64_t
75
  GetLastModified(ErrorResult& aRv) override
76
0
  {
77
0
    return mBlobImpl->GetLastModified(aRv);
78
0
  }
79
80
  virtual void
81
  SetLastModified(int64_t aLastModified) override
82
0
  {
83
0
    mBlobImpl->SetLastModified(aLastModified);
84
0
  }
85
86
  virtual void
87
  GetMozFullPath(nsAString& aName, SystemCallerGuarantee aGuarantee,
88
                 ErrorResult& aRv) const override
89
0
  {
90
0
    mBlobImpl->GetMozFullPath(aName, aGuarantee, aRv);
91
0
  }
92
93
  virtual void
94
  GetMozFullPathInternal(nsAString& aFileName, ErrorResult& aRv) const override
95
0
  {
96
0
    mBlobImpl->GetMozFullPathInternal(aFileName, aRv);
97
0
  }
98
99
  virtual uint64_t
100
  GetSize(ErrorResult& aRv) override
101
0
  {
102
0
    return mBlobImpl->GetSize(aRv);
103
0
  }
104
105
  virtual void
106
  GetType(nsAString& aType) override
107
0
  {
108
0
    mBlobImpl->GetType(aType);
109
0
  }
110
111
  size_t
112
  GetAllocationSize() const override
113
0
  {
114
0
    return mBlobImpl->GetAllocationSize();
115
0
  }
116
117
  size_t
118
  GetAllocationSize(FallibleTArray<BlobImpl*>& aVisitedBlobs) const override
119
0
  {
120
0
    return mBlobImpl->GetAllocationSize(aVisitedBlobs);
121
0
  }
122
123
  virtual uint64_t
124
  GetSerialNumber() const override
125
0
  {
126
0
    return mBlobImpl->GetSerialNumber();
127
0
  }
128
129
  virtual already_AddRefed<BlobImpl>
130
  CreateSlice(uint64_t aStart,
131
              uint64_t aLength,
132
              const nsAString& aContentType,
133
              ErrorResult& aRv) override;
134
135
  virtual const nsTArray<RefPtr<BlobImpl>>*
136
  GetSubBlobImpls() const override
137
0
  {
138
0
    return mBlobImpl->GetSubBlobImpls();
139
0
  }
140
141
  virtual void
142
  CreateInputStream(nsIInputStream** aStream,
143
                    ErrorResult& aRv) override;
144
145
  virtual int64_t
146
  GetFileId() override
147
0
  {
148
0
    return mBlobImpl->GetFileId();
149
0
  }
150
151
  virtual nsresult
152
  GetSendInfo(nsIInputStream** aBody,
153
              uint64_t* aContentLength,
154
              nsACString& aContentType,
155
              nsACString& aCharset) override
156
0
  {
157
0
    return mBlobImpl->GetSendInfo(aBody,
158
0
                                  aContentLength,
159
0
                                  aContentType,
160
0
                                  aCharset);
161
0
  }
162
163
  virtual nsresult
164
  GetMutable(bool* aMutable) const override
165
0
  {
166
0
    return mBlobImpl->GetMutable(aMutable);
167
0
  }
168
169
  virtual nsresult
170
  SetMutable(bool aMutable) override
171
0
  {
172
0
    return mBlobImpl->SetMutable(aMutable);
173
0
  }
174
175
  virtual void
176
  SetLazyData(const nsAString& aName,
177
              const nsAString& aContentType,
178
              uint64_t aLength,
179
              int64_t aLastModifiedDate) override
180
0
  {
181
0
    MOZ_CRASH("This should never be called!");
182
0
  }
183
184
  virtual bool
185
  IsMemoryFile() const override
186
0
  {
187
0
    return mBlobImpl->IsMemoryFile();
188
0
  }
189
190
  virtual bool
191
  IsSizeUnknown() const override
192
0
  {
193
0
    return mBlobImpl->IsSizeUnknown();
194
0
  }
195
196
  virtual bool
197
  IsDateUnknown() const override
198
0
  {
199
0
    return mBlobImpl->IsDateUnknown();
200
0
  }
201
202
  virtual bool
203
  IsFile() const override
204
0
  {
205
0
    return mBlobImpl->IsFile();
206
0
  }
207
208
  virtual bool
209
  MayBeClonedToOtherThreads() const override
210
0
  {
211
0
    return false;
212
0
  }
213
214
  // PIBlobImplSnapshot
215
  virtual BlobImpl*
216
  GetBlobImpl() const override;
217
};
218
219
} // namespace indexedDB
220
} // namespace dom
221
} // namespace mozilla
222
223
#endif // mozilla_dom_indexeddb_filesnapshot_h__