summaryrefslogtreecommitdiffstats
path: root/chrome/worker
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-27 20:45:59 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-27 20:45:59 +0000
commit51d70e07bd5d991420bc0f14ff05f1a9b72d02db (patch)
tree718c0b24680c1b14eb4570403cc15b8d09b4002d /chrome/worker
parent70ac249f04337f0040ad63a72ced111d87fdc73a (diff)
downloadchromium_src-51d70e07bd5d991420bc0f14ff05f1a9b72d02db.zip
chromium_src-51d70e07bd5d991420bc0f14ff05f1a9b72d02db.tar.gz
chromium_src-51d70e07bd5d991420bc0f14ff05f1a9b72d02db.tar.bz2
Refactor plugin process code which checks with the browser process before shutdown, to avoid races in which the browser process thinks the process is fine to use while it's shutting down. I also removed PluginProcess/WorkerProcess since they didn't have any code in them now.
I removed the plugin process code which waits 10 seconds before shutting itself down. That was a premature optimization, since testing with/without this didn't show any difference (see http://www/~jabdelmalek/chrome/test/plugins/processes.html). In both cases, the plugin on a page would get recreated in less than 100ms, even with reusing or starting a plugin process from scratch. We already spawn new renderer processes on back and forth if it's a different origin, and the plugin will be in the cache anyways. Review URL: http://codereview.chromium.org/53091 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12703 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/worker')
-rw-r--r--chrome/worker/webworkerclient_proxy.cc6
-rw-r--r--chrome/worker/worker.scons3
-rw-r--r--chrome/worker/worker.vcproj8
-rw-r--r--chrome/worker/worker_main.cc5
-rw-r--r--chrome/worker/worker_process.cc14
-rw-r--r--chrome/worker/worker_process.h28
-rw-r--r--chrome/worker/worker_thread.cc1
7 files changed, 6 insertions, 59 deletions
diff --git a/chrome/worker/webworkerclient_proxy.cc b/chrome/worker/webworkerclient_proxy.cc
index 6cc3d9b..33bcbc8 100644
--- a/chrome/worker/webworkerclient_proxy.cc
+++ b/chrome/worker/webworkerclient_proxy.cc
@@ -4,9 +4,9 @@
#include "chrome/worker/webworkerclient_proxy.h"
+#include "chrome/common/child_process.h"
#include "chrome/common/ipc_logging.h"
#include "chrome/common/worker_messages.h"
-#include "chrome/worker/worker_process.h"
#include "chrome/worker/worker_thread.h"
#include "webkit/glue/webworker.h"
@@ -17,12 +17,12 @@ WebWorkerClientProxy::WebWorkerClientProxy(const GURL& url, int route_id)
ALLOW_THIS_IN_INITIALIZER_LIST(impl_(WebWorker::Create(this))) {
AddRef();
WorkerThread::current()->AddRoute(route_id_, this);
- WorkerProcess::current()->AddRefProcess();
+ ChildProcess::current()->AddRefProcess();
}
WebWorkerClientProxy::~WebWorkerClientProxy() {
WorkerThread::current()->RemoveRoute(route_id_);
- WorkerProcess::current()->ReleaseProcess();
+ ChildProcess::current()->ReleaseProcess();
}
void WebWorkerClientProxy::PostMessageToWorkerObject(const string16& message) {
diff --git a/chrome/worker/worker.scons b/chrome/worker/worker.scons
index 6b194c4..fe4aaa2 100644
--- a/chrome/worker/worker.scons
+++ b/chrome/worker/worker.scons
@@ -28,8 +28,6 @@ input_files = ChromeFileList([
'webworkerclient_proxy.cc',
'webworkerclient_proxy.h',
'worker_main.cc',
- 'worker_process.cc',
- 'worker_process.h',
'worker_thread.cc',
'worker_thread.h',
'worker_webkitclient_impl.cc',
@@ -48,7 +46,6 @@ if env.Bit('posix'):
input_files.Remove(
'webworker.cc',
'worker_main.cc',
- 'worker_process.cc',
'worker_thread.cc',
'worker_webkitclient_impl.cc',
)
diff --git a/chrome/worker/worker.vcproj b/chrome/worker/worker.vcproj
index 8adcbab..96d5aa34 100644
--- a/chrome/worker/worker.vcproj
+++ b/chrome/worker/worker.vcproj
@@ -150,14 +150,6 @@
>
</File>
<File
- RelativePath=".\worker_process.cc"
- >
- </File>
- <File
- RelativePath=".\worker_process.h"
- >
- </File>
- <File
RelativePath=".\worker_thread.cc"
>
</File>
diff --git a/chrome/worker/worker_main.cc b/chrome/worker/worker_main.cc
index 1b973c3..ad41a8b 100644
--- a/chrome/worker/worker_main.cc
+++ b/chrome/worker/worker_main.cc
@@ -6,12 +6,13 @@
#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/common/win_util.h"
-#include "chrome/worker/worker_process.h"
+#include "chrome/worker/worker_thread.h"
#if defined(OS_WIN)
#include "chrome/common/sandbox_init_wrapper.h"
@@ -30,7 +31,7 @@ int WorkerMain(const MainFunctionParams& parameters) {
// Initialize the SystemMonitor
base::SystemMonitor::Start();
- WorkerProcess worker_process;
+ ChildProcess worker_process(new WorkerThread());
#if defined(OS_WIN)
sandbox::TargetServices* target_services =
parameters.sandbox_info_.TargetServices();
diff --git a/chrome/worker/worker_process.cc b/chrome/worker/worker_process.cc
deleted file mode 100644
index 4d319e3..0000000
--- a/chrome/worker/worker_process.cc
+++ /dev/null
@@ -1,14 +0,0 @@
-// 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/worker/worker_process.h"
-
-#include "chrome/worker/worker_thread.h"
-
-WorkerProcess::WorkerProcess()
- : ChildProcess(new WorkerThread()) {
-}
-
-WorkerProcess::~WorkerProcess() {
-}
diff --git a/chrome/worker/worker_process.h b/chrome/worker/worker_process.h
deleted file mode 100644
index da76781..0000000
--- a/chrome/worker/worker_process.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// 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_WORKER_WORKER_PROCESS_H_
-#define CHROME_WORKER_WORKER_PROCESS_H_
-
-#include "chrome/common/child_process.h"
-
-// Represents the worker end of the renderer<->worker connection. The
-// opposite end is the WorkerProcessHost. This is a singleton object for
-// each worker process.
-class WorkerProcess : public ChildProcess {
- public:
- WorkerProcess();
- virtual ~WorkerProcess();
-
- // Returns a pointer to the PluginProcess singleton instance.
- static WorkerProcess* current() {
- return static_cast<WorkerProcess*>(ChildProcess::current());
- }
-
- private:
-
- DISALLOW_COPY_AND_ASSIGN(WorkerProcess);
-};
-
-#endif // CHROME_WORKER_WORKER_PROCESS_H_
diff --git a/chrome/worker/worker_thread.cc b/chrome/worker/worker_thread.cc
index 8091dbf..f37904a 100644
--- a/chrome/worker/worker_thread.cc
+++ b/chrome/worker/worker_thread.cc
@@ -6,7 +6,6 @@
#include "chrome/common/worker_messages.h"
#include "chrome/worker/webworkerclient_proxy.h"
-#include "chrome/worker/worker_process.h"
#include "chrome/worker/worker_webkitclient_impl.h"
#include "third_party/WebKit/WebKit/chromium/public/WebKit.h"