2010-08-20 16:24:41 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* vim: sw=2 ts=8 et :
|
|
|
|
*/
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-08-20 16:24:41 -07:00
|
|
|
|
|
|
|
#include "RenderFrameChild.h"
|
2013-04-24 11:42:40 -07:00
|
|
|
#include "mozilla/layers/LayerTransactionChild.h"
|
2010-08-20 16:24:41 -07:00
|
|
|
|
2013-04-24 11:42:40 -07:00
|
|
|
using mozilla::layers::PLayerTransactionChild;
|
|
|
|
using mozilla::layers::LayerTransactionChild;
|
2010-08-20 16:24:41 -07:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace layout {
|
|
|
|
|
|
|
|
void
|
|
|
|
RenderFrameChild::Destroy()
|
|
|
|
{
|
2013-04-24 11:42:40 -07:00
|
|
|
size_t numChildren = ManagedPLayerTransactionChild().Length();
|
2010-08-20 16:24:41 -07:00
|
|
|
NS_ABORT_IF_FALSE(0 == numChildren || 1 == numChildren,
|
|
|
|
"render frame must only have 0 or 1 layer forwarder");
|
|
|
|
|
|
|
|
if (numChildren) {
|
2013-04-24 11:42:40 -07:00
|
|
|
LayerTransactionChild* layers =
|
|
|
|
static_cast<LayerTransactionChild*>(ManagedPLayerTransactionChild()[0]);
|
2010-08-20 16:24:41 -07:00
|
|
|
layers->Destroy();
|
|
|
|
// |layers| was just deleted, take care
|
|
|
|
}
|
|
|
|
|
|
|
|
Send__delete__(this);
|
|
|
|
// WARNING: |this| is dead, hands off
|
|
|
|
}
|
|
|
|
|
2013-04-24 11:42:40 -07:00
|
|
|
PLayerTransactionChild*
|
2013-07-08 08:48:39 -07:00
|
|
|
RenderFrameChild::AllocPLayerTransactionChild()
|
2010-08-20 16:24:41 -07:00
|
|
|
{
|
2013-11-27 07:18:38 -08:00
|
|
|
LayerTransactionChild* c = new LayerTransactionChild();
|
|
|
|
c->AddIPDLReference();
|
2014-05-28 14:42:16 -07:00
|
|
|
// We only create PLayerTransaction objects through PRenderFrame when we don't
|
|
|
|
// have a PCompositor. This means that the child process content will never
|
|
|
|
// get drawn to the screen, but some tests rely on it pretending to function
|
|
|
|
// for now.
|
|
|
|
c->SetHasNoCompositor();
|
2013-11-27 07:18:38 -08:00
|
|
|
return c;
|
2010-08-20 16:24:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2013-07-08 08:48:39 -07:00
|
|
|
RenderFrameChild::DeallocPLayerTransactionChild(PLayerTransactionChild* aLayers)
|
2010-08-20 16:24:41 -07:00
|
|
|
{
|
2013-11-27 07:18:38 -08:00
|
|
|
static_cast<LayerTransactionChild*>(aLayers)->ReleaseIPDLReference();
|
2010-08-20 16:24:41 -07:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace layout
|
|
|
|
} // namespace mozilla
|