Bug 1331854 - Create the PBlob actor on current thread if doesn't exist yet, r=bkelly

This commit is contained in:
Andrea Marchesini 2017-02-17 15:40:57 +01:00
Родитель d73d9c56df
Коммит 05e9d7e494
1 изменённых файлов: 13 добавлений и 4 удалений

Просмотреть файл

@ -28,6 +28,7 @@
#include "mozilla/dom/IndexedDatabaseManager.h"
#include "mozilla/ipc/InputStreamUtils.h"
#include "mozilla/ipc/IPCStreamUtils.h"
#include "mozilla/ipc/BackgroundChild.h"
#include "mozilla/ipc/PBackgroundChild.h"
#include "mozilla/ipc/PBackgroundParent.h"
#include "mozilla/ipc/PFileDescriptorSetParent.h"
@ -51,10 +52,6 @@
#include "WorkerPrivate.h"
#include "WorkerRunnable.h"
#ifdef DEBUG
#include "BackgroundChild.h" // BackgroundChild::GetForCurrentThread().
#endif
#ifdef OS_POSIX
#include "chrome/common/file_descriptor_set_posix.h"
#endif
@ -2605,6 +2602,18 @@ CreateStreamHelper::GetStream(nsIInputStream** aInputStream)
if (EventTargetIsOnCurrentThread(baseRemoteBlobImpl->GetActorEventTarget())) {
RunInternal(baseRemoteBlobImpl, false);
} else if (PBackgroundChild* manager = mozilla::ipc::BackgroundChild::GetForCurrentThread()) {
BlobChild* blobChild = BlobChild::GetOrCreate(manager, baseRemoteBlobImpl);
MOZ_ASSERT(blobChild);
RefPtr<BlobImpl> blobImpl = blobChild->GetBlobImpl();
MOZ_ASSERT(blobImpl);
ErrorResult rv;
blobImpl->GetInternalStream(aInputStream, rv);
mRemoteBlobImpl = nullptr;
mDone = true;
return rv.StealNSResult();
} else {
nsresult rv = baseRemoteBlobImpl->DispatchToTarget(this);
if (NS_WARN_IF(NS_FAILED(rv))) {