diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-26 02:58:43 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-26 02:58:43 +0000 |
commit | 87717d0e2edb64b8d948794d070e9a3fa75ef059 (patch) | |
tree | 4de6e73dc1650d79699b55d630816831e5740818 /content/browser/webui/web_ui_impl.h | |
parent | 2def0452d5bbdee278129fffe4e2bec86d9656a7 (diff) | |
download | chromium_src-87717d0e2edb64b8d948794d070e9a3fa75ef059.zip chromium_src-87717d0e2edb64b8d948794d070e9a3fa75ef059.tar.gz chromium_src-87717d0e2edb64b8d948794d070e9a3fa75ef059.tar.bz2 |
re-use WebUIs
this is a partial revert of r133077 and an alternative fix for bug 121741. The last commit was faulty because a same-document navigate would not send new DocumentAvailableInFrame IPCs, hence all WebUISend messages would be ignored after a same document navigation. An example of a same-document navigation is when the user presses back, and the page handles window.onpopstate.
The new fix:
Re-use WebUI objects for navigations where we re-use the render view, and the old and new URLs return the same WebUIController type. This covers both the reload case and the same-document nav case. This way, the re-used WebUI is still initialized and is able to continue to handle messages without the possibility of unexpected messages causing crashes. WebUI re-builds on every back/forward/reload are also wasteful so this is a performance win.
BUG=123705,121741,123710
TEST=
Review URL: http://codereview.chromium.org/10154004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134055 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/webui/web_ui_impl.h')
-rw-r--r-- | content/browser/webui/web_ui_impl.h | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/content/browser/webui/web_ui_impl.h b/content/browser/webui/web_ui_impl.h index df245c7b..d0dfcab 100644 --- a/content/browser/webui/web_ui_impl.h +++ b/content/browser/webui/web_ui_impl.h @@ -7,9 +7,9 @@ #pragma once #include <map> -#include <set> #include "base/compiler_specific.h" +#include "base/memory/weak_ptr.h" #include "content/public/browser/web_ui.h" #include "ipc/ipc_channel.h" @@ -18,7 +18,8 @@ class RenderViewHost; } class CONTENT_EXPORT WebUIImpl : public content::WebUI, - public IPC::Channel::Listener { + public IPC::Channel::Listener, + public base::SupportsWeakPtr<WebUIImpl> { public: explicit WebUIImpl(content::WebContents* contents); virtual ~WebUIImpl(); @@ -28,15 +29,6 @@ class CONTENT_EXPORT WebUIImpl : public content::WebUI, // RenderViewHostManager will reuse RenderView instances. void RenderViewCreated(content::RenderViewHost* render_view_host); - // Called when the document element is available for the page. |main_frame| - // is true if the main frame's document is the one that's ready; otherwise - // the frame is an iframe and |source_url| gives its URL. The WebUI ignores - // messages until the document is available, because otherwise when we reuse - // a RenderView, we can receive and attempt to handle WebUISend messages from - // the prior navigation, which were in-flight when the RenderView got - // repurposed. - void DocumentAvailableInFrame(const GURL& source_url); - // WebUI implementation: virtual content::WebContents* GetWebContents() const OVERRIDE; virtual content::WebUIController* GetController() const OVERRIDE; @@ -119,11 +111,6 @@ class CONTENT_EXPORT WebUIImpl : public content::WebUI, // iframe). std::string frame_xpath_; - // List of URL origins in the renderer for which the document is ready. Each - // origin identifies a frame; two frames with the same origin may cause this - // to break. - std::set<GURL> document_available_origins_; - scoped_ptr<content::WebUIController> controller_; DISALLOW_COPY_AND_ASSIGN(WebUIImpl); |