ipc/glue/FileDescriptorUtils.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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 mozilla_ipc_FileDescriptorUtils_h
     7 #define mozilla_ipc_FileDescriptorUtils_h
     9 #include "mozilla/Attributes.h"
    10 #include "mozilla/ipc/FileDescriptor.h"
    11 #include "nsIRunnable.h"
    13 namespace mozilla {
    14 namespace ipc {
    16 // When Dispatch() is called (from main thread) this class arranges to close the
    17 // provided FileDescriptor on one of the socket transport service threads (to
    18 // avoid main thread I/O).
    19 class CloseFileRunnable MOZ_FINAL : public nsIRunnable
    20 {
    21   typedef mozilla::ipc::FileDescriptor FileDescriptor;
    23   FileDescriptor mFileDescriptor;
    25 public:
    26   CloseFileRunnable(const FileDescriptor& aFileDescriptor)
    27 #ifdef DEBUG
    28   ;
    29 #else
    30   : mFileDescriptor(aFileDescriptor)
    31   { }
    32 #endif
    34   NS_DECL_THREADSAFE_ISUPPORTS
    35   NS_DECL_NSIRUNNABLE
    37   void Dispatch();
    39 private:
    40   ~CloseFileRunnable();
    42   void CloseFile();
    43 };
    45 } // namespace ipc
    46 } // namespace mozilla
    48 #endif // mozilla_ipc_FileDescriptorUtils_h

mercurial