Ejemplo n.º 1
0
LayerManager*
PuppetWidget::GetLayerManager(PLayerTransactionChild* aShadowManager,
                              LayersBackend aBackendHint,
                              LayerManagerPersistence aPersistence,
                              bool* aAllowRetaining)
{
  if (!mLayerManager) {
    // The backend hint is a temporary placeholder until Azure, when
    // all content-process layer managers will be BasicLayerManagers.
#if defined(MOZ_ENABLE_D3D10_LAYER)
    if (mozilla::layers::LayersBackend::LAYERS_D3D10 == aBackendHint) {
      nsRefPtr<LayerManagerD3D10> m = new LayerManagerD3D10(this);
      m->AsShadowForwarder()->SetShadowManager(aShadowManager);
      if (m->Initialize()) {
        mLayerManager = m;
      }
    }
#endif
    if (!mLayerManager) {
      mLayerManager = new ClientLayerManager(this);
    }
  }
  ShadowLayerForwarder* lf = mLayerManager->AsShadowForwarder();
  if (!lf->HasShadowManager() && aShadowManager) {
    lf->SetShadowManager(aShadowManager);
  }
  if (aAllowRetaining) {
    *aAllowRetaining = true;
  }
  return mLayerManager;
}
void nsBaseWidget::CreateCompositor()
{
  mCompositorThread = new Thread("CompositorThread");
  mCompositorParent = new CompositorParent(this, mCompositorThread);
  if (mCompositorThread->Start()) {
    LayerManager* lm = CreateBasicLayerManager();
    MessageLoop *childMessageLoop = mCompositorThread->message_loop();
    mCompositorChild = new CompositorChild(lm);
    AsyncChannel *parentChannel = mCompositorParent->GetIPCChannel();
    AsyncChannel::Side childSide = mozilla::ipc::AsyncChannel::Child;
    mCompositorChild->Open(parentChannel, childMessageLoop, childSide);
    PLayersChild* shadowManager =
      mCompositorChild->SendPLayersConstructor(LayerManager::LAYERS_OPENGL);

    if (shadowManager) {
      ShadowLayerForwarder* lf = lm->AsShadowForwarder();
      if (!lf) {
        delete lm;
        mCompositorChild = nsnull;
        return;
      }
      lf->SetShadowManager(shadowManager);
      lf->SetParentBackendType(LayerManager::LAYERS_OPENGL);

      mLayerManager = lm;
    } else {
      NS_WARNING("fail to construct LayersChild");
      delete lm;
      mCompositorChild = nsnull;
    }
  }
}
Ejemplo n.º 3
0
LayerManager*
PuppetWidget::GetLayerManager(PLayerTransactionChild* aShadowManager,
                              LayersBackend aBackendHint,
                              LayerManagerPersistence aPersistence)
{
  if (!mLayerManager) {
    mLayerManager = new ClientLayerManager(this);
  }
  ShadowLayerForwarder* lf = mLayerManager->AsShadowForwarder();
  if (lf && !lf->HasShadowManager() && aShadowManager) {
    lf->SetShadowManager(aShadowManager);
  }
  return mLayerManager;
}
Ejemplo n.º 4
0
void nsBaseWidget::CreateCompositor()
{
  mCompositorThread = new Thread("CompositorThread");
  if (mCompositorThread->Start()) {
    bool renderToEGLSurface = false;
#ifdef MOZ_JAVA_COMPOSITOR
    renderToEGLSurface = true;
#endif
    nsIntRect rect;
    GetBounds(rect);
    mCompositorParent =
      new CompositorParent(this, mCompositorThread->message_loop(), mCompositorThread->thread_id(),
                           renderToEGLSurface, rect.width, rect.height);
    LayerManager* lm = CreateBasicLayerManager();
    MessageLoop *childMessageLoop = mCompositorThread->message_loop();
    mCompositorChild = new CompositorChild(lm);
    AsyncChannel *parentChannel = mCompositorParent->GetIPCChannel();
    AsyncChannel::Side childSide = mozilla::ipc::AsyncChannel::Child;
    mCompositorChild->Open(parentChannel, childMessageLoop, childSide);
    PRInt32 maxTextureSize;
    PLayersChild* shadowManager;
    if (mUseAcceleratedRendering) {
      shadowManager = mCompositorChild->SendPLayersConstructor(LayerManager::LAYERS_OPENGL, &maxTextureSize);
    } else {
      shadowManager = mCompositorChild->SendPLayersConstructor(LayerManager::LAYERS_BASIC, &maxTextureSize);
    }

    if (shadowManager) {
      ShadowLayerForwarder* lf = lm->AsShadowForwarder();
      if (!lf) {
        delete lm;
        mCompositorChild = nsnull;
        return;
      }
      lf->SetShadowManager(shadowManager);
      if (mUseAcceleratedRendering)
        lf->SetParentBackendType(LayerManager::LAYERS_OPENGL);
      else
        lf->SetParentBackendType(LayerManager::LAYERS_BASIC);
      lf->SetMaxTextureSize(maxTextureSize);

      mLayerManager = lm;
    } else {
      // We don't currently want to support not having a LayersChild
      NS_RUNTIMEABORT("failed to construct LayersChild");
      delete lm;
      mCompositorChild = nsnull;
    }
  }
}
void nsBaseWidget::CreateCompositor()
{
  bool renderToEGLSurface = false;
#ifdef MOZ_ANDROID_OMTC
  renderToEGLSurface = true;
#endif
  nsIntRect rect;
  GetBounds(rect);
  mCompositorParent =
    new CompositorParent(this, renderToEGLSurface, rect.width, rect.height);
  LayerManager* lm = CreateBasicLayerManager();
  MessageLoop *childMessageLoop = CompositorParent::CompositorLoop();
  mCompositorChild = new CompositorChild(lm);
  AsyncChannel *parentChannel = mCompositorParent->GetIPCChannel();
  AsyncChannel::Side childSide = mozilla::ipc::AsyncChannel::Child;
  mCompositorChild->Open(parentChannel, childMessageLoop, childSide);
  int32_t maxTextureSize;
  PLayersChild* shadowManager;
  mozilla::layers::LayersBackend backendHint =
    mUseLayersAcceleration ? mozilla::layers::LAYERS_OPENGL : mozilla::layers::LAYERS_BASIC;
  mozilla::layers::LayersBackend parentBackend;
  shadowManager = mCompositorChild->SendPLayersConstructor(
    backendHint, 0, &parentBackend, &maxTextureSize);

  if (shadowManager) {
    ShadowLayerForwarder* lf = lm->AsShadowForwarder();
    if (!lf) {
      delete lm;
      mCompositorChild = nullptr;
      return;
    }
    lf->SetShadowManager(shadowManager);
    lf->SetParentBackendType(parentBackend);
    lf->SetMaxTextureSize(maxTextureSize);

    mLayerManager = lm;
  } else {
    // We don't currently want to support not having a LayersChild
    NS_RUNTIMEABORT("failed to construct LayersChild");
    delete lm;
    mCompositorChild = nullptr;
  }
}
Ejemplo n.º 6
0
void nsBaseWidget::CreateCompositor()
{
  mCompositorThread = new Thread("CompositorThread");
  if (mCompositorThread->Start()) {
    bool renderToEGLSurface = false;
#ifdef MOZ_JAVA_COMPOSITOR
    renderToEGLSurface = true;
#endif
    nsIntRect rect;
    GetBounds(rect);
    mCompositorParent =
      new CompositorParent(this, mCompositorThread->message_loop(), mCompositorThread->thread_id(),
                           renderToEGLSurface, rect.width, rect.height);
    LayerManager* lm = CreateBasicLayerManager();
    MessageLoop *childMessageLoop = mCompositorThread->message_loop();
    mCompositorChild = new CompositorChild(lm);
    AsyncChannel *parentChannel = mCompositorParent->GetIPCChannel();
    AsyncChannel::Side childSide = mozilla::ipc::AsyncChannel::Child;
    mCompositorChild->Open(parentChannel, childMessageLoop, childSide);
    PLayersChild* shadowManager =
      mCompositorChild->SendPLayersConstructor(LayerManager::LAYERS_OPENGL);

    if (shadowManager) {
      ShadowLayerForwarder* lf = lm->AsShadowForwarder();
      if (!lf) {
        delete lm;
        mCompositorChild = nsnull;
        return;
      }
      lf->SetShadowManager(shadowManager);
      lf->SetParentBackendType(LayerManager::LAYERS_OPENGL);

      mLayerManager = lm;
    } else {
      NS_WARNING("fail to construct LayersChild");
      delete lm;
      mCompositorChild = nsnull;
    }
  }
}