Bug 1277705 - Remove child_process_host iter (r=dvander)

This commit is contained in:
Bill McCloskey 2016-06-01 16:37:28 -07:00
Родитель cb8a9c03a3
Коммит ae244aacff
2 изменённых файлов: 0 добавлений и 58 удалений

Просмотреть файл

@ -21,23 +21,15 @@ typedef mozilla::ipc::BrowserProcessSubThread ChromeThread;
using mozilla::ipc::FileDescriptor;
namespace {
typedef std::list<ChildProcessHost*> ChildProcessList;
} // namespace
ChildProcessHost::ChildProcessHost(ProcessType type)
:
ChildProcessInfo(type),
ALLOW_THIS_IN_INITIALIZER_LIST(listener_(this)),
opening_channel_(false) {
Singleton<ChildProcessList>::get()->push_back(this);
}
ChildProcessHost::~ChildProcessHost() {
Singleton<ChildProcessList>::get()->remove(this);
}
bool ChildProcessHost::CreateChannel() {
@ -105,33 +97,3 @@ void ChildProcessHost::ListenerHook::OnChannelError() {
void ChildProcessHost::ListenerHook::GetQueuedMessages(std::queue<IPC::Message>& queue) {
host_->GetQueuedMessages(queue);
}
ChildProcessHost::Iterator::Iterator() : all_(true) {
iterator_ = Singleton<ChildProcessList>::get()->begin();
}
ChildProcessHost::Iterator::Iterator(ProcessType type)
: all_(false), type_(type) {
iterator_ = Singleton<ChildProcessList>::get()->begin();
if (!Done() && (*iterator_)->type() != type_)
++(*this);
}
ChildProcessHost* ChildProcessHost::Iterator::operator++() {
do {
++iterator_;
if (Done())
break;
if (!all_ && (*iterator_)->type() != type_)
continue;
return *iterator_;
} while (true);
return NULL;
}
bool ChildProcessHost::Iterator::Done() {
return iterator_ == Singleton<ChildProcessList>::get()->end();
}

Просмотреть файл

@ -34,26 +34,6 @@ class ChildProcessHost :
// ResourceDispatcherHost::Receiver implementation:
virtual bool Send(IPC::Message* msg);
// The Iterator class allows iteration through either all child processes, or
// ones of a specific type, depending on which constructor is used. Note that
// this should be done from the IO thread and that the iterator should not be
// kept around as it may be invalidated on subsequent event processing in the
// event loop.
class Iterator {
public:
Iterator();
explicit Iterator(ProcessType type);
ChildProcessHost* operator->() { return *iterator_; }
ChildProcessHost* operator*() { return *iterator_; }
ChildProcessHost* operator++();
bool Done();
private:
bool all_;
ProcessType type_;
std::list<ChildProcessHost*>::iterator iterator_;
};
protected:
explicit ChildProcessHost(ProcessType type);