gfx/ipc/SharedDIB.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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
    16 {
    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;
    43 };
    45 } // gfx
    46 } // mozilla
    48 #endif

mercurial