mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset c511e6633686 (bug 962310) for causing Bustage on device and B2G ICS Emulator Builds on a CLOSED TREE
This commit is contained in:
parent
c822718a20
commit
b16374075e
@ -739,30 +739,20 @@ BluetoothAdapter::SendFile(const nsAString& aDeviceAddress,
|
||||
nsRefPtr<BluetoothVoidReplyRunnable> results =
|
||||
new BluetoothVoidReplyRunnable(request);
|
||||
|
||||
BlobChild* actor =
|
||||
ContentChild::GetSingleton()->GetOrCreateActorForBlob(aBlob);
|
||||
if (!actor) {
|
||||
BT_WARNING("Can't create actor");
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
if (!bs) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Default) {
|
||||
// In-process transfer
|
||||
bs->SendFile(aDeviceAddress, aBlob, results);
|
||||
} else {
|
||||
ContentChild *cc = ContentChild::GetSingleton();
|
||||
if (!cc) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
BlobChild* actor = cc->GetOrCreateActorForBlob(aBlob);
|
||||
if (!actor) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bs->SendFile(aDeviceAddress, nullptr, actor, results);
|
||||
}
|
||||
bs->SendFile(aDeviceAddress, nullptr, actor, results);
|
||||
|
||||
return request.forget();
|
||||
}
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include "mozilla/dom/ipc/Blob.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsClassHashtable.h"
|
||||
#include "nsIDOMFile.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsIThread.h"
|
||||
#include "nsTObserverArray.h"
|
||||
@ -230,11 +229,6 @@ public:
|
||||
BlobChild* aBlobChild,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
|
||||
virtual void
|
||||
SendFile(const nsAString& aDeviceAddress,
|
||||
nsIDOMBlob* aBlob,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
|
||||
virtual void
|
||||
StopSendingFile(const nsAString& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
|
@ -59,10 +59,11 @@ static bool sInShutdown = false;
|
||||
|
||||
class mozilla::dom::bluetooth::SendFileBatch {
|
||||
public:
|
||||
SendFileBatch(const nsAString& aDeviceAddress, nsIDOMBlob* aBlob)
|
||||
SendFileBatch(const nsAString& aDeviceAddress, BlobParent* aActor)
|
||||
: mDeviceAddress(aDeviceAddress)
|
||||
{
|
||||
mBlobs.AppendElement(aBlob);
|
||||
nsCOMPtr<nsIDOMBlob> blob = aActor->GetBlob();
|
||||
mBlobs.AppendElement(blob);
|
||||
}
|
||||
|
||||
nsString mDeviceAddress;
|
||||
@ -348,18 +349,7 @@ BluetoothOppManager::SendFile(const nsAString& aDeviceAddress,
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
nsCOMPtr<nsIDOMBlob> blob = aActor->GetBlob();
|
||||
|
||||
return SendFile(aDeviceAddress, blob.get());
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothOppManager::SendFile(const nsAString& aDeviceAddress,
|
||||
nsIDOMBlob* aBlob)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
AppendBlobToSend(aDeviceAddress, aBlob);
|
||||
AppendBlobToSend(aDeviceAddress, aActor);
|
||||
if (!mSocket) {
|
||||
ProcessNextBatch();
|
||||
}
|
||||
@ -369,7 +359,7 @@ BluetoothOppManager::SendFile(const nsAString& aDeviceAddress,
|
||||
|
||||
void
|
||||
BluetoothOppManager::AppendBlobToSend(const nsAString& aDeviceAddress,
|
||||
nsIDOMBlob* aBlob)
|
||||
BlobParent* aActor)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
@ -382,10 +372,11 @@ BluetoothOppManager::AppendBlobToSend(const nsAString& aDeviceAddress,
|
||||
*/
|
||||
if (mBatches.IsEmpty() ||
|
||||
aDeviceAddress != mBatches[indexTail].mDeviceAddress) {
|
||||
SendFileBatch batch(aDeviceAddress, aBlob);
|
||||
SendFileBatch batch(aDeviceAddress, aActor);
|
||||
mBatches.AppendElement(batch);
|
||||
} else {
|
||||
mBatches[indexTail].mBlobs.AppendElement(aBlob);
|
||||
nsCOMPtr<nsIDOMBlob> blob = aActor->GetBlob();
|
||||
mBatches[indexTail].mBlobs.AppendElement(blob);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,6 @@ public:
|
||||
bool Listen();
|
||||
|
||||
bool SendFile(const nsAString& aDeviceAddress, BlobParent* aActor);
|
||||
bool SendFile(const nsAString& aDeviceAddress, nsIDOMBlob* aBlob);
|
||||
bool StopSendingFile();
|
||||
bool ConfirmReceivingFile(bool aConfirm);
|
||||
|
||||
@ -96,7 +95,7 @@ private:
|
||||
void NotifyAboutFileChange();
|
||||
bool AcquireSdcardMountLock();
|
||||
void SendObexData(uint8_t* aData, uint8_t aOpcode, int aSize);
|
||||
void AppendBlobToSend(const nsAString& aDeviceAddress, nsIDOMBlob* aBlob);
|
||||
void AppendBlobToSend(const nsAString& aDeviceAddress, BlobParent* aActor);
|
||||
void DiscardBlobsToSend();
|
||||
bool ProcessNextBatch();
|
||||
void ConnectInternal(const nsAString& aDeviceAddress);
|
||||
|
@ -1237,26 +1237,6 @@ BluetoothServiceBluedroid::SendFile(const nsAString& aDeviceAddress,
|
||||
DispatchBluetoothReply(aRunnable, BluetoothValue(true), errorStr);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::SendFile(const nsAString& aDeviceAddress,
|
||||
nsIDOMBlob* aBlob,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
// Currently we only support one device sending one file at a time,
|
||||
// so we don't need aDeviceAddress here because the target device
|
||||
// has been determined when calling 'Connect()'. Nevertheless, keep
|
||||
// it for future use.
|
||||
BluetoothOppManager* opp = BluetoothOppManager::Get();
|
||||
nsAutoString errorStr;
|
||||
if (!opp || !opp->SendFile(aDeviceAddress, aBlob)) {
|
||||
errorStr.AssignLiteral("Calling SendFile() failed");
|
||||
}
|
||||
|
||||
DispatchBluetoothReply(aRunnable, BluetoothValue(true), errorStr);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::StopSendingFile(const nsAString& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
|
@ -100,11 +100,6 @@ public:
|
||||
BlobChild* aBlobChild,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual void
|
||||
SendFile(const nsAString& aDeviceAddress,
|
||||
nsIDOMBlob* aBlob,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual void
|
||||
StopSendingFile(const nsAString& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
@ -59,10 +59,11 @@ static bool sInShutdown = false;
|
||||
|
||||
class mozilla::dom::bluetooth::SendFileBatch {
|
||||
public:
|
||||
SendFileBatch(const nsAString& aDeviceAddress, nsIDOMBlob* aActor)
|
||||
SendFileBatch(const nsAString& aDeviceAddress, BlobParent* aActor)
|
||||
: mDeviceAddress(aDeviceAddress)
|
||||
{
|
||||
mBlobs.AppendElement(aBlob);
|
||||
nsCOMPtr<nsIDOMBlob> blob = aActor->GetBlob();
|
||||
mBlobs.AppendElement(blob);
|
||||
}
|
||||
|
||||
nsString mDeviceAddress;
|
||||
@ -364,18 +365,7 @@ BluetoothOppManager::SendFile(const nsAString& aDeviceAddress,
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
nsCOMPtr<nsIDOMBlob> blob = aActor->GetBlob();
|
||||
|
||||
return SendFile(aDeviceAddress, blob.get());
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothOppManager::SendFile(const nsAString& aDeviceAddress,
|
||||
nsIDOMBlob* aBlob)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
AppendBlobToSend(aDeviceAddress, aBlob);
|
||||
AppendBlobToSend(aDeviceAddress, aActor);
|
||||
if (!mSocket) {
|
||||
ProcessNextBatch();
|
||||
}
|
||||
@ -385,7 +375,7 @@ BluetoothOppManager::SendFile(const nsAString& aDeviceAddress,
|
||||
|
||||
void
|
||||
BluetoothOppManager::AppendBlobToSend(const nsAString& aDeviceAddress,
|
||||
nsIDOMBlob* aBlob)
|
||||
BlobParent* aActor)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
@ -398,10 +388,11 @@ BluetoothOppManager::AppendBlobToSend(const nsAString& aDeviceAddress,
|
||||
*/
|
||||
if (mBatches.IsEmpty() ||
|
||||
aDeviceAddress != mBatches[indexTail].mDeviceAddress) {
|
||||
SendFileBatch batch(aDeviceAddress, aBlob);
|
||||
SendFileBatch batch(aDeviceAddress, aActor);
|
||||
mBatches.AppendElement(batch);
|
||||
} else {
|
||||
mBatches[indexTail].mBlobs.AppendElement(aBlob);
|
||||
nsCOMPtr<nsIDOMBlob> blob = aActor->GetBlob();
|
||||
mBatches[indexTail].mBlobs.AppendElement(blob);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,6 @@ public:
|
||||
bool Listen();
|
||||
|
||||
bool SendFile(const nsAString& aDeviceAddress, BlobParent* aActor);
|
||||
bool SendFile(const nsAString& aDeviceAddress, nsIDOMBlob* aBlob);
|
||||
bool StopSendingFile();
|
||||
bool ConfirmReceivingFile(bool aConfirm);
|
||||
|
||||
@ -96,7 +95,7 @@ private:
|
||||
void NotifyAboutFileChange();
|
||||
bool AcquireSdcardMountLock();
|
||||
void SendObexData(uint8_t* aData, uint8_t aOpcode, int aSize);
|
||||
void AppendBlobToSend(const nsAString& aDeviceAddress, nsIDOMBlob* aBlob);
|
||||
void AppendBlobToSend(const nsAString& aDeviceAddress, BlobParent* aActor);
|
||||
void DiscardBlobsToSend();
|
||||
bool ProcessNextBatch();
|
||||
void ConnectInternal(const nsAString& aDeviceAddress);
|
||||
|
@ -256,16 +256,6 @@ BluetoothServiceChildProcess::SendFile(
|
||||
SendFileRequest(nsString(aDeviceAddress), nullptr, aBlobChild));
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceChildProcess::SendFile(
|
||||
const nsAString& aDeviceAddress,
|
||||
nsIDOMBlob* aBlobChild,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
// Parent-process-only method
|
||||
MOZ_CRASH("This should never be called!");
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceChildProcess::StopSendingFile(
|
||||
const nsAString& aDeviceAddress,
|
||||
|
@ -120,11 +120,6 @@ public:
|
||||
BlobChild* aBlobChild,
|
||||
BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
|
||||
|
||||
virtual void
|
||||
SendFile(const nsAString& aDeviceAddress,
|
||||
nsIDOMBlob* aBlob,
|
||||
BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
|
||||
|
||||
virtual void
|
||||
StopSendingFile(const nsAString& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
|
||||
|
Loading…
Reference in New Issue
Block a user