ipc/glue/IOThreadChild.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  * vim: sw=2 ts=2 et :
     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/. */
     7 #ifndef dom_plugins_IOThreadChild_h
     8 #define dom_plugins_IOThreadChild_h 1
    10 #include "chrome/common/child_thread.h"
    12 namespace mozilla {
    13 namespace ipc {
    14 //-----------------------------------------------------------------------------
    16 // The IOThreadChild class represents a background thread where the
    17 // IPC IO MessageLoop lives.
    18 class IOThreadChild : public ChildThread {
    19 public:
    20   IOThreadChild()
    21     : ChildThread(base::Thread::Options(MessageLoop::TYPE_IO,
    22                                         0)) // stack size
    23   { }
    25   ~IOThreadChild()
    26   { }
    28   static MessageLoop* message_loop() {
    29     return IOThreadChild::current()->Thread::message_loop();
    30   }
    32   // IOThreadChild owns the returned IPC::Channel.
    33   static IPC::Channel* channel() {
    34     return IOThreadChild::current()->ChildThread::channel();
    35   }
    37 protected:
    38   static IOThreadChild* current() {
    39     return static_cast<IOThreadChild*>(ChildThread::current());
    40   }
    42 private:
    43   DISALLOW_EVIL_CONSTRUCTORS(IOThreadChild);
    44 };
    46 }  // namespace plugins
    47 }  // namespace mozilla
    49 #endif  // ifndef dom_plugins_IOThreadChild_h

mercurial