michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * vim: sw=2 ts=2 et : michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef dom_plugins_IOThreadChild_h michael@0: #define dom_plugins_IOThreadChild_h 1 michael@0: michael@0: #include "chrome/common/child_thread.h" michael@0: michael@0: namespace mozilla { michael@0: namespace ipc { michael@0: //----------------------------------------------------------------------------- michael@0: michael@0: // The IOThreadChild class represents a background thread where the michael@0: // IPC IO MessageLoop lives. michael@0: class IOThreadChild : public ChildThread { michael@0: public: michael@0: IOThreadChild() michael@0: : ChildThread(base::Thread::Options(MessageLoop::TYPE_IO, michael@0: 0)) // stack size michael@0: { } michael@0: michael@0: ~IOThreadChild() michael@0: { } michael@0: michael@0: static MessageLoop* message_loop() { michael@0: return IOThreadChild::current()->Thread::message_loop(); michael@0: } michael@0: michael@0: // IOThreadChild owns the returned IPC::Channel. michael@0: static IPC::Channel* channel() { michael@0: return IOThreadChild::current()->ChildThread::channel(); michael@0: } michael@0: michael@0: protected: michael@0: static IOThreadChild* current() { michael@0: return static_cast(ChildThread::current()); michael@0: } michael@0: michael@0: private: michael@0: DISALLOW_EVIL_CONSTRUCTORS(IOThreadChild); michael@0: }; michael@0: michael@0: } // namespace plugins michael@0: } // namespace mozilla michael@0: michael@0: #endif // ifndef dom_plugins_IOThreadChild_h