1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/plugins/ipc/hangui/MiniShmChild.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,68 @@ 1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* vim: set ts=2 et sw=2 tw=80: */ 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_MiniShmChild_h 1.11 +#define mozilla_plugins_MiniShmChild_h 1.12 + 1.13 +#include "MiniShmBase.h" 1.14 + 1.15 +#include <string> 1.16 + 1.17 +namespace mozilla { 1.18 +namespace plugins { 1.19 + 1.20 +/** 1.21 + * This class provides a lightweight shared memory interface for a child 1.22 + * process in Win32. 1.23 + * This code assumes that there is a parent-child relationship between 1.24 + * processes, as it inherits handles from the parent process. 1.25 + * Note that this class is *not* an IPDL actor. 1.26 + * 1.27 + * @see MiniShmParent 1.28 + */ 1.29 +class MiniShmChild : public MiniShmBase 1.30 +{ 1.31 +public: 1.32 + MiniShmChild(); 1.33 + virtual ~MiniShmChild(); 1.34 + 1.35 + /** 1.36 + * Initialize shared memory on the child side. 1.37 + * 1.38 + * @param aObserver A MiniShmObserver object to receive event notifications. 1.39 + * @param aCookie Cookie obtained from MiniShmParent::GetCookie 1.40 + * @param aTimeout Timeout in milliseconds. 1.41 + * @return nsresult error code 1.42 + */ 1.43 + nsresult 1.44 + Init(MiniShmObserver* aObserver, const std::wstring& aCookie, 1.45 + const DWORD aTimeout); 1.46 + 1.47 + virtual nsresult 1.48 + Send() MOZ_OVERRIDE; 1.49 + 1.50 +protected: 1.51 + void 1.52 + OnEvent() MOZ_OVERRIDE; 1.53 + 1.54 +private: 1.55 + HANDLE mParentEvent; 1.56 + HANDLE mParentGuard; 1.57 + HANDLE mChildEvent; 1.58 + HANDLE mChildGuard; 1.59 + HANDLE mFileMapping; 1.60 + HANDLE mRegWait; 1.61 + LPVOID mView; 1.62 + DWORD mTimeout; 1.63 + 1.64 + DISALLOW_COPY_AND_ASSIGN(MiniShmChild); 1.65 +}; 1.66 + 1.67 +} // namespace plugins 1.68 +} // namespace mozilla 1.69 + 1.70 +#endif // mozilla_plugins_MiniShmChild_h 1.71 +