diff options
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/app/chrome_dll_main.cc | 9 | ||||
-rw-r--r-- | chrome/chrome.gyp | 13 | ||||
-rw-r--r-- | chrome/common/chrome_switches.cc | 3 | ||||
-rw-r--r-- | chrome/common/chrome_switches.h | 1 | ||||
-rw-r--r-- | chrome/profile_import/profile_import_main.cc | 30 | ||||
-rw-r--r-- | chrome/profile_import/profile_import_thread.cc | 19 | ||||
-rw-r--r-- | chrome/profile_import/profile_import_thread.h | 29 | ||||
-rw-r--r-- | chrome/utility/utility_thread.h | 2 |
8 files changed, 105 insertions, 1 deletions
diff --git a/chrome/app/chrome_dll_main.cc b/chrome/app/chrome_dll_main.cc index 0ec809c..805565d 100644 --- a/chrome/app/chrome_dll_main.cc +++ b/chrome/app/chrome_dll_main.cc @@ -82,6 +82,7 @@ extern int RendererMain(const MainFunctionParams&); extern int PluginMain(const MainFunctionParams&); extern int WorkerMain(const MainFunctionParams&); extern int UtilityMain(const MainFunctionParams&); +extern int ProfileImportMain(const MainFunctionParams&); extern int ZygoteMain(const MainFunctionParams&); #if defined(OS_WIN) @@ -568,6 +569,14 @@ int ChromeMain(int argc, char** argv) { rv = PluginMain(main_params); } else if (process_type == switches::kUtilityProcess) { rv = UtilityMain(main_params); + } else if (process_type == switches::kProfileImportProcess) { +#if defined (OS_MACOSX) + rv = ProfileImportMain(main_params); +#else + // TODO(port): Use OOP profile import - http://crbug.com/22142 . + NOTIMPLEMENTED(); + rv = -1; +#endif } else if (process_type == switches::kWorkerProcess) { rv = WorkerMain(main_params); } else if (process_type == switches::kZygoteProcess) { diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index fe10cdd..e70ced5f 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -17,6 +17,7 @@ 'renderer', 'syncapi', 'utility', + 'profile_import', 'worker', '../printing/printing.gyp:printing', '../webkit/webkit.gyp:inspector_resources', @@ -2988,6 +2989,18 @@ ], }, { + 'target_name': 'profile_import', + 'type': '<(library)', + 'dependencies': [ + '../base/base.gyp:base', + ], + 'sources': [ + 'profile_import/profile_import_main.cc', + 'profile_import/profile_import_thread.cc', + 'profile_import/profile_import_thread.h', + ], + }, + { 'target_name': 'worker', 'type': '<(library)', 'msvs_guid': 'C78D02D0-A366-4EC6-A248-AA8E64C4BA18', diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index 292d3d2..978c7c6 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -74,6 +74,9 @@ const wchar_t kWorkerProcess[] = L"worker"; // Causes the process to run as a utility subprocess. const wchar_t kUtilityProcess[] = L"utility"; +// Causes the process to run as a profile import subprocess. +const wchar_t kProfileImportProcess[] = L"profile-import"; + // Runs the renderer and plugins in the same process as the browser const wchar_t kSingleProcess[] = L"single-process"; diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index 02f6430..733d706 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -31,6 +31,7 @@ extern const wchar_t kBrowserSubprocessPath[]; extern const wchar_t kPluginProcess[]; extern const wchar_t kWorkerProcess[]; extern const wchar_t kUtilityProcess[]; +extern const wchar_t kProfileImportProcess[]; extern const wchar_t kSingleProcess[]; extern const wchar_t kProcessPerTab[]; extern const wchar_t kProcessPerSite[]; diff --git a/chrome/profile_import/profile_import_main.cc b/chrome/profile_import/profile_import_main.cc new file mode 100644 index 0000000..11b1aed --- /dev/null +++ b/chrome/profile_import/profile_import_main.cc @@ -0,0 +1,30 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/command_line.h" +#include "base/message_loop.h" +#include "base/string_util.h" +#include "base/system_monitor.h" +#include "chrome/common/child_process.h" +#include "chrome/common/chrome_constants.h" +#include "chrome/common/chrome_switches.h" +#include "chrome/common/logging_chrome.h" +#include "chrome/common/main_function_params.h" +#include "chrome/profile_import/profile_import_thread.h" + +// Mainline routine for running as the profile import process. +int ProfileImportMain(const MainFunctionParams& parameters) { + // The main message loop of the profile import process. + MessageLoop main_message_loop; + std::wstring app_name = chrome::kBrowserAppName; + PlatformThread::SetName(WideToASCII( + app_name + L"_ProfileImportMain").c_str()); + + ChildProcess profile_import_process; + profile_import_process.set_main_thread(new ProfileImportThread()); + + MessageLoop::current()->Run(); + + return 0; +} diff --git a/chrome/profile_import/profile_import_thread.cc b/chrome/profile_import/profile_import_thread.cc new file mode 100644 index 0000000..6a0211f7 --- /dev/null +++ b/chrome/profile_import/profile_import_thread.cc @@ -0,0 +1,19 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/profile_import/profile_import_thread.h" + +#include "chrome/common/child_process.h" + +ProfileImportThread::ProfileImportThread() { + ChildProcess::current()->AddRefProcess(); +} + +ProfileImportThread::~ProfileImportThread() { +} + +void ProfileImportThread::OnControlMessageReceived(const IPC::Message& msg) { + ChildProcess::current()->ReleaseProcess(); + NOTIMPLEMENTED(); +} diff --git a/chrome/profile_import/profile_import_thread.h b/chrome/profile_import/profile_import_thread.h new file mode 100644 index 0000000..ea2c4b8 --- /dev/null +++ b/chrome/profile_import/profile_import_thread.h @@ -0,0 +1,29 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_PROFILE_IMPORT_PROFILE_IMPORT_THREAD_H_ +#define CHROME_PROFILE_IMPORT_PROFILE_IMPORT_THREAD_H_ + +#include "chrome/common/child_thread.h" + +// This class represents the background thread where the profile import task +// runs. +class ProfileImportThread : public ChildThread { + public: + ProfileImportThread(); + virtual ~ProfileImportThread(); + + // Returns the one profile import thread. + static ProfileImportThread* current() { + return static_cast<ProfileImportThread*>(ChildThread::current()); + } + + private: + // IPC messages + virtual void OnControlMessageReceived(const IPC::Message& msg); + + DISALLOW_COPY_AND_ASSIGN(ProfileImportThread); +}; + +#endif // CHROME_PROFILE_IMPORT_PROFILE_IMPORT_THREAD_H_ diff --git a/chrome/utility/utility_thread.h b/chrome/utility/utility_thread.h index b5e2ae2..180f53d 100644 --- a/chrome/utility/utility_thread.h +++ b/chrome/utility/utility_thread.h @@ -15,7 +15,7 @@ class GURL; class UtilityThread : public ChildThread { public: UtilityThread(); - ~UtilityThread(); + virtual ~UtilityThread(); // Returns the one utility thread. static UtilityThread* current() { |