summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authordarin@google.com <darin@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-07 07:24:18 +0000
committerdarin@google.com <darin@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-07 07:24:18 +0000
commita346e5d85135c9c5261ad33a20293bf10ca74468 (patch)
treea91d386790b2812936b4b618165b4e411172f095 /chrome/browser
parentb9c3a91b0340151f21e3708b8187f295e6cf8cfd (diff)
downloadchromium_src-a346e5d85135c9c5261ad33a20293bf10ca74468.zip
chromium_src-a346e5d85135c9c5261ad33a20293bf10ca74468.tar.gz
chromium_src-a346e5d85135c9c5261ad33a20293bf10ca74468.tar.bz2
rollback r498 and r500 to repair test bustage
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@503 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/first_run.cc7
-rw-r--r--chrome/browser/plugin_process_host.cc4
-rw-r--r--chrome/browser/plugin_process_host.h15
-rw-r--r--chrome/browser/render_process_host.cc29
-rw-r--r--chrome/browser/render_process_host.h16
-rw-r--r--chrome/browser/render_widget_host.cc5
6 files changed, 35 insertions, 41 deletions
diff --git a/chrome/browser/first_run.cc b/chrome/browser/first_run.cc
index 51720ab..9824462 100644
--- a/chrome/browser/first_run.cc
+++ b/chrome/browser/first_run.cc
@@ -36,6 +36,7 @@
#include "base/file_util.h"
#include "base/logging.h"
+#include "base/object_watcher.h"
#include "base/path_service.h"
#include "base/process_util.h"
#include "base/string_util.h"
@@ -197,7 +198,7 @@ namespace {
// process has ended and what was the result of the operation as reported by
// the process exit code. This class executes in the context of the main chrome
// process.
-class ImportProcessRunner : public MessageLoop::Watcher {
+class ImportProcessRunner : public base::ObjectWatcher::Delegate {
public:
// The constructor takes the importer process to watch and then it does a
// message loop blocking wait until the process ends. This object now owns
@@ -205,7 +206,7 @@ class ImportProcessRunner : public MessageLoop::Watcher {
explicit ImportProcessRunner(ProcessHandle import_process)
: import_process_(import_process),
exit_code_(ResultCodes::NORMAL_EXIT) {
- MessageLoop::current()->WatchObject(import_process, this);
+ watcher_.StartWatching(import_process, this);
MessageLoop::current()->Run();
}
virtual ~ImportProcessRunner() {
@@ -218,7 +219,6 @@ class ImportProcessRunner : public MessageLoop::Watcher {
}
// The child process has terminated. Find the exit code and quit the loop.
virtual void OnObjectSignaled(HANDLE object) {
- MessageLoop::current()->WatchObject(object, NULL);
DCHECK(object == import_process_);
if (!::GetExitCodeProcess(import_process_, &exit_code_)) {
NOTREACHED();
@@ -227,6 +227,7 @@ class ImportProcessRunner : public MessageLoop::Watcher {
}
private:
+ base::ObjectWatcher watcher_;
ProcessHandle import_process_;
DWORD exit_code_;
};
diff --git a/chrome/browser/plugin_process_host.cc b/chrome/browser/plugin_process_host.cc
index f64af9d..7ee3015 100644
--- a/chrome/browser/plugin_process_host.cc
+++ b/chrome/browser/plugin_process_host.cc
@@ -329,7 +329,7 @@ PluginProcessHost::PluginProcessHost(PluginService* plugin_service)
PluginProcessHost::~PluginProcessHost() {
if (process_.handle()) {
- watcher_.StopWatching();
+ MessageLoop::current()->WatchObject(process_.handle(), NULL);
ProcessWatcher::EnsureProcessTerminated(process_.handle());
}
}
@@ -461,7 +461,7 @@ bool PluginProcessHost::Init(const std::wstring& dll,
process_.set_handle(process);
}
- watcher_.StartWatching(process_.handle(), this);
+ MessageLoop::current()->WatchObject(process_.handle(), this);
// Give all plugins "background" priority. See http://b/issue?id=1280317.
process_.SetProcessBackgrounded(true);
diff --git a/chrome/browser/plugin_process_host.h b/chrome/browser/plugin_process_host.h
index e9ea4c5..f4cf06b 100644
--- a/chrome/browser/plugin_process_host.h
+++ b/chrome/browser/plugin_process_host.h
@@ -27,14 +27,14 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#ifndef CHROME_BROWSER_PLUGIN_PROCESS_HOST_H_
-#define CHROME_BROWSER_PLUGIN_PROCESS_HOST_H_
+#ifndef CHROME_BROWSER_PLUGIN_PROCESS_HOST_H__
+#define CHROME_BROWSER_PLUGIN_PROCESS_HOST_H__
#include <vector>
#include "base/basictypes.h"
#include "base/id_map.h"
-#include "base/object_watcher.h"
+#include "base/message_loop.h"
#include "base/process.h"
#include "base/scoped_ptr.h"
#include "base/task.h"
@@ -59,7 +59,7 @@ class GURL;
// the renderer and plugin processes.
class PluginProcessHost : public IPC::Channel::Listener,
public IPC::Message::Sender,
- public base::ObjectWatcher::Delegate {
+ public MessageLoop::Watcher {
public:
PluginProcessHost(PluginService* plugin_service);
~PluginProcessHost();
@@ -75,7 +75,7 @@ class PluginProcessHost : public IPC::Channel::Listener,
// IPC::Message::Sender implementation:
virtual bool Send(IPC::Message* msg);
- // ObjectWatcher::Delegate implementation:
+ // MessageLoop watcher callback
virtual void OnObjectSignaled(HANDLE object);
// IPC::Channel::Listener implementation:
@@ -159,9 +159,6 @@ class PluginProcessHost : public IPC::Channel::Listener,
// The handle to our plugin process.
Process process_;
- // Used to watch the plugin process handle.
- base::ObjectWatcher watcher_;
-
// true while we're waiting the channel to be opened. In the meantime,
// plugin instance requests will be buffered.
bool opening_channel_;
@@ -182,4 +179,4 @@ class PluginProcessHost : public IPC::Channel::Listener,
DISALLOW_EVIL_CONSTRUCTORS(PluginProcessHost);
};
-#endif // CHROME_BROWSER_PLUGIN_PROCESS_HOST_H_
+#endif // CHROME_BROWSER_PLUGIN_PROCESS_HOST_H__
diff --git a/chrome/browser/render_process_host.cc b/chrome/browser/render_process_host.cc
index ccf252a..43ebb64 100644
--- a/chrome/browser/render_process_host.cc
+++ b/chrome/browser/render_process_host.cc
@@ -202,7 +202,7 @@ RenderProcessHost::~RenderProcessHost() {
channel_.reset();
if (process_.handle() && !run_renderer_in_process_) {
- watcher_.StopWatching();
+ MessageLoop::current()->WatchObject(process_.handle(), NULL);
ProcessWatcher::EnsureProcessTerminated(process_.handle());
}
@@ -420,7 +420,7 @@ bool RenderProcessHost::Init() {
process_.set_handle(process);
}
- watcher_.StartWatching(process_.handle(), this);
+ MessageLoop::current()->WatchObject(process_.handle(), this);
}
}
@@ -459,21 +459,16 @@ void RenderProcessHost::Release(int listener_id) {
DCHECK(listeners_.Lookup(listener_id) != NULL);
listeners_.Remove(listener_id);
- // Make sure that all associated resource requests are stopped.
+ // make sure that all associated resource requests are stopped.
widget_helper_->CancelResourceRequests(listener_id);
- // When there are no other owners of this object, we can delete ourselves.
+ // when no other owners of this object, we can delete ourselves
if (listeners_.IsEmpty()) {
if (!notified_termination_) {
- // It is possible that the renderer died already even though we haven't
- // broken the pipe yet. We should take care to count this as unexpected.
- // In unit tests, we do not have a valid process handle.
- bool clean_shutdown = true;
- if (process_.handle())
- clean_shutdown = !process_util::DidProcessCrash(process_.handle());
+ bool close_expected = true;
NotificationService::current()->Notify(NOTIFY_RENDERER_PROCESS_TERMINATED,
Source<RenderProcessHost>(this),
- Details<bool>(&clean_shutdown));
+ Details<bool>(&close_expected));
notified_termination_ = true;
}
Unregister();
@@ -511,8 +506,8 @@ bool RenderProcessHost::FastShutdownIfPossible() {
return false;
}
}
- // Otherwise, call TerminateProcess. Using NORMAL_EXIT here means that UMA
- // won't treat this as a renderer crash.
+ // Otherwise, call TerminateProcess. Using exit code 0 means that UMA won't
+ // treat this as a renderer crash.
::TerminateProcess(proc, ResultCodes::NORMAL_EXIT);
return true;
}
@@ -581,7 +576,7 @@ void RenderProcessHost::OnChannelConnected(int32 peer_pid) {
// returned by CreateProcess() has to the process object.
process_.set_handle(OpenProcess(MAXIMUM_ALLOWED, FALSE, peer_pid));
DCHECK(process_.handle());
- watcher_.StartWatching(process_.handle(), this);
+ MessageLoop::current()->WatchObject(process_.handle(), this);
}
} else {
// Need to verify that the peer_pid is actually the process we know, if
@@ -596,6 +591,8 @@ void RenderProcessHost::OnObjectSignaled(HANDLE object) {
DCHECK(channel_.get());
DCHECK_EQ(object, process_.handle());
+ MessageLoop::current()->WatchObject(object, NULL);
+
bool clean_shutdown = !process_util::DidProcessCrash(object);
process_.Close();
@@ -603,8 +600,8 @@ void RenderProcessHost::OnObjectSignaled(HANDLE object) {
channel_.reset();
if (!notified_termination_) {
- // If |clean_shutdown| is false, it means the renderer process went away
- // before we expected it; count it as a crash.
+ // If |close_expected| is false, it means the renderer process went away
+ // before the web views expected it; count it as a crash.
NotificationService::current()->Notify(NOTIFY_RENDERER_PROCESS_TERMINATED,
Source<RenderProcessHost>(this),
Details<bool>(&clean_shutdown));
diff --git a/chrome/browser/render_process_host.h b/chrome/browser/render_process_host.h
index e64b8fe..117ad55 100644
--- a/chrome/browser/render_process_host.h
+++ b/chrome/browser/render_process_host.h
@@ -27,15 +27,14 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#ifndef CHROME_BROWSER_RENDER_PROCESS_HOST_H_
-#define CHROME_BROWSER_RENDER_PROCESS_HOST_H_
+#ifndef CHROME_BROWSER_RENDER_PROCESS_HOST_H__
+#define CHROME_BROWSER_RENDER_PROCESS_HOST_H__
-#include <set>
#include <vector>
#include <windows.h>
#include "base/id_map.h"
-#include "base/object_watcher.h"
+#include "base/message_loop.h"
#include "base/process.h"
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
@@ -62,8 +61,8 @@ class WebContents;
// are correlated with IDs. This way, the Views and the corresponding ViewHosts
// communicate through the two process objects.
class RenderProcessHost : public IPC::Channel::Listener,
+ public MessageLoop::Watcher,
public IPC::Channel::Sender,
- public base::ObjectWatcher::Delegate,
public NotificationObserver {
public:
// Returns the RenderProcessHost given its ID. Returns NULL if the ID does
@@ -156,7 +155,7 @@ class RenderProcessHost : public IPC::Channel::Listener,
virtual void OnMessageReceived(const IPC::Message& msg);
virtual void OnChannelConnected(int32 peer_pid);
- // ObjectWatcher::Delegate
+ // MessageLoop watcher callback
virtual void OnObjectSignaled(HANDLE object);
// IPC::Channel::Sender callback
@@ -245,9 +244,6 @@ class RenderProcessHost : public IPC::Channel::Listener,
// Our renderer process.
Process process_;
- // Used to watch the renderer process handle.
- base::ObjectWatcher watcher_;
-
// The profile associated with this renderer process.
Profile* profile_;
@@ -293,4 +289,4 @@ inline std::wstring GenerateRandomChannelID(void* instance) {
}
-#endif // CHROME_BROWSER_RENDER_PROCESS_HOST_H_
+#endif // CHROME_BROWSER_RENDER_PROCESS_HOST_H__
diff --git a/chrome/browser/render_widget_host.cc b/chrome/browser/render_widget_host.cc
index 8f48a51..542f903 100644
--- a/chrome/browser/render_widget_host.cc
+++ b/chrome/browser/render_widget_host.cc
@@ -29,8 +29,11 @@
#include "chrome/browser/render_widget_host.h"
+#include <atlbase.h>
+#include <atlapp.h>
+
#include "base/gfx/bitmap_header.h"
-#include "base/message_loop.h"
+#include "base/histogram.h"
#include "chrome/app/chrome_dll_resource.h"
#include "chrome/browser/render_process_host.h"
#include "chrome/browser/render_widget_helper.h"