gfx/ipc/SharedDIB.h

branch
TOR_BUG_9701
changeset 14
925c144e1f1f
equal deleted inserted replaced
-1:000000000000 0:04f166eddc1a
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 #ifndef gfx_SharedDIB_h__
7 #define gfx_SharedDIB_h__
8
9 #include "base/shared_memory.h"
10 #include "nscore.h"
11
12 namespace mozilla {
13 namespace gfx {
14
15 class SharedDIB
16 {
17 public:
18 typedef base::SharedMemoryHandle Handle;
19
20 public:
21 SharedDIB();
22 ~SharedDIB();
23
24 // Create and allocate a new shared dib.
25 nsresult Create(uint32_t aSize);
26
27 // Destroy or release resources associated with this dib.
28 nsresult Close();
29
30 // Returns true if this object contains a valid dib.
31 bool IsValid();
32
33 // Wrap a new shared dib around allocated shared memory. Note aHandle must point
34 // to a memory section large enough to hold a dib of size aSize, otherwise this
35 // will fail.
36 nsresult Attach(Handle aHandle, uint32_t aSize);
37
38 // Returns a SharedMemoryHandle suitable for sharing with another process.
39 nsresult ShareToProcess(base::ProcessHandle aChildProcess, Handle *aChildHandle);
40
41 protected:
42 base::SharedMemory *mShMem;
43 };
44
45 } // gfx
46 } // mozilla
47
48 #endif

mercurial