layout/ipc/RenderFrameChild.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/ipc/RenderFrameChild.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,51 @@
     1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     1.5 + * vim: sw=2 ts=8 et :
     1.6 + */
     1.7 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.8 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.9 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
    1.10 +
    1.11 +#include "RenderFrameChild.h"
    1.12 +#include "mozilla/layers/LayerTransactionChild.h"
    1.13 +
    1.14 +using mozilla::layers::PLayerTransactionChild;
    1.15 +using mozilla::layers::LayerTransactionChild;
    1.16 +
    1.17 +namespace mozilla {
    1.18 +namespace layout {
    1.19 +
    1.20 +void
    1.21 +RenderFrameChild::Destroy()
    1.22 +{
    1.23 +  size_t numChildren = ManagedPLayerTransactionChild().Length();
    1.24 +  NS_ABORT_IF_FALSE(0 == numChildren || 1 == numChildren,
    1.25 +                    "render frame must only have 0 or 1 layer forwarder");
    1.26 +
    1.27 +  if (numChildren) {
    1.28 +    LayerTransactionChild* layers =
    1.29 +      static_cast<LayerTransactionChild*>(ManagedPLayerTransactionChild()[0]);
    1.30 +    layers->Destroy();
    1.31 +    // |layers| was just deleted, take care
    1.32 +  }
    1.33 +
    1.34 +  Send__delete__(this);
    1.35 +  // WARNING: |this| is dead, hands off
    1.36 +}
    1.37 +
    1.38 +PLayerTransactionChild*
    1.39 +RenderFrameChild::AllocPLayerTransactionChild()
    1.40 +{
    1.41 +  LayerTransactionChild* c = new LayerTransactionChild();
    1.42 +  c->AddIPDLReference();
    1.43 +  return c;
    1.44 +}
    1.45 +
    1.46 +bool
    1.47 +RenderFrameChild::DeallocPLayerTransactionChild(PLayerTransactionChild* aLayers)
    1.48 +{
    1.49 +  static_cast<LayerTransactionChild*>(aLayers)->ReleaseIPDLReference();
    1.50 +  return true;
    1.51 +}
    1.52 +
    1.53 +}  // namespace layout
    1.54 +}  // namespace mozilla

mercurial