2010-05-11 08:18:00 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* vim: sw=2 ts=2 et :
|
2012-05-21 15:12:37 +04:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2009-06-30 22:51:05 +04:00
|
|
|
|
2010-05-11 08:18:00 +04:00
|
|
|
#ifndef dom_plugins_IOThreadChild_h
|
|
|
|
#define dom_plugins_IOThreadChild_h 1
|
2009-06-30 22:51:05 +04:00
|
|
|
|
2010-05-11 08:18:00 +04:00
|
|
|
#include "chrome/common/child_thread.h"
|
2009-06-30 22:51:05 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
2010-05-11 08:18:00 +04:00
|
|
|
namespace ipc {
|
2009-06-30 22:51:05 +04:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2010-05-11 08:18:00 +04:00
|
|
|
// The IOThreadChild class represents a background thread where the
|
|
|
|
// IPC IO MessageLoop lives.
|
|
|
|
class IOThreadChild : public ChildThread {
|
2009-06-30 22:51:05 +04:00
|
|
|
public:
|
2010-05-11 08:18:00 +04:00
|
|
|
IOThreadChild()
|
|
|
|
: ChildThread(base::Thread::Options(MessageLoop::TYPE_IO,
|
|
|
|
0)) // stack size
|
|
|
|
{ }
|
2009-06-30 22:51:05 +04:00
|
|
|
|
2010-05-11 08:18:00 +04:00
|
|
|
~IOThreadChild()
|
|
|
|
{ }
|
2010-02-04 01:17:09 +03:00
|
|
|
|
2010-05-11 08:18:00 +04:00
|
|
|
static MessageLoop* message_loop() {
|
|
|
|
return IOThreadChild::current()->Thread::message_loop();
|
|
|
|
}
|
2010-02-25 01:25:16 +03:00
|
|
|
|
2010-05-11 08:18:00 +04:00
|
|
|
// IOThreadChild owns the returned IPC::Channel.
|
|
|
|
static IPC::Channel* channel() {
|
|
|
|
return IOThreadChild::current()->ChildThread::channel();
|
|
|
|
}
|
2010-02-04 01:17:09 +03:00
|
|
|
|
2010-05-11 08:18:00 +04:00
|
|
|
protected:
|
|
|
|
static IOThreadChild* current() {
|
|
|
|
return static_cast<IOThreadChild*>(ChildThread::current());
|
|
|
|
}
|
2009-06-30 22:51:05 +04:00
|
|
|
|
2010-05-11 08:18:00 +04:00
|
|
|
private:
|
|
|
|
DISALLOW_EVIL_CONSTRUCTORS(IOThreadChild);
|
2009-06-30 22:51:05 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace plugins
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2010-05-11 08:18:00 +04:00
|
|
|
#endif // ifndef dom_plugins_IOThreadChild_h
|