diff options
author | darin@google.com <darin@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-08 07:56:39 +0000 |
---|---|---|
committer | darin@google.com <darin@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-08 07:56:39 +0000 |
commit | aa2da5a192e30c5e2c7583597e86adac4d11d14b (patch) | |
tree | fa2eb94672c2e161379ff1c357c7dece379587e7 /chrome | |
parent | eb2b2d8b73dfcbe5463f180e97a4fe841ca6e440 (diff) | |
download | chromium_src-aa2da5a192e30c5e2c7583597e86adac4d11d14b.zip chromium_src-aa2da5a192e30c5e2c7583597e86adac4d11d14b.tar.gz chromium_src-aa2da5a192e30c5e2c7583597e86adac4d11d14b.tar.bz2 |
Third times a charm! This is an attempt at re-landing r408. This time the UI test is revised to give the browser a chance to notice a crashed tab.
TBR=nsylvain
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@557 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/metrics_service_uitest.cc | 3 | ||||
-rw-r--r-- | chrome/browser/plugin_process_host.cc | 4 | ||||
-rw-r--r-- | chrome/browser/plugin_process_host.h | 15 | ||||
-rw-r--r-- | chrome/browser/render_process_host.cc | 8 | ||||
-rw-r--r-- | chrome/browser/render_process_host.h | 16 | ||||
-rw-r--r-- | chrome/browser/render_widget_host.cc | 5 |
6 files changed, 28 insertions, 23 deletions
diff --git a/chrome/browser/metrics_service_uitest.cc b/chrome/browser/metrics_service_uitest.cc index 4d75529..f654da0 100644 --- a/chrome/browser/metrics_service_uitest.cc +++ b/chrome/browser/metrics_service_uitest.cc @@ -118,6 +118,9 @@ TEST_F(MetricsServiceTest, CrashRenderers) { ASSERT_NE(0, process_id); process_util::KillProcess(process_id, 0xc0000005, true); // Fake Access Violation. + // Give the browser a chance to notice the crashed tab. + Sleep(1000); + QuitBrowser(); scoped_ptr<PrefService> local_state(GetLocalState()); diff --git a/chrome/browser/plugin_process_host.cc b/chrome/browser/plugin_process_host.cc index 7ee3015..f64af9d 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()) { - MessageLoop::current()->WatchObject(process_.handle(), NULL); + watcher_.StopWatching(); ProcessWatcher::EnsureProcessTerminated(process_.handle()); } } @@ -461,7 +461,7 @@ bool PluginProcessHost::Init(const std::wstring& dll, process_.set_handle(process); } - MessageLoop::current()->WatchObject(process_.handle(), this); + watcher_.StartWatching(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 f4cf06b..e9ea4c5 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/message_loop.h" +#include "base/object_watcher.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 MessageLoop::Watcher { + public base::ObjectWatcher::Delegate { 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); - // MessageLoop watcher callback + // ObjectWatcher::Delegate implementation: virtual void OnObjectSignaled(HANDLE object); // IPC::Channel::Listener implementation: @@ -159,6 +159,9 @@ 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_; @@ -179,4 +182,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 43ebb64..bb048ff 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_) { - MessageLoop::current()->WatchObject(process_.handle(), NULL); + watcher_.StopWatching(); ProcessWatcher::EnsureProcessTerminated(process_.handle()); } @@ -420,7 +420,7 @@ bool RenderProcessHost::Init() { process_.set_handle(process); } - MessageLoop::current()->WatchObject(process_.handle(), this); + watcher_.StartWatching(process_.handle(), this); } } @@ -576,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()); - MessageLoop::current()->WatchObject(process_.handle(), this); + watcher_.StartWatching(process_.handle(), this); } } else { // Need to verify that the peer_pid is actually the process we know, if @@ -591,8 +591,6 @@ 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(); diff --git a/chrome/browser/render_process_host.h b/chrome/browser/render_process_host.h index 117ad55..e64b8fe 100644 --- a/chrome/browser/render_process_host.h +++ b/chrome/browser/render_process_host.h @@ -27,14 +27,15 @@ // (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/message_loop.h" +#include "base/object_watcher.h" #include "base/process.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" @@ -61,8 +62,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 @@ -155,7 +156,7 @@ class RenderProcessHost : public IPC::Channel::Listener, virtual void OnMessageReceived(const IPC::Message& msg); virtual void OnChannelConnected(int32 peer_pid); - // MessageLoop watcher callback + // ObjectWatcher::Delegate virtual void OnObjectSignaled(HANDLE object); // IPC::Channel::Sender callback @@ -244,6 +245,9 @@ 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_; @@ -289,4 +293,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 bee18ca..8c3f2da 100644 --- a/chrome/browser/render_widget_host.cc +++ b/chrome/browser/render_widget_host.cc @@ -29,11 +29,8 @@ #include "chrome/browser/render_widget_host.h" -#include <atlbase.h> -#include <atlapp.h> - #include "base/gfx/bitmap_header.h" -#include "base/histogram.h" +#include "base/message_loop.h" #include "chrome/app/chrome_dll_resource.h" #include "chrome/browser/render_process_host.h" #include "chrome/browser/render_widget_helper.h" |