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

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 1541913002: Ensure a guest WebContent's view is removed from the InputEventRouter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Account for possibility that RenderWidgetHostViewBase* is null. Created 5 years 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/web_contents/web_contents_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 base::Unretained(this))); 411 base::Unretained(this)));
412 media_web_contents_observer_.reset(new MediaWebContentsObserver(this)); 412 media_web_contents_observer_.reset(new MediaWebContentsObserver(this));
413 wake_lock_service_context_.reset(new WakeLockServiceContext(this)); 413 wake_lock_service_context_.reset(new WakeLockServiceContext(this));
414 } 414 }
415 415
416 WebContentsImpl::~WebContentsImpl() { 416 WebContentsImpl::~WebContentsImpl() {
417 is_being_destroyed_ = true; 417 is_being_destroyed_ = true;
418 418
419 rwh_input_event_router_.reset(); 419 rwh_input_event_router_.reset();
420 420
421 // If this WebContents is a guest and goes away before its view has
422 // de-registered its surface id namespace with the outermost WebContent's
423 // input event router (IER), we will lose the ability to ever deregister it,
424 // potentially resulting in a stale pointer in the IER's owner_map_.
425 // Speculative fix for https://crbug.com/570646.
426 auto ier = GetOuterWebContents()
427 ? GetOuterWebContents()->GetInputEventRouter()
428 : nullptr;
429 auto rwhvb =
kenrb 2015/12/21 21:51:02 nit: I don't think variable names are supposed to
wjmaclean 2015/12/22 12:43:38 No, probably not ... I was just following other us
430 static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView());
431 if (ier && rwhvb)
432 ier->RemoveSurfaceIdNamespaceOwner(rwhvb->GetSurfaceIdNamespace());
433
421 // Delete all RFH pending shutdown, which will lead the corresponding RVH to 434 // Delete all RFH pending shutdown, which will lead the corresponding RVH to
422 // shutdown and be deleted as well. 435 // shutdown and be deleted as well.
423 frame_tree_.ForEach( 436 frame_tree_.ForEach(
424 base::Bind(&RenderFrameHostManager::ClearRFHsPendingShutdown)); 437 base::Bind(&RenderFrameHostManager::ClearRFHsPendingShutdown));
425 438
426 // Destroy all WebUI instances. 439 // Destroy all WebUI instances.
427 frame_tree_.ForEach(base::Bind(&RenderFrameHostManager::ClearWebUIInstances)); 440 frame_tree_.ForEach(base::Bind(&RenderFrameHostManager::ClearWebUIInstances));
428 441
429 for (std::set<RenderWidgetHostImpl*>::iterator iter = 442 for (std::set<RenderWidgetHostImpl*>::iterator iter =
430 created_widgets_.begin(); iter != created_widgets_.end(); ++iter) { 443 created_widgets_.begin(); iter != created_widgets_.end(); ++iter) {
(...skipping 4284 matching lines...) Expand 10 before | Expand all | Expand 10 after
4715 const WebContentsObserver::MediaPlayerId& id) { 4728 const WebContentsObserver::MediaPlayerId& id) {
4716 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStartedPlaying(id)); 4729 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStartedPlaying(id));
4717 } 4730 }
4718 4731
4719 void WebContentsImpl::MediaStoppedPlaying( 4732 void WebContentsImpl::MediaStoppedPlaying(
4720 const WebContentsObserver::MediaPlayerId& id) { 4733 const WebContentsObserver::MediaPlayerId& id) {
4721 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStoppedPlaying(id)); 4734 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStoppedPlaying(id));
4722 } 4735 }
4723 4736
4724 } // namespace content 4737 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698