michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim: set ts=2 et sw=2 tw=80: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_plugins_MiniShmChild_h michael@0: #define mozilla_plugins_MiniShmChild_h michael@0: michael@0: #include "MiniShmBase.h" michael@0: michael@0: #include michael@0: michael@0: namespace mozilla { michael@0: namespace plugins { michael@0: michael@0: /** michael@0: * This class provides a lightweight shared memory interface for a child michael@0: * process in Win32. michael@0: * This code assumes that there is a parent-child relationship between michael@0: * processes, as it inherits handles from the parent process. michael@0: * Note that this class is *not* an IPDL actor. michael@0: * michael@0: * @see MiniShmParent michael@0: */ michael@0: class MiniShmChild : public MiniShmBase michael@0: { michael@0: public: michael@0: MiniShmChild(); michael@0: virtual ~MiniShmChild(); michael@0: michael@0: /** michael@0: * Initialize shared memory on the child side. michael@0: * michael@0: * @param aObserver A MiniShmObserver object to receive event notifications. michael@0: * @param aCookie Cookie obtained from MiniShmParent::GetCookie michael@0: * @param aTimeout Timeout in milliseconds. michael@0: * @return nsresult error code michael@0: */ michael@0: nsresult michael@0: Init(MiniShmObserver* aObserver, const std::wstring& aCookie, michael@0: const DWORD aTimeout); michael@0: michael@0: virtual nsresult michael@0: Send() MOZ_OVERRIDE; michael@0: michael@0: protected: michael@0: void michael@0: OnEvent() MOZ_OVERRIDE; michael@0: michael@0: private: michael@0: HANDLE mParentEvent; michael@0: HANDLE mParentGuard; michael@0: HANDLE mChildEvent; michael@0: HANDLE mChildGuard; michael@0: HANDLE mFileMapping; michael@0: HANDLE mRegWait; michael@0: LPVOID mView; michael@0: DWORD mTimeout; michael@0: michael@0: DISALLOW_COPY_AND_ASSIGN(MiniShmChild); michael@0: }; michael@0: michael@0: } // namespace plugins michael@0: } // namespace mozilla michael@0: michael@0: #endif // mozilla_plugins_MiniShmChild_h michael@0: