2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2014-10-08 20:15:23 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_dom_BlobSet_h
|
|
|
|
#define mozilla_dom_BlobSet_h
|
|
|
|
|
2016-06-23 12:58:22 +03:00
|
|
|
#include "mozilla/RefPtr.h"
|
2014-10-08 20:15:23 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2016-06-23 12:58:22 +03:00
|
|
|
class BlobImpl;
|
|
|
|
|
|
|
|
class BlobSet final
|
|
|
|
{
|
2014-10-08 20:15:23 +04:00
|
|
|
public:
|
|
|
|
BlobSet()
|
2016-06-23 12:58:22 +03:00
|
|
|
: mData(nullptr)
|
|
|
|
, mDataLen(0)
|
|
|
|
, mDataBufferLen(0)
|
2014-10-08 20:15:23 +04:00
|
|
|
{}
|
|
|
|
|
|
|
|
~BlobSet()
|
|
|
|
{
|
2015-02-19 07:51:06 +03:00
|
|
|
free(mData);
|
2014-10-08 20:15:23 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult AppendVoidPtr(const void* aData, uint32_t aLength);
|
2016-06-23 12:58:22 +03:00
|
|
|
|
|
|
|
nsresult AppendString(const nsAString& aString, bool nativeEOL,
|
|
|
|
JSContext* aCx);
|
|
|
|
|
2015-05-12 15:11:03 +03:00
|
|
|
nsresult AppendBlobImpl(BlobImpl* aBlobImpl);
|
2016-06-23 12:58:22 +03:00
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
nsresult AppendBlobImpls(const nsTArray<RefPtr<BlobImpl>>& aBlobImpls);
|
2014-10-08 20:15:23 +04:00
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
nsTArray<RefPtr<BlobImpl>>& GetBlobImpls() { Flush(); return mBlobImpls; }
|
2014-10-08 20:15:23 +04:00
|
|
|
|
2015-05-12 15:09:51 +03:00
|
|
|
already_AddRefed<Blob> GetBlobInternal(nsISupports* aParent,
|
2015-12-05 00:15:46 +03:00
|
|
|
const nsACString& aContentType,
|
|
|
|
ErrorResult& aRv);
|
2014-10-08 20:15:23 +04:00
|
|
|
|
2016-06-23 12:58:22 +03:00
|
|
|
private:
|
|
|
|
bool ExpandBufferSize(uint64_t aSize);
|
2014-10-08 20:15:23 +04:00
|
|
|
|
2016-06-23 12:58:22 +03:00
|
|
|
void Flush();
|
2014-10-08 20:15:23 +04:00
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
nsTArray<RefPtr<BlobImpl>> mBlobImpls;
|
2014-10-08 20:15:23 +04:00
|
|
|
void* mData;
|
|
|
|
uint64_t mDataLen;
|
|
|
|
uint64_t mDataBufferLen;
|
|
|
|
};
|
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
2014-10-08 20:15:23 +04:00
|
|
|
|
|
|
|
#endif // mozilla_dom_BlobSet_h
|