This source file includes following definitions.
- Init
- CleanUp
- IOThreadPreCleanUp
#include "content/browser/browser_process_sub_thread.h"
#include "base/debug/leak_tracker.h"
#include "base/threading/thread_restrictions.h"
#include "build/build_config.h"
#include "content/browser/browser_child_process_host_impl.h"
#include "content/browser/notification_service_impl.h"
#include "net/url_request/url_fetcher.h"
#include "net/url_request/url_request.h"
#if defined(OS_WIN)
#include "base/win/scoped_com_initializer.h"
#endif
namespace content {
BrowserProcessSubThread::BrowserProcessSubThread(BrowserThread::ID identifier)
: BrowserThreadImpl(identifier) {
}
BrowserProcessSubThread::~BrowserProcessSubThread() {
Stop();
}
void BrowserProcessSubThread::Init() {
#if defined(OS_WIN)
com_initializer_.reset(new base::win::ScopedCOMInitializer());
#endif
notification_service_.reset(new NotificationServiceImpl());
BrowserThreadImpl::Init();
if (BrowserThread::CurrentlyOn(BrowserThread::IO)) {
base::ThreadRestrictions::SetIOAllowed(false);
base::ThreadRestrictions::DisallowWaiting();
}
}
void BrowserProcessSubThread::CleanUp() {
if (BrowserThread::CurrentlyOn(BrowserThread::IO))
IOThreadPreCleanUp();
BrowserThreadImpl::CleanUp();
notification_service_.reset();
#if defined(OS_WIN)
com_initializer_.reset();
#endif
}
void BrowserProcessSubThread::IOThreadPreCleanUp() {
net::URLFetcher::CancelAll();
#if !defined(OS_IOS)
BrowserChildProcessHostImpl::TerminateAll();
#endif
}
}