зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1681529 - Part 2: Use an overload set instead of template for RemoteLazyInputStreamParent::Create, r=baku
In a later part of this patch series, this will be necessary to handle cases when BackgroundParentImpl* (or other PBackgroundParent subclasses) are passed to RemoteLazyInputStreamParent::Create, as previously this would've caused an undefined linker symbol error. By using an explicit overload set, we can move the subclass conversion to the caller, and avoid this issue. Differential Revision: https://phabricator.services.mozilla.com/D101801
This commit is contained in:
Родитель
91f9c9c927
Коммит
45950b004a
|
@ -15,9 +15,9 @@ namespace mozilla {
|
|||
template <typename M>
|
||||
/* static */
|
||||
already_AddRefed<RemoteLazyInputStreamParent>
|
||||
RemoteLazyInputStreamParent::Create(nsIInputStream* aInputStream,
|
||||
uint64_t aSize, uint64_t aChildID,
|
||||
nsresult* aRv, M* aManager) {
|
||||
RemoteLazyInputStreamParent::CreateCommon(nsIInputStream* aInputStream,
|
||||
uint64_t aSize, uint64_t aChildID,
|
||||
nsresult* aRv, M* aManager) {
|
||||
MOZ_ASSERT(aInputStream);
|
||||
MOZ_ASSERT(aRv);
|
||||
|
||||
|
@ -59,10 +59,14 @@ RemoteLazyInputStreamParent::Create(const nsID& aID, uint64_t aSize,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
template already_AddRefed<RemoteLazyInputStreamParent>
|
||||
RemoteLazyInputStreamParent::Create<mozilla::ipc::PBackgroundParent>(
|
||||
nsIInputStream*, uint64_t, uint64_t, nsresult*,
|
||||
mozilla::ipc::PBackgroundParent*);
|
||||
/* static */
|
||||
already_AddRefed<RemoteLazyInputStreamParent>
|
||||
RemoteLazyInputStreamParent::Create(nsIInputStream* aInputStream,
|
||||
uint64_t aSize, uint64_t aChildID,
|
||||
nsresult* aRv,
|
||||
mozilla::ipc::PBackgroundParent* aManager) {
|
||||
return CreateCommon(aInputStream, aSize, aChildID, aRv, aManager);
|
||||
}
|
||||
|
||||
/* static */
|
||||
already_AddRefed<RemoteLazyInputStreamParent>
|
||||
|
@ -81,16 +85,27 @@ RemoteLazyInputStreamParent::Create(const nsID& aID, uint64_t aSize,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
/* static */
|
||||
already_AddRefed<RemoteLazyInputStreamParent>
|
||||
RemoteLazyInputStreamParent::Create(
|
||||
nsIInputStream* aInputStream, uint64_t aSize, uint64_t aChildID,
|
||||
nsresult* aRv, mozilla::net::SocketProcessParent* aManager) {
|
||||
return CreateCommon(aInputStream, aSize, aChildID, aRv, aManager);
|
||||
}
|
||||
|
||||
template already_AddRefed<RemoteLazyInputStreamParent>
|
||||
RemoteLazyInputStreamParent::Create<mozilla::net::SocketProcessParent>(
|
||||
RemoteLazyInputStreamParent::CreateCommon<mozilla::net::SocketProcessParent>(
|
||||
nsIInputStream*, uint64_t, uint64_t, nsresult*,
|
||||
mozilla::net::SocketProcessParent*);
|
||||
|
||||
template already_AddRefed<RemoteLazyInputStreamParent>
|
||||
RemoteLazyInputStreamParent::Create<dom::ContentParent>(nsIInputStream*,
|
||||
uint64_t, uint64_t,
|
||||
nsresult*,
|
||||
dom::ContentParent*);
|
||||
/* static */
|
||||
already_AddRefed<RemoteLazyInputStreamParent>
|
||||
RemoteLazyInputStreamParent::Create(nsIInputStream* aInputStream,
|
||||
uint64_t aSize, uint64_t aChildID,
|
||||
nsresult* aRv,
|
||||
mozilla::dom::ContentParent* aManager) {
|
||||
return CreateCommon(aInputStream, aSize, aChildID, aRv, aManager);
|
||||
}
|
||||
|
||||
RemoteLazyInputStreamParent::RemoteLazyInputStreamParent(
|
||||
const nsID& aID, uint64_t aSize, dom::ContentParent* aManager)
|
||||
|
|
|
@ -38,10 +38,17 @@ class RemoteLazyInputStreamParent final : public PRemoteLazyInputStreamParent {
|
|||
// The size of the inputStream must be passed as argument in order to avoid
|
||||
// the use of nsIInputStream::Available() which could open a fileDescriptor in
|
||||
// case the stream is a nsFileStream.
|
||||
template <typename M>
|
||||
static already_AddRefed<RemoteLazyInputStreamParent> Create(
|
||||
nsIInputStream* aInputStream, uint64_t aSize, uint64_t aChildID,
|
||||
nsresult* aRv, M* aManager);
|
||||
nsresult* aRv, mozilla::dom::ContentParent* aManager);
|
||||
|
||||
static already_AddRefed<RemoteLazyInputStreamParent> Create(
|
||||
nsIInputStream* aInputStream, uint64_t aSize, uint64_t aChildID,
|
||||
nsresult* aRv, mozilla::ipc::PBackgroundParent* aManager);
|
||||
|
||||
static already_AddRefed<RemoteLazyInputStreamParent> Create(
|
||||
nsIInputStream* aInputStream, uint64_t aSize, uint64_t aChildID,
|
||||
nsresult* aRv, mozilla::net::SocketProcessParent* aManager);
|
||||
|
||||
static already_AddRefed<RemoteLazyInputStreamParent> Create(
|
||||
const nsID& aID, uint64_t aSize,
|
||||
|
@ -70,6 +77,11 @@ class RemoteLazyInputStreamParent final : public PRemoteLazyInputStreamParent {
|
|||
bool HasValidStream() const;
|
||||
|
||||
private:
|
||||
template <typename M>
|
||||
static already_AddRefed<RemoteLazyInputStreamParent> CreateCommon(
|
||||
nsIInputStream* aInputStream, uint64_t aSize, uint64_t aChildID,
|
||||
nsresult* aRv, M* aManager);
|
||||
|
||||
RemoteLazyInputStreamParent(const nsID& aID, uint64_t aSize,
|
||||
mozilla::dom::ContentParent* aManager);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче