layout/ipc/RenderFrameChild.cpp

branch
TOR_BUG_9701
changeset 13
44a2da4a2ab2
equal deleted inserted replaced
-1:000000000000 0:a9d8e4a83eee
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * vim: sw=2 ts=8 et :
3 */
4 /* This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7
8 #include "RenderFrameChild.h"
9 #include "mozilla/layers/LayerTransactionChild.h"
10
11 using mozilla::layers::PLayerTransactionChild;
12 using mozilla::layers::LayerTransactionChild;
13
14 namespace mozilla {
15 namespace layout {
16
17 void
18 RenderFrameChild::Destroy()
19 {
20 size_t numChildren = ManagedPLayerTransactionChild().Length();
21 NS_ABORT_IF_FALSE(0 == numChildren || 1 == numChildren,
22 "render frame must only have 0 or 1 layer forwarder");
23
24 if (numChildren) {
25 LayerTransactionChild* layers =
26 static_cast<LayerTransactionChild*>(ManagedPLayerTransactionChild()[0]);
27 layers->Destroy();
28 // |layers| was just deleted, take care
29 }
30
31 Send__delete__(this);
32 // WARNING: |this| is dead, hands off
33 }
34
35 PLayerTransactionChild*
36 RenderFrameChild::AllocPLayerTransactionChild()
37 {
38 LayerTransactionChild* c = new LayerTransactionChild();
39 c->AddIPDLReference();
40 return c;
41 }
42
43 bool
44 RenderFrameChild::DeallocPLayerTransactionChild(PLayerTransactionChild* aLayers)
45 {
46 static_cast<LayerTransactionChild*>(aLayers)->ReleaseIPDLReference();
47 return true;
48 }
49
50 } // namespace layout
51 } // namespace mozilla

mercurial