コード例 #1
0
SharedImage* ImageContainerChild::ImageToSharedImage(Image* aImage)
{
  if (mStop) return nsnull;
  if (mActiveImageCount > MAX_ACTIVE_SHARED_IMAGES) {
    // Too many active shared images, perhaps the compositor is hanging.
    // Skipping current image
    return nsnull;
  }

  NS_ABORT_IF_FALSE(InImageBridgeChildThread(),
                    "Should be in ImageBridgeChild thread.");
  SharedImage* img = PopSharedImageFromPool();
  if (img) {
    CopyDataIntoSharedImage(aImage, img);
  } else {
    img = CreateSharedImageFromData(aImage);
  }
  mImageQueue.AppendElement(aImage);
  return img;
}
コード例 #2
0
SharedImage* ImageContainerChild::ImageToSharedImage(Image* aImage)
{
    if (mStop) {
        return nullptr;
    }
    if (mActiveImageCount > (int)MAX_ACTIVE_SHARED_IMAGES) {
        // Too many active shared images, perhaps the compositor is hanging.
        // Skipping current image
        return nullptr;
    }

    NS_ABORT_IF_FALSE(InImageBridgeChildThread(),
                      "Should be in ImageBridgeChild thread.");
    SharedImage *img = GetSharedImageFor(aImage);
    if (img) {
        CopyDataIntoSharedImage(aImage, img);
    } else {
        img = CreateSharedImageFromData(aImage);
    }
    // Keep a reference to the image we sent to compositor to maintain a
    // correct reference count.
    mImageQueue.AppendElement(aImage);
    return img;
}