tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

RefCountedShmem.h (1320B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set ts=8 sts=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_LAYERS_REFCOUNTED_SHMEM_H
      8 #define MOZILLA_LAYERS_REFCOUNTED_SHMEM_H
      9 
     10 #include "mozilla/ipc/Shmem.h"
     11 #include "chrome/common/ipc_message_utils.h"
     12 
     13 namespace mozilla {
     14 namespace ipc {
     15 class IProtocol;
     16 }
     17 
     18 namespace layers {
     19 
     20 // This class is IPDL-defined
     21 class RefCountedShmem;
     22 
     23 // This just implement the methods externally.
     24 class RefCountedShm {
     25 public:
     26  static uint8_t* GetBytes(const RefCountedShmem& aShm);
     27 
     28  static size_t GetSize(const RefCountedShmem& aShm);
     29 
     30  static bool IsValid(const RefCountedShmem& aShm);
     31 
     32  static bool Alloc(mozilla::ipc::IProtocol* aAllocator, size_t aSize,
     33                    RefCountedShmem& aShm);
     34 
     35  static void Dealloc(mozilla::ipc::IProtocol* aAllocator,
     36                      RefCountedShmem& aShm);
     37 
     38  static int32_t GetReferenceCount(const RefCountedShmem& aShm);
     39 
     40  static int32_t AddRef(const RefCountedShmem& aShm);
     41 
     42  static int32_t Release(const RefCountedShmem& aShm);
     43 };
     44 
     45 }  // namespace layers
     46 }  // namespace mozilla
     47 
     48 #endif