summaryrefslogtreecommitdiffstats
path: root/chrome/utility
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/utility')
-rw-r--r--chrome/utility/utility_main.cc7
-rw-r--r--chrome/utility/utility_thread.cc13
-rw-r--r--chrome/utility/utility_thread.h5
3 files changed, 19 insertions, 6 deletions
diff --git a/chrome/utility/utility_main.cc b/chrome/utility/utility_main.cc
index bb669a7..ad66043c 100644
--- a/chrome/utility/utility_main.cc
+++ b/chrome/utility/utility_main.cc
@@ -20,16 +20,15 @@
// Mainline routine for running as the utility process.
int UtilityMain(const MainFunctionParams& parameters) {
- // The main message loop of the utility process.
- MessageLoop main_message_loop;
+ // The main thread of the render process.
+ MessageLoopForIO main_message_loop;
std::wstring app_name = chrome::kBrowserAppName;
PlatformThread::SetName(WideToASCII(app_name + L"_UtilityMain").c_str());
// Initialize the SystemMonitor
base::SystemMonitor::Start();
- ChildProcess utility_process;
- utility_process.set_main_thread(new UtilityThread());
+ ChildProcess utility_process(new UtilityThread());
#if defined(OS_WIN)
sandbox::TargetServices* target_services =
parameters.sandbox_info_.TargetServices();
diff --git a/chrome/utility/utility_thread.cc b/chrome/utility/utility_thread.cc
index dc9f965..46815b1 100644
--- a/chrome/utility/utility_thread.cc
+++ b/chrome/utility/utility_thread.cc
@@ -11,13 +11,22 @@
#include "chrome/common/extensions/extension_unpacker.h"
#include "chrome/common/render_messages.h"
-UtilityThread::UtilityThread() {
- ChildProcess::current()->AddRefProcess();
+UtilityThread::UtilityThread() : ChildThread(base::Thread::Options()) {
}
UtilityThread::~UtilityThread() {
}
+void UtilityThread::Init() {
+ ChildThread::Init();
+ ChildProcess::current()->AddRefProcess();
+}
+
+void UtilityThread::CleanUp() {
+ // Shutdown in reverse of the initialization order.
+ ChildThread::CleanUp();
+}
+
void UtilityThread::OnControlMessageReceived(const IPC::Message& msg) {
IPC_BEGIN_MESSAGE_MAP(UtilityThread, msg)
IPC_MESSAGE_HANDLER(UtilityMsg_UnpackExtension, OnUnpackExtension)
diff --git a/chrome/utility/utility_thread.h b/chrome/utility/utility_thread.h
index 4fad53e..1c128ad 100644
--- a/chrome/utility/utility_thread.h
+++ b/chrome/utility/utility_thread.h
@@ -7,6 +7,7 @@
#include <string>
+#include "base/thread.h"
#include "chrome/common/child_thread.h"
class GURL;
@@ -30,6 +31,10 @@ class UtilityThread : public ChildThread {
// IPC messages for web resource service.
void OnUnpackWebResource(const std::string& resource_data);
+ // Called by the thread base class
+ virtual void Init();
+ virtual void CleanUp();
+
DISALLOW_COPY_AND_ASSIGN(UtilityThread);
};