Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Unified Diff: content/browser/web_contents/web_contents_impl.cc

Issue 10968037: Fix the issue that any tab/window closing hotkey will crash the Pepper Flash Fullscreen. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changes in response to John's suggestion. Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/web_contents/web_contents_impl.cc
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 8256d033f6112937f6cf2299271e2503c2bc632f..4cb28fc969492870b7d5d00da9596cc098d6da47 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -362,6 +362,12 @@ WebContentsImpl::WebContentsImpl(
WebContentsImpl::~WebContentsImpl() {
is_being_destroyed_ = true;
+ for (std::set<RenderWidgetHostImpl*>::iterator iter =
+ created_widgets_.begin(); iter != created_widgets_.end(); ++iter) {
+ (*iter)->DetachDelegate();
+ }
+ created_widgets_.clear();
+
// Clear out any JavaScript state.
if (dialog_creator_)
dialog_creator_->ResetJavaScriptState(this);
@@ -1161,6 +1167,19 @@ void WebContentsImpl::LostCapture() {
delegate_->LostCapture();
}
+void WebContentsImpl::RenderWidgetDeleted(
+ RenderWidgetHostImpl* render_widget_host) {
+ if (is_being_destroyed_) {
+ // |created_widgets_| might have been destroyed.
+ return;
+ }
+
+ std::set<RenderWidgetHostImpl*>::iterator iter =
+ created_widgets_.find(render_widget_host);
+ if (iter != created_widgets_.end())
+ created_widgets_.erase(iter);
+}
+
bool WebContentsImpl::PreHandleKeyboardEvent(
const NativeWebKeyboardEvent& event,
bool* is_keyboard_shortcut) {
@@ -1323,6 +1342,8 @@ void WebContentsImpl::CreateNewWidget(int route_id,
content::RenderProcessHost* process = GetRenderProcessHost();
RenderWidgetHostImpl* widget_host =
new RenderWidgetHostImpl(this, process, route_id);
+ created_widgets_.insert(widget_host);
+
RenderWidgetHostViewPort* widget_view =
RenderWidgetHostViewPort::CreateViewForWidget(widget_host);
if (!is_fullscreen) {

Powered by Google App Engine
This is Rietveld 408576698