diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-17 00:12:52 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-17 00:12:52 +0000 |
commit | 1a98a93fc1977683c3789dedbef2806b3fcdf5b4 (patch) | |
tree | 4a8b6aa1e55e0d2d93e9f646f3bdde3aaa98cab4 /chrome/browser/renderer_host | |
parent | f09d9379d6e654e7fd95b9d601b1e77f1ac13c3d (diff) | |
download | chromium_src-1a98a93fc1977683c3789dedbef2806b3fcdf5b4.zip chromium_src-1a98a93fc1977683c3789dedbef2806b3fcdf5b4.tar.gz chromium_src-1a98a93fc1977683c3789dedbef2806b3fcdf5b4.tar.bz2 |
amit, please review everything, jam please review the changes to the tab_contents and the
renderer_host sources.
Remove the AutomationProfileImpl class which wraps the Chrome profile for an external tab
container, which hosts ChromeFrame. This object was used to carry a custom URL request
context which was used to intercept HTTP requests and cookie requests issued by external
tabs.
However as the life time of the automation profile class depended on the lifetime of the external
tab container object this caused a number of crashes in objects which held on to the automation profile
pointer retrieved from the associated tab contents. This does not happen in a regualar Chrome browser
instance as the profile is deleted at the very end.
We can associate the automation URL request context with the underlying tab_contents which would
eventually percolate down to the resource message filter. Doing this would avoid the need for the
AutomationProfile class.
This CL achieves that.
Bug=27695,27662
Review URL: http://codereview.chromium.org/385117
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32127 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/renderer_host')
11 files changed, 32 insertions, 14 deletions
diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc index 200fecf..896b2fd 100644 --- a/chrome/browser/renderer_host/browser_render_process_host.cc +++ b/chrome/browser/renderer_host/browser_render_process_host.cc @@ -29,6 +29,7 @@ #include "chrome/browser/extensions/extensions_service.h" #include "chrome/browser/extensions/user_script_master.h" #include "chrome/browser/history/history.h" +#include "chrome/browser/net/url_request_context_getter.h" #include "chrome/browser/plugin_service.h" #include "chrome/browser/profile.h" #include "chrome/browser/renderer_host/audio_renderer_host.h" @@ -261,7 +262,8 @@ BrowserRenderProcessHost::~BrowserRenderProcessHost() { NotificationService::NoDetails()); } -bool BrowserRenderProcessHost::Init(bool is_extensions_process) { +bool BrowserRenderProcessHost::Init(bool is_extensions_process, + URLRequestContextGetter* request_context) { // calling Init() more than once does nothing, this makes it more convenient // for the view host which may not be sure in some cases if (channel_.get()) { @@ -289,7 +291,8 @@ bool BrowserRenderProcessHost::Init(bool is_extensions_process) { g_browser_process->print_job_manager(), profile(), widget_helper_, - profile()->GetSpellChecker()); + profile()->GetSpellChecker(), + request_context); // Find the renderer before creating the channel so if this fails early we // return without creating the channel. diff --git a/chrome/browser/renderer_host/browser_render_process_host.h b/chrome/browser/renderer_host/browser_render_process_host.h index 42f6fe2..caf55d7 100644 --- a/chrome/browser/renderer_host/browser_render_process_host.h +++ b/chrome/browser/renderer_host/browser_render_process_host.h @@ -28,6 +28,7 @@ class RendererMainThread; class RenderWidgetHelper; class TabContents; class VisitedLinkUpdater; +class URLRequestContextGetter; namespace gfx { class Size; @@ -54,7 +55,8 @@ class BrowserRenderProcessHost : public RenderProcessHost, ~BrowserRenderProcessHost(); // RenderProcessHost implementation (public portion). - virtual bool Init(bool is_extensions_process); + virtual bool Init(bool is_extensions_process, + URLRequestContextGetter* request_context); virtual int GetNextRoutingID(); virtual void CancelResourceRequests(int render_widget_id); virtual void CrossSiteClosePageACK(const ViewMsg_ClosePage_Params& params); diff --git a/chrome/browser/renderer_host/mock_render_process_host.cc b/chrome/browser/renderer_host/mock_render_process_host.cc index 55fd014..7ce8c66 100644 --- a/chrome/browser/renderer_host/mock_render_process_host.cc +++ b/chrome/browser/renderer_host/mock_render_process_host.cc @@ -14,7 +14,8 @@ MockRenderProcessHost::~MockRenderProcessHost() { delete transport_dib_; } -bool MockRenderProcessHost::Init(bool is_extensions_process) { +bool MockRenderProcessHost::Init(bool is_extensions_process, + URLRequestContextGetter* request_context) { return true; } diff --git a/chrome/browser/renderer_host/mock_render_process_host.h b/chrome/browser/renderer_host/mock_render_process_host.h index 005225f2..f9e3143 100644 --- a/chrome/browser/renderer_host/mock_render_process_host.h +++ b/chrome/browser/renderer_host/mock_render_process_host.h @@ -10,6 +10,7 @@ #include "chrome/common/ipc_test_sink.h" class TransportDIB; +class URLRequestContextGetter; // A mock render process host that has no corresponding renderer process. All // IPC messages are sent into the message sink for inspection by tests. @@ -29,7 +30,8 @@ class MockRenderProcessHost : public RenderProcessHost { int bad_msg_count() const { return bad_msg_count_; } // RenderProcessHost implementation (public portion). - virtual bool Init(bool is_extensions_process); + virtual bool Init(bool is_extensions_process, + URLRequestContextGetter* request_context); virtual int GetNextRoutingID(); virtual void CancelResourceRequests(int render_widget_id); virtual void CrossSiteClosePageACK(const ViewMsg_ClosePage_Params& params); diff --git a/chrome/browser/renderer_host/render_process_host.h b/chrome/browser/renderer_host/render_process_host.h index 2887f88..1b2d9ef 100644 --- a/chrome/browser/renderer_host/render_process_host.h +++ b/chrome/browser/renderer_host/render_process_host.h @@ -19,6 +19,8 @@ class Profile; struct ViewMsg_ClosePage_Params; +class URLRequestContextGetter; + // Virtual interface that represents the browser side of the browser <-> // renderer communication channel. There will generally be one // RenderProcessHost per renderer process. @@ -133,7 +135,8 @@ class RenderProcessHost : public IPC::Channel::Sender, // be called once before the object can be used, but can be called after // that with no effect. Therefore, if the caller isn't sure about whether // the process has been created, it should just call Init(). - virtual bool Init(bool is_extensions_process) = 0; + virtual bool Init(bool is_extensions_process, + URLRequestContextGetter* request_context) = 0; // Gets the next available routing id. virtual int GetNextRoutingID() = 0; diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc index 34ba64d..5609bae 100644 --- a/chrome/browser/renderer_host/render_view_host.cc +++ b/chrome/browser/renderer_host/render_view_host.cc @@ -21,6 +21,7 @@ #include "chrome/browser/dom_operation_notification_details.h" #include "chrome/browser/extensions/extension_message_service.h" #include "chrome/browser/metrics/user_metrics.h" +#include "chrome/browser/net/url_request_context_getter.h" #include "chrome/browser/notifications/desktop_notification_service.h" #include "chrome/browser/profile.h" #include "chrome/browser/renderer_host/render_process_host.h" @@ -165,7 +166,8 @@ void RenderViewHost::Observe(NotificationType type, } } -bool RenderViewHost::CreateRenderView() { +bool RenderViewHost::CreateRenderView( + URLRequestContextGetter* request_context) { DCHECK(!IsRenderViewLive()) << "Creating view twice"; CHECK(process()); CHECK(!process()->ListenersIterator().IsAtEnd()) << @@ -177,7 +179,7 @@ bool RenderViewHost::CreateRenderView() { // ignored, so this is safe. bool is_extensions_process = BindingsPolicy::is_extension_enabled(enabled_bindings_); - if (!process()->Init(is_extensions_process)) + if (!process()->Init(is_extensions_process, request_context)) return false; DCHECK(process()->HasConnection()); DCHECK(process()->profile()); diff --git a/chrome/browser/renderer_host/render_view_host.h b/chrome/browser/renderer_host/render_view_host.h index a66f371..21f72c5c 100644 --- a/chrome/browser/renderer_host/render_view_host.h +++ b/chrome/browser/renderer_host/render_view_host.h @@ -52,6 +52,8 @@ namespace WebKit { struct WebMediaPlayerAction; } +class URLRequestContextGetter; + // // RenderViewHost // @@ -98,7 +100,7 @@ class RenderViewHost : public RenderWidgetHost, // Set up the RenderView child process. Virtual because it is overridden by // TestRenderViewHost. - virtual bool CreateRenderView(); + virtual bool CreateRenderView(URLRequestContextGetter* request_context); // Returns true if the RenderView is active and has not crashed. Virtual // because it is overridden by TestRenderViewHost. diff --git a/chrome/browser/renderer_host/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc index ba34532..93ee409 100644 --- a/chrome/browser/renderer_host/resource_message_filter.cc +++ b/chrome/browser/renderer_host/resource_message_filter.cc @@ -150,7 +150,8 @@ ResourceMessageFilter::ResourceMessageFilter( printing::PrintJobManager* print_job_manager, Profile* profile, RenderWidgetHelper* render_widget_helper, - SpellChecker* spellchecker) + SpellChecker* spellchecker, + URLRequestContextGetter* request_context) : Receiver(RENDER_PROCESS, child_id), channel_(NULL), resource_dispatcher_host_(resource_dispatcher_host), @@ -158,7 +159,7 @@ ResourceMessageFilter::ResourceMessageFilter( print_job_manager_(print_job_manager), spellchecker_(spellchecker), ALLOW_THIS_IN_INITIALIZER_LIST(resolve_proxy_msg_helper_(this, NULL)), - request_context_(profile->GetRequestContext()), + request_context_(request_context), media_request_context_(profile->GetRequestContextForMedia()), extensions_request_context_(profile->GetRequestContextForExtensions()), extensions_message_service_(profile->GetExtensionMessageService()), diff --git a/chrome/browser/renderer_host/resource_message_filter.h b/chrome/browser/renderer_host/resource_message_filter.h index 31f87d4..50507db 100644 --- a/chrome/browser/renderer_host/resource_message_filter.h +++ b/chrome/browser/renderer_host/resource_message_filter.h @@ -87,7 +87,8 @@ class ResourceMessageFilter : public IPC::ChannelProxy::MessageFilter, printing::PrintJobManager* print_job_manager, Profile* profile, RenderWidgetHelper* render_widget_helper, - SpellChecker* spellchecker); + SpellChecker* spellchecker, + URLRequestContextGetter* request_context); // IPC::ChannelProxy::MessageFilter methods: virtual void OnFilterAdded(IPC::Channel* channel); diff --git a/chrome/browser/renderer_host/test/test_render_view_host.cc b/chrome/browser/renderer_host/test/test_render_view_host.cc index 72a0c6b..e9e848f 100644 --- a/chrome/browser/renderer_host/test/test_render_view_host.cc +++ b/chrome/browser/renderer_host/test/test_render_view_host.cc @@ -28,7 +28,8 @@ TestRenderViewHost::~TestRenderViewHost() { delete view(); } -bool TestRenderViewHost::CreateRenderView() { +bool TestRenderViewHost::CreateRenderView( + URLRequestContextGetter* request_context) { DCHECK(!render_view_created_); render_view_created_ = true; process()->ViewCreated(); diff --git a/chrome/browser/renderer_host/test/test_render_view_host.h b/chrome/browser/renderer_host/test/test_render_view_host.h index cc58d37..b1458a1 100644 --- a/chrome/browser/renderer_host/test/test_render_view_host.h +++ b/chrome/browser/renderer_host/test/test_render_view_host.h @@ -131,7 +131,7 @@ class TestRenderViewHost : public RenderViewHost { // RenderViewHost overrides -------------------------------------------------- - virtual bool CreateRenderView(); + virtual bool CreateRenderView(URLRequestContextGetter* request_context); virtual bool IsRenderViewLive() const; private: |