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-07 21:16:11 +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/. */
|
|
|
|
|
2015-05-12 15:11:03 +03:00
|
|
|
#ifndef mozilla_dom_MultipartBlobImpl_h
|
|
|
|
#define mozilla_dom_MultipartBlobImpl_h
|
2014-10-07 21:16:11 +04:00
|
|
|
|
Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
This was done by:
This was done by applying:
```
diff --git a/python/mozbuild/mozbuild/code-analysis/mach_commands.py b/python/mozbuild/mozbuild/code-analysis/mach_commands.py
index 789affde7bbf..fe33c4c7d4d1 100644
--- a/python/mozbuild/mozbuild/code-analysis/mach_commands.py
+++ b/python/mozbuild/mozbuild/code-analysis/mach_commands.py
@@ -2007,7 +2007,7 @@ class StaticAnalysis(MachCommandBase):
from subprocess import Popen, PIPE, check_output, CalledProcessError
diff_process = Popen(self._get_clang_format_diff_command(commit), stdout=PIPE)
- args = [sys.executable, clang_format_diff, "-p1", "-binary=%s" % clang_format]
+ args = [sys.executable, clang_format_diff, "-p1", "-binary=%s" % clang_format, '-sort-includes']
if not output_file:
args.append("-i")
```
Then running `./mach clang-format -c <commit-hash>`
Then undoing that patch.
Then running check_spidermonkey_style.py --fixup
Then running `./mach clang-format`
I had to fix four things:
* I needed to move <utility> back down in GuardObjects.h because I was hitting
obscure problems with our system include wrappers like this:
0:03.94 /usr/include/stdlib.h:550:14: error: exception specification in declaration does not match previous declaration
0:03.94 extern void *realloc (void *__ptr, size_t __size)
0:03.94 ^
0:03.94 /home/emilio/src/moz/gecko-2/obj-debug/dist/include/malloc_decls.h:53:1: note: previous declaration is here
0:03.94 MALLOC_DECL(realloc, void*, void*, size_t)
0:03.94 ^
0:03.94 /home/emilio/src/moz/gecko-2/obj-debug/dist/include/mozilla/mozalloc.h:22:32: note: expanded from macro 'MALLOC_DECL'
0:03.94 MOZ_MEMORY_API return_type name##_impl(__VA_ARGS__);
0:03.94 ^
0:03.94 <scratch space>:178:1: note: expanded from here
0:03.94 realloc_impl
0:03.94 ^
0:03.94 /home/emilio/src/moz/gecko-2/obj-debug/dist/include/mozmemory_wrap.h:142:41: note: expanded from macro 'realloc_impl'
0:03.94 #define realloc_impl mozmem_malloc_impl(realloc)
Which I really didn't feel like digging into.
* I had to restore the order of TrustOverrideUtils.h and related files in nss
because the .inc files depend on TrustOverrideUtils.h being included earlier.
* I had to add a missing include to RollingNumber.h
* Also had to partially restore include order in JsepSessionImpl.cpp to avoid
some -WError issues due to some static inline functions being defined in a
header but not used in the rest of the compilation unit.
Differential Revision: https://phabricator.services.mozilla.com/D60327
--HG--
extra : moz-landing-system : lando
2020-01-20 19:19:48 +03:00
|
|
|
#include <utility>
|
|
|
|
|
2014-10-07 21:16:11 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2014-10-08 20:15:22 +04:00
|
|
|
#include "mozilla/ErrorResult.h"
|
2017-02-16 20:26:38 +03:00
|
|
|
#include "mozilla/dom/BaseBlobImpl.h"
|
2014-10-07 21:16:11 +04:00
|
|
|
|
2016-04-11 21:31:34 +03:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
2014-10-07 21:16:11 +04:00
|
|
|
|
2020-03-05 02:10:22 +03:00
|
|
|
// This is just a sentinel value to be sure that we don't call
|
|
|
|
// SetLengthAndModifiedDate more than once.
|
|
|
|
constexpr int64_t MULTIPARTBLOBIMPL_UNKNOWN_LAST_MODIFIED = INT64_MAX;
|
|
|
|
|
2017-02-16 20:26:38 +03:00
|
|
|
class MultipartBlobImpl final : public BaseBlobImpl {
|
2014-10-07 21:16:11 +04:00
|
|
|
public:
|
2018-02-12 23:44:40 +03:00
|
|
|
NS_INLINE_DECL_REFCOUNTING_INHERITED(MultipartBlobImpl, BaseBlobImpl)
|
2014-10-07 21:16:11 +04:00
|
|
|
|
|
|
|
// Create as a file
|
2015-12-05 00:15:46 +03:00
|
|
|
static already_AddRefed<MultipartBlobImpl> Create(
|
2016-09-21 04:29:28 +03:00
|
|
|
nsTArray<RefPtr<BlobImpl>>&& aBlobImpls, const nsAString& aName,
|
2015-12-05 00:15:46 +03:00
|
|
|
const nsAString& aContentType, ErrorResult& aRv);
|
2014-10-07 21:16:11 +04:00
|
|
|
|
|
|
|
// Create as a blob
|
2015-12-05 00:15:46 +03:00
|
|
|
static already_AddRefed<MultipartBlobImpl> Create(
|
2016-09-21 04:29:28 +03:00
|
|
|
nsTArray<RefPtr<BlobImpl>>&& aBlobImpls, const nsAString& aContentType,
|
2015-12-05 00:15:46 +03:00
|
|
|
ErrorResult& aRv);
|
2014-10-07 21:16:11 +04:00
|
|
|
|
|
|
|
// Create as a file to be later initialized
|
2015-05-12 15:11:03 +03:00
|
|
|
explicit MultipartBlobImpl(const nsAString& aName)
|
2018-12-15 23:40:05 +03:00
|
|
|
: BaseBlobImpl(NS_LITERAL_STRING("MultipartBlobImpl"), aName,
|
2020-03-05 02:10:22 +03:00
|
|
|
EmptyString(), UINT64_MAX,
|
|
|
|
MULTIPARTBLOBIMPL_UNKNOWN_LAST_MODIFIED) {}
|
2014-10-07 21:16:11 +04:00
|
|
|
|
|
|
|
// Create as a blob to be later initialized
|
2015-05-12 15:11:03 +03:00
|
|
|
MultipartBlobImpl()
|
2018-12-15 23:40:05 +03:00
|
|
|
: BaseBlobImpl(NS_LITERAL_STRING("MultipartBlobImpl"), EmptyString(),
|
2020-03-05 02:04:18 +03:00
|
|
|
UINT64_MAX) {}
|
2014-10-07 21:16:11 +04:00
|
|
|
|
2015-12-05 00:15:46 +03:00
|
|
|
void InitializeBlob(ErrorResult& aRv);
|
2014-10-07 21:16:11 +04:00
|
|
|
|
2017-04-25 23:30:23 +03:00
|
|
|
void InitializeBlob(const Sequence<Blob::BlobPart>& aData,
|
2016-06-01 13:33:09 +03:00
|
|
|
const nsAString& aContentType, bool aNativeEOL,
|
|
|
|
ErrorResult& aRv);
|
2014-10-07 21:16:11 +04:00
|
|
|
|
2015-05-12 15:11:03 +03:00
|
|
|
virtual already_AddRefed<BlobImpl> CreateSlice(uint64_t aStart,
|
2014-10-08 20:15:22 +04:00
|
|
|
uint64_t aLength,
|
|
|
|
const nsAString& aContentType,
|
2015-03-21 19:28:04 +03:00
|
|
|
ErrorResult& aRv) override;
|
2014-10-07 21:16:11 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual uint64_t GetSize(ErrorResult& aRv) override { return mLength; }
|
2014-10-07 21:16:11 +04:00
|
|
|
|
2017-10-02 14:53:12 +03:00
|
|
|
virtual void CreateInputStream(nsIInputStream** aInputStream,
|
2015-05-19 17:36:37 +03:00
|
|
|
ErrorResult& aRv) override;
|
2014-10-08 20:15:22 +04:00
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
virtual const nsTArray<RefPtr<BlobImpl>>* GetSubBlobImpls() const override {
|
2015-07-29 01:59:56 +03:00
|
|
|
return mBlobImpls.Length() ? &mBlobImpls : nullptr;
|
2014-10-07 21:16:11 +04:00
|
|
|
}
|
|
|
|
|
2014-10-08 20:15:22 +04:00
|
|
|
void SetName(const nsAString& aName) { mName = aName; }
|
|
|
|
|
2017-09-12 12:46:51 +03:00
|
|
|
size_t GetAllocationSize() const override;
|
2018-06-18 18:35:46 +03:00
|
|
|
size_t GetAllocationSize(
|
|
|
|
FallibleTArray<BlobImpl*>& aVisitedBlobImpls) const override;
|
2017-09-12 12:46:51 +03:00
|
|
|
|
2018-12-15 23:40:05 +03:00
|
|
|
void GetBlobImplType(nsAString& aBlobImplType) const override;
|
|
|
|
|
2020-03-05 02:10:22 +03:00
|
|
|
void SetLastModified(int64_t aLastModified);
|
|
|
|
|
2014-10-07 21:16:11 +04:00
|
|
|
protected:
|
2020-03-05 02:10:22 +03:00
|
|
|
// File constructor.
|
2016-09-21 04:29:28 +03:00
|
|
|
MultipartBlobImpl(nsTArray<RefPtr<BlobImpl>>&& aBlobImpls,
|
2015-12-05 00:15:46 +03:00
|
|
|
const nsAString& aName, const nsAString& aContentType)
|
2018-12-15 23:40:05 +03:00
|
|
|
: BaseBlobImpl(NS_LITERAL_STRING("MultipartBlobImpl"), aName,
|
2020-03-05 02:10:22 +03:00
|
|
|
aContentType, UINT64_MAX,
|
|
|
|
MULTIPARTBLOBIMPL_UNKNOWN_LAST_MODIFIED),
|
2019-04-26 20:53:07 +03:00
|
|
|
mBlobImpls(std::move(aBlobImpls)) {}
|
2015-12-05 00:15:46 +03:00
|
|
|
|
2020-03-05 02:10:22 +03:00
|
|
|
// Blob constructor.
|
2016-09-21 04:29:28 +03:00
|
|
|
MultipartBlobImpl(nsTArray<RefPtr<BlobImpl>>&& aBlobImpls,
|
2015-12-05 00:15:46 +03:00
|
|
|
const nsAString& aContentType)
|
2018-12-15 23:40:05 +03:00
|
|
|
: BaseBlobImpl(NS_LITERAL_STRING("MultipartBlobImpl"), aContentType,
|
2020-03-05 02:04:18 +03:00
|
|
|
UINT64_MAX),
|
2019-04-26 20:53:07 +03:00
|
|
|
mBlobImpls(std::move(aBlobImpls)) {}
|
2015-12-05 00:15:46 +03:00
|
|
|
|
2020-02-20 19:11:24 +03:00
|
|
|
virtual ~MultipartBlobImpl() = default;
|
2014-10-07 21:16:11 +04:00
|
|
|
|
2015-12-05 00:15:46 +03:00
|
|
|
void SetLengthAndModifiedDate(ErrorResult& aRv);
|
2014-10-07 21:16:11 +04:00
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
nsTArray<RefPtr<BlobImpl>> mBlobImpls;
|
2014-10-07 21:16:11 +04:00
|
|
|
};
|
|
|
|
|
2016-04-11 21:31:34 +03:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2015-05-12 15:11:03 +03:00
|
|
|
#endif // mozilla_dom_MultipartBlobImpl_h
|