summaryrefslogtreecommitdiffstats
path: root/content/browser/renderer_host
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-13 05:21:17 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-13 05:21:17 +0000
commit3cb054e682096bb5596ca0403d7fed2548c83f2c (patch)
tree9b4ab6b05693db127ef8c51baf7e951551f9e1b8 /content/browser/renderer_host
parent394184966eb9ce9a18d019cca3d308ec7e18f78d (diff)
downloadchromium_src-3cb054e682096bb5596ca0403d7fed2548c83f2c.zip
chromium_src-3cb054e682096bb5596ca0403d7fed2548c83f2c.tar.gz
chromium_src-3cb054e682096bb5596ca0403d7fed2548c83f2c.tar.bz2
Remove g_browser_process dependency from content. Also make all the SyncChannels in the browser process ChannelProxy instead, since no code in the browser should send synchronous IPC messages. The renderer one was done like that a long time ago to send sync IPCs for accessibility, and we learnt that that doesn't work.
BUG=76697 Review URL: http://codereview.chromium.org/7046100 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@88806 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/renderer_host')
-rw-r--r--content/browser/renderer_host/browser_render_process_host.cc23
-rw-r--r--content/browser/renderer_host/browser_render_process_host.h1
-rw-r--r--content/browser/renderer_host/clipboard_message_filter.cc5
-rw-r--r--content/browser/renderer_host/mock_render_process_host.cc7
-rw-r--r--content/browser/renderer_host/mock_render_process_host.h2
-rw-r--r--content/browser/renderer_host/render_message_filter.cc4
-rw-r--r--content/browser/renderer_host/render_process_host.h11
-rw-r--r--content/browser/renderer_host/render_widget_host_unittest.cc4
8 files changed, 14 insertions, 43 deletions
diff --git a/content/browser/renderer_host/browser_render_process_host.cc b/content/browser/renderer_host/browser_render_process_host.cc
index a05160b..8416d4b 100644
--- a/content/browser/renderer_host/browser_render_process_host.cc
+++ b/content/browser/renderer_host/browser_render_process_host.cc
@@ -26,7 +26,6 @@
#include "base/string_util.h"
#include "base/threading/thread.h"
#include "base/threading/thread_restrictions.h"
-#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
@@ -274,14 +273,9 @@ bool BrowserRenderProcessHost::Init(bool is_accessibility_enabled) {
// Setup the IPC channel.
const std::string channel_id =
ChildProcessInfo::GenerateRandomChannelID(this);
- channel_.reset(new IPC::SyncChannel(
+ channel_.reset(new IPC::ChannelProxy(
channel_id, IPC::Channel::MODE_SERVER, this,
- BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), 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);
+ BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)));
// Call the embedder first so that their IPC filters have priority.
content::GetContentClient()->browser()->BrowserRenderProcessHostCreated(this);
@@ -353,7 +347,7 @@ void BrowserRenderProcessHost::CreateMessageFilters() {
id(), ChildProcessInfo::RENDER_PROCESS,
&profile()->GetResourceContext(),
new RendererURLRequestContextSelector(profile(), id()),
- g_browser_process->resource_dispatcher_host());
+ content::GetContentClient()->browser()->GetResourceDispatcherHost());
channel_->AddFilter(resource_message_filter);
channel_->AddFilter(new AudioInputRendererHost());
@@ -393,7 +387,7 @@ void BrowserRenderProcessHost::CreateMessageFilters() {
new WorkerMessageFilter(
id(),
&profile()->GetResourceContext(),
- g_browser_process->resource_dispatcher_host(),
+ content::GetContentClient()->browser()->GetResourceDispatcherHost(),
NewCallbackWithReturnValue(
widget_helper_.get(), &RenderWidgetHelper::GetNextRoutingID)));
@@ -694,15 +688,6 @@ bool BrowserRenderProcessHost::FastShutdownIfPossible() {
return true;
}
-bool BrowserRenderProcessHost::SendWithTimeout(IPC::Message* msg,
- int timeout_ms) {
- if (!channel_.get()) {
- delete msg;
- return false;
- }
- return channel_->SendWithTimeout(msg, timeout_ms);
-}
-
// This is a platform specific function for mapping a transport DIB given its id
TransportDIB* BrowserRenderProcessHost::MapTransportDIB(
TransportDIB::Id dib_id) {
diff --git a/content/browser/renderer_host/browser_render_process_host.h b/content/browser/renderer_host/browser_render_process_host.h
index 2584ef8..4124e4c 100644
--- a/content/browser/renderer_host/browser_render_process_host.h
+++ b/content/browser/renderer_host/browser_render_process_host.h
@@ -58,7 +58,6 @@ class BrowserRenderProcessHost : public RenderProcessHost,
virtual void WidgetHidden();
virtual int VisibleWidgetCount() const;
virtual bool FastShutdownIfPossible();
- virtual bool SendWithTimeout(IPC::Message* msg, int timeout_ms);
virtual base::ProcessHandle GetHandle();
virtual TransportDIB* GetTransportDIB(TransportDIB::Id dib_id);
diff --git a/content/browser/renderer_host/clipboard_message_filter.cc b/content/browser/renderer_host/clipboard_message_filter.cc
index b1656b0..3a783f5 100644
--- a/content/browser/renderer_host/clipboard_message_filter.cc
+++ b/content/browser/renderer_host/clipboard_message_filter.cc
@@ -11,8 +11,8 @@
#endif
#include "base/stl_util-inl.h"
-#include "chrome/browser/browser_process.h"
#include "content/browser/clipboard_dispatcher.h"
+#include "content/browser/content_browser_client.h"
#include "content/common/clipboard_messages.h"
#include "googleurl/src/gurl.h"
#include "ipc/ipc_message_macros.h"
@@ -33,7 +33,8 @@ class WriteClipboardTask : public Task {
~WriteClipboardTask() {}
void Run() {
- g_browser_process->clipboard()->WriteObjects(*objects_.get());
+ content::GetContentClient()->browser()->GetClipboard()->WriteObjects(
+ *objects_.get());
}
private:
diff --git a/content/browser/renderer_host/mock_render_process_host.cc b/content/browser/renderer_host/mock_render_process_host.cc
index 1ad0d73..38a74b0 100644
--- a/content/browser/renderer_host/mock_render_process_host.cc
+++ b/content/browser/renderer_host/mock_render_process_host.cc
@@ -70,13 +70,6 @@ bool MockRenderProcessHost::FastShutdownIfPossible() {
return true;
}
-bool MockRenderProcessHost::SendWithTimeout(IPC::Message* msg, int timeout_ms) {
- // Save the message in the sink. Just ignore timeout_ms.
- sink_.OnMessageReceived(*msg);
- delete msg;
- return true;
-}
-
base::ProcessHandle MockRenderProcessHost::GetHandle() {
return base::kNullProcessHandle;
}
diff --git a/content/browser/renderer_host/mock_render_process_host.h b/content/browser/renderer_host/mock_render_process_host.h
index 67c96be..f49c4f5 100644
--- a/content/browser/renderer_host/mock_render_process_host.h
+++ b/content/browser/renderer_host/mock_render_process_host.h
@@ -49,9 +49,7 @@ class MockRenderProcessHost : public RenderProcessHost {
virtual int VisibleWidgetCount() const;
virtual void AddWord(const string16& word);
virtual bool FastShutdownIfPossible();
- virtual bool SendWithTimeout(IPC::Message* msg, int timeout_ms);
virtual base::ProcessHandle GetHandle();
-
virtual TransportDIB* GetTransportDIB(TransportDIB::Id dib_id);
// IPC::Channel::Sender via RenderProcessHost.
diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc
index fa7aa90..0c03e9f 100644
--- a/content/browser/renderer_host/render_message_filter.cc
+++ b/content/browser/renderer_host/render_message_filter.cc
@@ -12,7 +12,6 @@
#include "base/threading/thread.h"
#include "base/threading/worker_pool.h"
#include "base/utf_string_conversions.h"
-#include "chrome/browser/browser_process.h"
#include "chrome/browser/download/download_types.h"
#include "chrome/browser/download/download_util.h"
#include "chrome/browser/profiles/profile.h"
@@ -275,7 +274,8 @@ RenderMessageFilter::RenderMessageFilter(
Profile* profile,
net::URLRequestContextGetter* request_context,
RenderWidgetHelper* render_widget_helper)
- : resource_dispatcher_host_(g_browser_process->resource_dispatcher_host()),
+ : resource_dispatcher_host_(
+ content::GetContentClient()->browser()->GetResourceDispatcherHost()),
plugin_service_(plugin_service),
profile_(profile),
extension_info_map_(profile->GetExtensionInfoMap()),
diff --git a/content/browser/renderer_host/render_process_host.h b/content/browser/renderer_host/render_process_host.h
index c8dfe01..94ff03f 100644
--- a/content/browser/renderer_host/render_process_host.h
+++ b/content/browser/renderer_host/render_process_host.h
@@ -13,7 +13,7 @@
#include "base/process.h"
#include "base/process_util.h"
#include "base/time.h"
-#include "ipc/ipc_sync_channel.h"
+#include "ipc/ipc_channel_proxy.h"
#include "ui/gfx/surface/transport_dib.h"
class Profile;
@@ -122,7 +122,7 @@ class RenderProcessHost : public IPC::Channel::Sender,
return listeners_.Lookup(routing_id);
}
- IPC::SyncChannel* channel() { return channel_.get(); }
+ IPC::ChannelProxy* channel() { return channel_.get(); }
// Called to inform the render process host of a new "max page id" for a
// render view host. The render process host computes the largest page id
@@ -204,11 +204,6 @@ class RenderProcessHost : public IPC::Channel::Sender,
// Returns True if it was able to do fast shutdown.
virtual bool FastShutdownIfPossible() = 0;
- // Synchronously sends the message, waiting for the specified timeout. The
- // implementor takes ownership of the given Message regardless of whether or
- // not this method succeeds. Returns true on success.
- virtual bool SendWithTimeout(IPC::Message* msg, int timeout_ms) = 0;
-
// Returns the process object associated with the child process. In certain
// tests or single-process mode, this will actually represent the current
// process.
@@ -269,7 +264,7 @@ class RenderProcessHost : public IPC::Channel::Sender,
protected:
// A proxy for our IPC::Channel that lives on the IO thread (see
// browser_process.h)
- scoped_ptr<IPC::SyncChannel> channel_;
+ scoped_ptr<IPC::ChannelProxy> channel_;
// The registered listeners. When this list is empty or all NULL, we should
// delete ourselves
diff --git a/content/browser/renderer_host/render_widget_host_unittest.cc b/content/browser/renderer_host/render_widget_host_unittest.cc
index 8ded247..0018fe5 100644
--- a/content/browser/renderer_host/render_widget_host_unittest.cc
+++ b/content/browser/renderer_host/render_widget_host_unittest.cc
@@ -40,9 +40,9 @@ class RenderWidgetHostProcess : public MockRenderProcessHost {
update_msg_reply_flags_(0) {
// DANGER! This is a hack. The RenderWidgetHost checks the channel to see
// if the process is still alive, but it doesn't actually dereference it.
- // An IPC::SyncChannel is nontrivial, so we just fake it here. If you end up
+ // An IPC::ChannelProxy is nontrivial, so we just fake it here. If you end up
// crashing by dereferencing 1, then you'll have to make a real channel.
- channel_.reset(reinterpret_cast<IPC::SyncChannel*>(0x1));
+ channel_.reset(reinterpret_cast<IPC::ChannelProxy*>(0x1));
}
~RenderWidgetHostProcess() {
// We don't want to actually delete the channel, since it's not a real