ipc/glue/IOThreadChild.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/ipc/glue/IOThreadChild.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,49 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     1.5 + * vim: sw=2 ts=2 et :
     1.6 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#ifndef dom_plugins_IOThreadChild_h
    1.11 +#define dom_plugins_IOThreadChild_h 1
    1.12 +
    1.13 +#include "chrome/common/child_thread.h"
    1.14 +
    1.15 +namespace mozilla {
    1.16 +namespace ipc {
    1.17 +//-----------------------------------------------------------------------------
    1.18 +
    1.19 +// The IOThreadChild class represents a background thread where the
    1.20 +// IPC IO MessageLoop lives.
    1.21 +class IOThreadChild : public ChildThread {
    1.22 +public:
    1.23 +  IOThreadChild()
    1.24 +    : ChildThread(base::Thread::Options(MessageLoop::TYPE_IO,
    1.25 +                                        0)) // stack size
    1.26 +  { }
    1.27 +
    1.28 +  ~IOThreadChild()
    1.29 +  { }
    1.30 +
    1.31 +  static MessageLoop* message_loop() {
    1.32 +    return IOThreadChild::current()->Thread::message_loop();
    1.33 +  }
    1.34 +
    1.35 +  // IOThreadChild owns the returned IPC::Channel.
    1.36 +  static IPC::Channel* channel() {
    1.37 +    return IOThreadChild::current()->ChildThread::channel();
    1.38 +  }
    1.39 +
    1.40 +protected:
    1.41 +  static IOThreadChild* current() {
    1.42 +    return static_cast<IOThreadChild*>(ChildThread::current());
    1.43 +  }
    1.44 +
    1.45 +private:
    1.46 +  DISALLOW_EVIL_CONSTRUCTORS(IOThreadChild);
    1.47 +};
    1.48 +
    1.49 +}  // namespace plugins
    1.50 +}  // namespace mozilla
    1.51 +
    1.52 +#endif  // ifndef dom_plugins_IOThreadChild_h

mercurial