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