diff options
author | jcampan@google.com <jcampan@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-12 01:25:41 +0000 |
---|---|---|
committer | jcampan@google.com <jcampan@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-12 01:25:41 +0000 |
commit | d65cab7ac310ea12c5d946ff40242a243ce911da (patch) | |
tree | fe3eaa4a4e6f14a7416c4b4da351e18cd34d34b2 /chrome/browser | |
parent | 1a48f315b0ca5c26c4446070edfb5842ed06c8c7 (diff) | |
download | chromium_src-d65cab7ac310ea12c5d946ff40242a243ce911da.zip chromium_src-d65cab7ac310ea12c5d946ff40242a243ce911da.tar.gz chromium_src-d65cab7ac310ea12c5d946ff40242a243ce911da.tar.bz2 |
Enabling sync_channel in the browser to allow accessibility code making blocking calls. This replaces my previous CL that was somehow duplicating some of these functionalities.
BUG=None
TEST=Run the unit tests.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@691 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/browser_process.h | 4 | ||||
-rw-r--r-- | chrome/browser/browser_process_impl.cc | 5 | ||||
-rw-r--r-- | chrome/browser/browser_process_impl.h | 6 | ||||
-rw-r--r-- | chrome/browser/browser_shutdown.cc | 4 | ||||
-rw-r--r-- | chrome/browser/render_process_host.cc | 12 | ||||
-rw-r--r-- | chrome/browser/render_process_host.h | 7 |
6 files changed, 32 insertions, 6 deletions
diff --git a/chrome/browser/browser_process.h b/chrome/browser/browser_process.h index 1ca493c..c0eb6d8 100644 --- a/chrome/browser/browser_process.h +++ b/chrome/browser/browser_process.h @@ -53,6 +53,7 @@ class ResourceDispatcherHost; class DebuggerWrapper; class Thread; class WebAppInstallerService; +class SharedEvent; class SuspendController; namespace sandbox { @@ -146,6 +147,9 @@ class BrowserProcess { // TODO(beng): remove once XPFrame/VistaFrame are gone. virtual bool IsUsingNewFrames() = 0; + // Returns an event that is signaled when the browser shutdown. + virtual HANDLE shutdown_event() = 0; + private: DISALLOW_EVIL_CONSTRUCTORS(BrowserProcess); }; diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc index 20e0c37..ad12c305 100644 --- a/chrome/browser/browser_process_impl.cc +++ b/chrome/browser/browser_process_impl.cc @@ -143,6 +143,8 @@ BrowserProcessImpl::BrowserProcessImpl(CommandLine& command_line) } suspend_controller_ = new SuspendController(); + + shutdown_event_ = ::CreateEvent(NULL, TRUE, FALSE, NULL); } BrowserProcessImpl::~BrowserProcessImpl() { @@ -224,6 +226,9 @@ struct RunnableMethodTraits<MessageLoop> { }; void BrowserProcessImpl::EndSession() { + // Notify we are going away. + ::SetEvent(shutdown_event_); + // Mark all the profiles as clean. ProfileManager* pm = profile_manager(); for (ProfileManager::const_iterator i = pm->begin(); i != pm->end(); ++i) diff --git a/chrome/browser/browser_process_impl.h b/chrome/browser/browser_process_impl.h index 3683277..7d12469 100644 --- a/chrome/browser/browser_process_impl.h +++ b/chrome/browser/browser_process_impl.h @@ -43,6 +43,7 @@ #include "base/non_thread_safe.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" +#include "base/shared_event.h" #include "chrome/browser/automation/automation_provider_list.h" #include "chrome/browser/browser_process.h" #include "sandbox/src/sandbox.h" @@ -207,6 +208,8 @@ class BrowserProcessImpl : public BrowserProcess, public NonThreadSafe { return using_new_frames_; } + virtual HANDLE shutdown_event() { return shutdown_event_; } + private: void CreateResourceDispatcherHost(); void CreatePrefService(); @@ -281,6 +284,9 @@ class BrowserProcessImpl : public BrowserProcess, public NonThreadSafe { bool checked_for_new_frames_; bool using_new_frames_; + // An event that notifies when we are shutting-down. + HANDLE shutdown_event_; + DISALLOW_EVIL_CONSTRUCTORS(BrowserProcessImpl); }; diff --git a/chrome/browser/browser_shutdown.cc b/chrome/browser/browser_shutdown.cc index e405453..f710c33 100644 --- a/chrome/browser/browser_shutdown.cc +++ b/chrome/browser/browser_shutdown.cc @@ -32,6 +32,7 @@ #include "base/file_util.h" #include "base/histogram.h" #include "base/path_service.h" +#include "base/shared_event.h" #include "base/string_util.h" #include "base/time.h" #include "chrome/browser/browser_process.h" @@ -106,6 +107,9 @@ void Shutdown() { // consider putting it in BrowserProcessImpl::EndSession. DCHECK(g_browser_process); + // Notifies we are going away. + ::SetEvent(g_browser_process->shutdown_event()); + PluginService* plugin_service = PluginService::GetInstance(); if (plugin_service) { plugin_service->Shutdown(); diff --git a/chrome/browser/render_process_host.cc b/chrome/browser/render_process_host.cc index 4da6cad..be36149 100644 --- a/chrome/browser/render_process_host.cc +++ b/chrome/browser/render_process_host.cc @@ -44,6 +44,7 @@ #include "base/logging.h" #include "base/path_service.h" #include "base/process_util.h" +#include "base/shared_event.h" #include "base/shared_memory.h" #include "base/string_util.h" #include "base/thread.h" @@ -241,9 +242,14 @@ bool RenderProcessHost::Init() { // setup IPC channel std::wstring channel_id = GenerateRandomChannelID(this); channel_.reset( - new IPC::ChannelProxy(channel_id, IPC::Channel::MODE_SERVER, this, - resource_message_filter, - io_thread->message_loop())); + new IPC::SyncChannel(channel_id, IPC::Channel::MODE_SERVER, this, + resource_message_filter, + io_thread->message_loop(), true, + g_browser_process->shutdown_event())); + // As a preventive mesure, we DCHECK if someone sends a synchronous message + // with no time-out, which in the context of the browser process we should not + // be doing. + channel_->set_sync_messages_with_no_timeout_allowed(false); // build command line for renderer, we have to quote the executable name to // deal with spaces diff --git a/chrome/browser/render_process_host.h b/chrome/browser/render_process_host.h index e64b8fe..d29ba07 100644 --- a/chrome/browser/render_process_host.h +++ b/chrome/browser/render_process_host.h @@ -38,8 +38,9 @@ #include "base/object_watcher.h" #include "base/process.h" #include "base/ref_counted.h" +#include "base/scoped_handle.h" #include "base/scoped_ptr.h" -#include "chrome/common/ipc_channel_proxy.h" +#include "chrome/common/ipc_sync_channel.h" #include "chrome/common/notification_service.h" #include "chrome/common/rand_util.h" #include "chrome/common/render_messages.h" @@ -118,7 +119,7 @@ class RenderProcessHost : public IPC::Channel::Listener, void ReportExpectingClose(int32 listener_id); // getters, these may return NULL if there is no connection - IPC::ChannelProxy* channel() { + IPC::SyncChannel* channel() { return channel_.get(); } HANDLE process() { @@ -240,7 +241,7 @@ class RenderProcessHost : public IPC::Channel::Listener, // A proxy for our IPC::Channel that lives on the IO thread (see // browser_process.h) - scoped_ptr<IPC::ChannelProxy> channel_; + scoped_ptr<IPC::SyncChannel> channel_; // Our renderer process. Process process_; |