Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* vim: set ts=2 et sw=2 tw=80: */ |
michael@0 | 3 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #ifndef mozilla_plugins_MiniShmChild_h |
michael@0 | 8 | #define mozilla_plugins_MiniShmChild_h |
michael@0 | 9 | |
michael@0 | 10 | #include "MiniShmBase.h" |
michael@0 | 11 | |
michael@0 | 12 | #include <string> |
michael@0 | 13 | |
michael@0 | 14 | namespace mozilla { |
michael@0 | 15 | namespace plugins { |
michael@0 | 16 | |
michael@0 | 17 | /** |
michael@0 | 18 | * This class provides a lightweight shared memory interface for a child |
michael@0 | 19 | * process in Win32. |
michael@0 | 20 | * This code assumes that there is a parent-child relationship between |
michael@0 | 21 | * processes, as it inherits handles from the parent process. |
michael@0 | 22 | * Note that this class is *not* an IPDL actor. |
michael@0 | 23 | * |
michael@0 | 24 | * @see MiniShmParent |
michael@0 | 25 | */ |
michael@0 | 26 | class MiniShmChild : public MiniShmBase |
michael@0 | 27 | { |
michael@0 | 28 | public: |
michael@0 | 29 | MiniShmChild(); |
michael@0 | 30 | virtual ~MiniShmChild(); |
michael@0 | 31 | |
michael@0 | 32 | /** |
michael@0 | 33 | * Initialize shared memory on the child side. |
michael@0 | 34 | * |
michael@0 | 35 | * @param aObserver A MiniShmObserver object to receive event notifications. |
michael@0 | 36 | * @param aCookie Cookie obtained from MiniShmParent::GetCookie |
michael@0 | 37 | * @param aTimeout Timeout in milliseconds. |
michael@0 | 38 | * @return nsresult error code |
michael@0 | 39 | */ |
michael@0 | 40 | nsresult |
michael@0 | 41 | Init(MiniShmObserver* aObserver, const std::wstring& aCookie, |
michael@0 | 42 | const DWORD aTimeout); |
michael@0 | 43 | |
michael@0 | 44 | virtual nsresult |
michael@0 | 45 | Send() MOZ_OVERRIDE; |
michael@0 | 46 | |
michael@0 | 47 | protected: |
michael@0 | 48 | void |
michael@0 | 49 | OnEvent() MOZ_OVERRIDE; |
michael@0 | 50 | |
michael@0 | 51 | private: |
michael@0 | 52 | HANDLE mParentEvent; |
michael@0 | 53 | HANDLE mParentGuard; |
michael@0 | 54 | HANDLE mChildEvent; |
michael@0 | 55 | HANDLE mChildGuard; |
michael@0 | 56 | HANDLE mFileMapping; |
michael@0 | 57 | HANDLE mRegWait; |
michael@0 | 58 | LPVOID mView; |
michael@0 | 59 | DWORD mTimeout; |
michael@0 | 60 | |
michael@0 | 61 | DISALLOW_COPY_AND_ASSIGN(MiniShmChild); |
michael@0 | 62 | }; |
michael@0 | 63 | |
michael@0 | 64 | } // namespace plugins |
michael@0 | 65 | } // namespace mozilla |
michael@0 | 66 | |
michael@0 | 67 | #endif // mozilla_plugins_MiniShmChild_h |
michael@0 | 68 |