summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-13 06:41:11 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-13 06:41:11 +0000
commitc5b3b5ee82c8aa7b760acec23fa39ee61dd53152 (patch)
treeb2ceedd83090a12c4b23ca2aca55f26a72fea5a1 /chrome
parentb0a09a009b8b46cca2800ce16009651723fdadbf (diff)
downloadchromium_src-c5b3b5ee82c8aa7b760acec23fa39ee61dd53152.zip
chromium_src-c5b3b5ee82c8aa7b760acec23fa39ee61dd53152.tar.gz
chromium_src-c5b3b5ee82c8aa7b760acec23fa39ee61dd53152.tar.bz2
The WebFrame interface currently supports reference counting, but no one uses.
Internally, WebFrameImpl needs reference counting, so we still define it there. Same goes for WebView and WebWidget. While making this change, I noticed that WebInspectorClient was casting WebView pointers to WebViewImpl pointers too much. By just starting with WebViewImpl pointers, things could be cleaned up considerably. R=brettw Review URL: http://codereview.chromium.org/21342 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9745 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/renderer/render_view.cc4
-rw-r--r--chrome/renderer/render_widget.cc6
-rw-r--r--chrome/renderer/render_widget.h3
3 files changed, 6 insertions, 7 deletions
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 3d74340..b8bd897 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -282,9 +282,7 @@ void RenderView::Init(gfx::NativeViewId parent_hwnd,
decrement_shared_popup_at_destruction_ = false;
}
- // Avoid a leak here by not assigning, since WebView::Create addrefs for us.
- WebWidget* view = WebView::Create(this, webkit_prefs);
- webwidget_.swap(&view);
+ webwidget_ = WebView::Create(this, webkit_prefs);
// Don't let WebCore keep a B/F list - we have our own.
// We let it keep 1 entry because FrameLoader::goToItem expects an item in the
diff --git a/chrome/renderer/render_widget.cc b/chrome/renderer/render_widget.cc
index 1b20ee7..7d23d36 100644
--- a/chrome/renderer/render_widget.cc
+++ b/chrome/renderer/render_widget.cc
@@ -76,6 +76,7 @@ DeferredCloses* DeferredCloses::current_ = NULL;
RenderWidget::RenderWidget(RenderThreadBase* render_thread, bool activatable)
: routing_id_(MSG_ROUTING_NONE),
+ webwidget_(NULL),
opener_id_(MSG_ROUTING_NONE),
render_thread_(render_thread),
host_window_(NULL),
@@ -101,6 +102,7 @@ RenderWidget::RenderWidget(RenderThreadBase* render_thread, bool activatable)
}
RenderWidget::~RenderWidget() {
+ DCHECK(!webwidget_) << "Leaking our WebWidget!";
if (current_paint_buf_) {
RenderProcess::FreeSharedMemory(current_paint_buf_);
current_paint_buf_ = NULL;
@@ -129,9 +131,7 @@ void RenderWidget::Init(int32 opener_id) {
if (opener_id != MSG_ROUTING_NONE)
opener_id_ = opener_id;
- // Avoid a leak here by not assigning, since WebWidget::Create addrefs for us.
- WebWidget* webwidget = WebWidget::Create(this);
- webwidget_.swap(&webwidget);
+ webwidget_ = WebWidget::Create(this);
bool result = render_thread_->Send(
new ViewHostMsg_CreateWidget(opener_id, activatable_, &routing_id_));
diff --git a/chrome/renderer/render_widget.h b/chrome/renderer/render_widget.h
index 56ba30c..4153ce0 100644
--- a/chrome/renderer/render_widget.h
+++ b/chrome/renderer/render_widget.h
@@ -165,7 +165,8 @@ class RenderWidget : public IPC::Channel::Listener,
// RenderWidgetHost. When MSG_ROUTING_NONE, no messages may be sent.
int32 routing_id_;
- scoped_refptr<WebWidget> webwidget_;
+ // We are responsible for destroying this object via its Close method.
+ WebWidget* webwidget_;
// Set to the ID of the view that initiated creating this view, if any. When
// the view was initiated by the browser (the common case), this will be