dom/ipc/PCOMContentPermissionRequestChild.h
author William Chen <wchen@mozilla.com>
Wed, 18 Jul 2012 15:09:28 -0400
changeset 102982 6528e7d3af05ef7ad2354b749b3d0868381107dd
parent 96742 f4157e8c410708d76703f19e4dfb61859bfe32d8
child 161987 b2add7fd1a7412c2c861a923e54414d4d4cc1b05
permissions -rw-r--r--
Bug 773683 - Add runtime assertion to ensure PCOMContentPermissionRequestChild is live while protocol is live. r=jdm

/* 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/. */

#ifndef PCOMContentPermissionRequestChild_h
#define PCOMContentPermissionRequestChild_h

#include "mozilla/dom/PContentPermissionRequestChild.h"
// Microsoft's API Name hackery sucks
#undef CreateEvent

/*
  PContentPermissionRequestChild implementations also are
  XPCOM objects.  Addref() is called on their implementation
  before SendPContentPermissionRequestConstructor is called.
  When Dealloc is called, IPDLRelease() is called.
  Implementations of this method are expected to call
  Release() on themselves.  See Bug 594261 for more
  information.
 */
class PCOMContentPermissionRequestChild : public mozilla::dom::PContentPermissionRequestChild {
public:
  virtual void IPDLRelease() = 0;
#ifdef DEBUG
  PCOMContentPermissionRequestChild() : mIPCOpen(false) {}
  virtual ~PCOMContentPermissionRequestChild() {
    // mIPCOpen is set to true in TabChild::SendPContentPermissionRequestConstructor
    // and set to false in TabChild::DeallocPContentPermissionRequest
    MOZ_ASSERT(!mIPCOpen, "Protocol must not be open when PCOMContentPermissionRequestChild is destroyed.");
  }
  bool mIPCOpen;
#endif /* DEBUG */
};

#endif