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

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

Issue 1542743002: [RDHI] Refactored blocked_loaders_map_ to key by render frame route id (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Replace FrameTree::ForEach with a for loop Created 4 years, 11 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 unified diff | Download patch
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 #include <utility> 10 #include <utility>
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 page_scale_factor_is_one_(true), 398 page_scale_factor_is_one_(true),
399 loading_weak_factory_(this) { 399 loading_weak_factory_(this) {
400 frame_tree_.SetFrameRemoveListener( 400 frame_tree_.SetFrameRemoveListener(
401 base::Bind(&WebContentsImpl::OnFrameRemoved, 401 base::Bind(&WebContentsImpl::OnFrameRemoved,
402 base::Unretained(this))); 402 base::Unretained(this)));
403 #if defined(OS_ANDROID) 403 #if defined(OS_ANDROID)
404 media_web_contents_observer_.reset(new MediaWebContentsObserverAndroid(this)); 404 media_web_contents_observer_.reset(new MediaWebContentsObserverAndroid(this));
405 #else 405 #else
406 media_web_contents_observer_.reset(new MediaWebContentsObserver(this)); 406 media_web_contents_observer_.reset(new MediaWebContentsObserver(this));
407 #endif 407 #endif
408 loader_io_thread_notifier_.reset(new LoaderIOThreadNotifier(this));
408 wake_lock_service_context_.reset(new WakeLockServiceContext(this)); 409 wake_lock_service_context_.reset(new WakeLockServiceContext(this));
409 } 410 }
410 411
411 WebContentsImpl::~WebContentsImpl() { 412 WebContentsImpl::~WebContentsImpl() {
412 is_being_destroyed_ = true; 413 is_being_destroyed_ = true;
413 414
414 rwh_input_event_router_.reset(); 415 rwh_input_event_router_.reset();
415 416
416 // Delete all RFH pending shutdown, which will lead the corresponding RVH to 417 // Delete all RFH pending shutdown, which will lead the corresponding RVH to
417 // shutdown and be deleted as well. 418 // shutdown and be deleted as well.
(...skipping 1402 matching lines...) Expand 10 before | Expand all | Expand 10 after
1820 !delegate_->ShouldCreateWebContents( 1821 !delegate_->ShouldCreateWebContents(
1821 this, route_id, main_frame_route_id, main_frame_widget_route_id, 1822 this, route_id, main_frame_route_id, main_frame_widget_route_id,
1822 params.window_container_type, params.frame_name, params.target_url, 1823 params.window_container_type, params.frame_name, params.target_url,
1823 partition_id, session_storage_namespace)) { 1824 partition_id, session_storage_namespace)) {
1824 if (route_id != MSG_ROUTING_NONE && 1825 if (route_id != MSG_ROUTING_NONE &&
1825 !RenderViewHost::FromID(render_process_id, route_id)) { 1826 !RenderViewHost::FromID(render_process_id, route_id)) {
1826 // If the embedder didn't create a WebContents for this route, we need to 1827 // If the embedder didn't create a WebContents for this route, we need to
1827 // delete the RenderView that had already been created. 1828 // delete the RenderView that had already been created.
1828 Send(new ViewMsg_Close(route_id)); 1829 Send(new ViewMsg_Close(route_id));
1829 } 1830 }
1830 GetRenderViewHost()->GetProcess()->ResumeRequestsForView(route_id); 1831 // It's safe to only target the frame because the view will not have a
nasko 2016/01/20 22:22:09 nit: Let's strive to avoid using "view", as the "v
Charlie Harrison 2016/01/21 18:52:55 Done.
1832 // change to create more frames at this point. Additionally, the frame's
1833 // requests will only be blocked if it lives in the same process as the
1834 // source.
1835 if (site_instance == source_site_instance) {
1836 ResourceDispatcherHostImpl::NotifyForRoute(
1837 GlobalFrameRoutingId(render_process_id, main_frame_route_id),
1838 base::Bind(
1839 &ResourceDispatcherHostImpl::ResumeBlockedRequestsForRoute));
1840 }
1831 return; 1841 return;
1832 } 1842 }
1833 1843
1834 // Create the new web contents. This will automatically create the new 1844 // Create the new web contents. This will automatically create the new
1835 // WebContentsView. In the future, we may want to create the view separately. 1845 // WebContentsView. In the future, we may want to create the view separately.
1836 CreateParams create_params(GetBrowserContext(), site_instance.get()); 1846 CreateParams create_params(GetBrowserContext(), site_instance.get());
1837 create_params.routing_id = route_id; 1847 create_params.routing_id = route_id;
1838 create_params.main_frame_routing_id = main_frame_route_id; 1848 create_params.main_frame_routing_id = main_frame_route_id;
1839 create_params.main_frame_widget_routing_id = main_frame_widget_route_id; 1849 create_params.main_frame_widget_routing_id = main_frame_widget_route_id;
1840 create_params.main_frame_name = params.frame_name; 1850 create_params.main_frame_name = params.frame_name;
(...skipping 2887 matching lines...) Expand 10 before | Expand all | Expand 10 after
4728 const WebContentsObserver::MediaPlayerId& id) { 4738 const WebContentsObserver::MediaPlayerId& id) {
4729 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStartedPlaying(id)); 4739 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStartedPlaying(id));
4730 } 4740 }
4731 4741
4732 void WebContentsImpl::MediaStoppedPlaying( 4742 void WebContentsImpl::MediaStoppedPlaying(
4733 const WebContentsObserver::MediaPlayerId& id) { 4743 const WebContentsObserver::MediaPlayerId& id) {
4734 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStoppedPlaying(id)); 4744 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStoppedPlaying(id));
4735 } 4745 }
4736 4746
4737 } // namespace content 4747 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698