dom/plugins/ipc/StreamNotifyParent.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/plugins/ipc/StreamNotifyParent.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,46 @@
     1.4 +/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
     1.5 +/* vim: set sw=2 ts=2 et : */
     1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#ifndef mozilla_plugins_StreamNotifyParent_h
    1.11 +#define mozilla_plugins_StreamNotifyParent_h
    1.12 +
    1.13 +#include "mozilla/plugins/PStreamNotifyParent.h"
    1.14 +
    1.15 +namespace mozilla {
    1.16 +namespace plugins {
    1.17 +
    1.18 +class StreamNotifyParent : public PStreamNotifyParent
    1.19 +{
    1.20 +  friend class PluginInstanceParent;
    1.21 +
    1.22 +  StreamNotifyParent()
    1.23 +    : mDestructionFlag(nullptr)
    1.24 +  { }
    1.25 +  ~StreamNotifyParent() {
    1.26 +    if (mDestructionFlag)
    1.27 +      *mDestructionFlag = true;
    1.28 +  }
    1.29 +
    1.30 +public:
    1.31 +  // If we are destroyed within the call to NPN_GetURLNotify, notify the caller
    1.32 +  // so that we aren't destroyed again. see bug 536437.
    1.33 +  void SetDestructionFlag(bool* flag) {
    1.34 +    mDestructionFlag = flag;
    1.35 +  }
    1.36 +  void ClearDestructionFlag() {
    1.37 +    mDestructionFlag = nullptr;
    1.38 +  }
    1.39 +
    1.40 +private:
    1.41 +  bool RecvRedirectNotifyResponse(const bool& allow) MOZ_OVERRIDE;
    1.42 +
    1.43 +  bool* mDestructionFlag;
    1.44 +};
    1.45 +
    1.46 +} // namespace plugins
    1.47 +} // namespace mozilla
    1.48 +
    1.49 +#endif

mercurial