当前位置: 首页>>代码示例>>C++>>正文


C++ ContentChild::GetOrCreateActorForBlob方法代码示例

本文整理汇总了C++中ContentChild::GetOrCreateActorForBlob方法的典型用法代码示例。如果您正苦于以下问题:C++ ContentChild::GetOrCreateActorForBlob方法的具体用法?C++ ContentChild::GetOrCreateActorForBlob怎么用?C++ ContentChild::GetOrCreateActorForBlob使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ContentChild的用法示例。


在下文中一共展示了ContentChild::GetOrCreateActorForBlob方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

static bool
SendAsyncMessageToParent(void* aCallbackData,
                         const nsAString& aMessage,
                         const StructuredCloneData& aData)
{
  TabChild* tabChild = static_cast<TabChild*>(aCallbackData);
  ContentChild* cc = static_cast<ContentChild*>(tabChild->Manager());
  ClonedMessageData data;
  SerializedStructuredCloneBuffer& buffer = data.data();
  buffer.data = aData.mData;
  buffer.dataLength = aData.mDataLength;

  const nsTArray<nsCOMPtr<nsIDOMBlob> >& blobs = aData.mClosure.mBlobs;
  if (!blobs.IsEmpty()) {
    InfallibleTArray<PBlobChild*>& blobChildList = data.blobsChild();
    PRUint32 length = blobs.Length();
    blobChildList.SetCapacity(length);
    for (PRUint32 i = 0; i < length; ++i) {
      BlobChild* blobChild = cc->GetOrCreateActorForBlob(blobs[i]);
      if (!blobChild) {
        return false;
      }
      blobChildList.AppendElement(blobChild);
    }
  }

  return tabChild->SendAsyncMessage(nsString(aMessage), data);
}
开发者ID:bebef1987,项目名称:mozilla-central,代码行数:28,代码来源:TabChild.cpp

示例2: BluetoothVoidReplyRunnable

already_AddRefed<Promise>
BluetoothMapRequestHandle::ReplyToMessagesListing(long aMasId,
                                                  Blob& aBlob,
                                                  bool aNewMessage,
                                                  const nsAString& aTimestamp,
                                                  int aSize,
                                                  ErrorResult& aRv)
{
  nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(GetParentObject());
  if (!global) {
    aRv.Throw(NS_ERROR_FAILURE);
    return nullptr;
  }

  nsRefPtr<Promise> promise = Promise::Create(global, aRv);
  NS_ENSURE_TRUE(!aRv.Failed(), nullptr);

  BluetoothService* bs = BluetoothService::Get();
  if (!bs) {
    aRv.Throw(NS_ERROR_FAILURE);
    return nullptr;
  }

  if (XRE_GetProcessType() == GeckoProcessType_Default) {
    // In-process reply
    bs->ReplyToMapMessagesListing(aMasId, &aBlob, aNewMessage, aTimestamp,
      aSize, new BluetoothVoidReplyRunnable(nullptr, promise));
  } 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->ReplyToMapMessagesListing(nullptr, actor, aMasId, aNewMessage,
      aTimestamp, aSize, new BluetoothVoidReplyRunnable(nullptr, promise));
  }

  return promise.forget();
}
开发者ID:hansman,项目名称:gecko-dev,代码行数:46,代码来源:BluetoothMapRequestHandle.cpp

示例3: BluetoothVoidReplyRunnable

already_AddRefed<DOMRequest>
BluetoothPbapRequestHandle::ReplyToPhonebookPulling(Blob& aBlob,
                                                    uint16_t phonebookSize,
                                                    ErrorResult& aRv)
{
  nsCOMPtr<nsPIDOMWindow> win = GetParentObject();
  if (!win) {
    aRv.Throw(NS_ERROR_FAILURE);
    return nullptr;
  }

  RefPtr<DOMRequest> request = new DOMRequest(win);
  RefPtr<BluetoothVoidReplyRunnable> result =
    new BluetoothVoidReplyRunnable(request);

  BluetoothService* bs = BluetoothService::Get();
  if (!bs) {
    aRv.Throw(NS_ERROR_FAILURE);
    return nullptr;
  }

  if (XRE_GetProcessType() == GeckoProcessType_Default) {
    // In-process reply
    bs->ReplyToPhonebookPulling(&aBlob, phonebookSize, result);
  } 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->ReplyToPhonebookPulling(nullptr, actor, phonebookSize, result);
  }

  return request.forget();
}
开发者ID:70599,项目名称:Waterfox,代码行数:42,代码来源:BluetoothPbapRequestHandle.cpp

示例4: BluetoothVoidReplyRunnable

already_AddRefed<DOMRequest>
BluetoothAdapter::SendFile(const nsAString& aDeviceAddress,
                           File& aBlob, ErrorResult& aRv)
{
  nsCOMPtr<nsPIDOMWindow> win = GetOwner();
  if (!win) {
    aRv.Throw(NS_ERROR_FAILURE);
    return nullptr;
  }

  nsRefPtr<DOMRequest> request = new DOMRequest(win);
  nsRefPtr<BluetoothVoidReplyRunnable> results =
    new BluetoothVoidReplyRunnable(request);

  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);
  }

  return request.forget();
}
开发者ID:LordJZ,项目名称:gecko-dev,代码行数:41,代码来源:BluetoothAdapter.cpp


注:本文中的ContentChild::GetOrCreateActorForBlob方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。