Bug 865244 - Implement AudioContext.destination.maxChannelCount. r=ehsan
[gecko.git] / gfx / ipc / SharedDIB.h
blob0d4e0e4b119df3c18fb6df88f66efc278722b1f4
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/. */
6 #ifndef gfx_SharedDIB_h__
7 #define gfx_SharedDIB_h__
9 #include "base/shared_memory.h"
10 #include "nscore.h"
12 namespace mozilla {
13 namespace gfx {
15 class SharedDIB
17 public:
18 typedef base::SharedMemoryHandle Handle;
20 public:
21 SharedDIB();
22 ~SharedDIB();
24 // Create and allocate a new shared dib.
25 nsresult Create(uint32_t aSize);
27 // Destroy or release resources associated with this dib.
28 nsresult Close();
30 // Returns true if this object contains a valid dib.
31 bool IsValid();
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);
38 // Returns a SharedMemoryHandle suitable for sharing with another process.
39 nsresult ShareToProcess(base::ProcessHandle aChildProcess, Handle *aChildHandle);
41 protected:
42 base::SharedMemory *mShMem;
45 } // gfx
46 } // mozilla
48 #endif