コード例 #1
0
bool
TabChild::InitWidget(const nsIntSize& size)
{
    NS_ABORT_IF_FALSE(!mWidget && !mRemoteFrame, "CreateWidget twice?");

    mWidget = nsIWidget::CreatePuppetWidget(this);
    if (!mWidget) {
        NS_ERROR("couldn't create fake widget");
        return false;
    }
    mWidget->Create(
        nullptr, 0,              // no parents
        nsIntRect(nsIntPoint(0, 0), size),
        nullptr,                 // HandleWidgetEvent
        nullptr                  // nsDeviceContext
        );

    LayersBackend be;
    uint64_t id;
    int32_t maxTextureSize;
    RenderFrameChild* remoteFrame =
        static_cast<RenderFrameChild*>(SendPRenderFrameConstructor(
                                           &mScrolling, &be, &maxTextureSize, &id));
    if (!remoteFrame) {
      NS_WARNING("failed to construct RenderFrame");
      return false;
    }

    PLayersChild* shadowManager = nullptr;
    if (id != 0) {
        // Pushing layers transactions directly to a separate
        // compositor context.
        shadowManager =
            CompositorChild::Get()->SendPLayersConstructor(be, id,
                                                           &be,
                                                           &maxTextureSize);
    } else {
        // Pushing transactions to the parent content.
        shadowManager = remoteFrame->SendPLayersConstructor();
    }

    if (!shadowManager) {
      NS_WARNING("failed to construct LayersChild");
      // This results in |remoteFrame| being deleted.
      PRenderFrameChild::Send__delete__(remoteFrame);
      return false;
    }

    ShadowLayerForwarder* lf =
        mWidget->GetLayerManager(shadowManager, be)->AsShadowForwarder();
    NS_ABORT_IF_FALSE(lf && lf->HasShadowManager(),
                      "PuppetWidget should have shadow manager");
    lf->SetParentBackendType(be);
    lf->SetMaxTextureSize(maxTextureSize);

    mRemoteFrame = remoteFrame;
    return true;
}
コード例 #2
0
ファイル: TabChild.cpp プロジェクト: mmmulani/v8monkey
bool
TabChild::InitWidget(const nsIntSize& size)
{
    NS_ABORT_IF_FALSE(!mWidget && !mRemoteFrame, "CreateWidget twice?");

    mWidget = nsIWidget::CreatePuppetWidget(this);
    if (!mWidget) {
        NS_ERROR("couldn't create fake widget");
        return false;
    }
    mWidget->Create(
        nsnull, 0,              // no parents
        nsIntRect(nsIntPoint(0, 0), size),
        nsnull,                 // HandleWidgetEvent
        nsnull                  // nsIDeviceContext
        );

    RenderFrameChild* remoteFrame =
        static_cast<RenderFrameChild*>(SendPRenderFrameConstructor());
    if (!remoteFrame) {
      NS_WARNING("failed to construct RenderFrame");
      return false;
    }

    NS_ABORT_IF_FALSE(0 == remoteFrame->ManagedPLayersChild().Length(),
                      "shouldn't have a shadow manager yet");
    PLayersChild* shadowManager = remoteFrame->SendPLayersConstructor();
    if (!shadowManager) {
      NS_WARNING("failed to construct LayersChild");
      // This results in |remoteFrame| being deleted.
      PRenderFrameChild::Send__delete__(remoteFrame);
      return false;
    }

    LayerManager* lm = mWidget->GetLayerManager();
    NS_ABORT_IF_FALSE(LayerManager::LAYERS_BASIC == lm->GetBackendType(),
                      "content processes should only be using BasicLayers");

    BasicShadowLayerManager* bslm = static_cast<BasicShadowLayerManager*>(lm);
    NS_ABORT_IF_FALSE(!bslm->HasShadowManager(),
                      "PuppetWidget shouldn't have shadow manager yet");
    bslm->SetShadowManager(shadowManager);

    mRemoteFrame = remoteFrame;
    return true;
}
コード例 #3
0
bool
TabChild::InitWidget(const nsIntSize& size)
{
    NS_ABORT_IF_FALSE(!mWidget && !mRemoteFrame, "CreateWidget twice?");

    mWidget = nsIWidget::CreatePuppetWidget(this);
    if (!mWidget) {
        NS_ERROR("couldn't create fake widget");
        return false;
    }
    mWidget->Create(
        nsnull, 0,              // no parents
        nsIntRect(nsIntPoint(0, 0), size),
        nsnull,                 // HandleWidgetEvent
        nsnull                  // nsDeviceContext
    );

    RenderFrameChild* remoteFrame =
        static_cast<RenderFrameChild*>(SendPRenderFrameConstructor());
    if (!remoteFrame) {
        NS_WARNING("failed to construct RenderFrame");
        return false;
    }

    NS_ABORT_IF_FALSE(0 == remoteFrame->ManagedPLayersChild().Length(),
                      "shouldn't have a shadow manager yet");
    LayerManager::LayersBackend be;
    PRInt32 maxTextureSize;
    PLayersChild* shadowManager = remoteFrame->SendPLayersConstructor(&be, &maxTextureSize);
    if (!shadowManager) {
        NS_WARNING("failed to construct LayersChild");
        // This results in |remoteFrame| being deleted.
        PRenderFrameChild::Send__delete__(remoteFrame);
        return false;
    }

    ShadowLayerForwarder* lf =
        mWidget->GetLayerManager(shadowManager, be)->AsShadowForwarder();
    NS_ABORT_IF_FALSE(lf && lf->HasShadowManager(),
                      "PuppetWidget should have shadow manager");
    lf->SetParentBackendType(be);
    lf->SetMaxTextureSize(maxTextureSize);

    mRemoteFrame = remoteFrame;
    return true;
}