OLD | NEW |
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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 page_scale_factor_is_one_(true), | 396 page_scale_factor_is_one_(true), |
397 loading_weak_factory_(this) { | 397 loading_weak_factory_(this) { |
398 frame_tree_.SetFrameRemoveListener( | 398 frame_tree_.SetFrameRemoveListener( |
399 base::Bind(&WebContentsImpl::OnFrameRemoved, | 399 base::Bind(&WebContentsImpl::OnFrameRemoved, |
400 base::Unretained(this))); | 400 base::Unretained(this))); |
401 #if defined(OS_ANDROID) | 401 #if defined(OS_ANDROID) |
402 media_web_contents_observer_.reset(new MediaWebContentsObserverAndroid(this)); | 402 media_web_contents_observer_.reset(new MediaWebContentsObserverAndroid(this)); |
403 #else | 403 #else |
404 media_web_contents_observer_.reset(new MediaWebContentsObserver(this)); | 404 media_web_contents_observer_.reset(new MediaWebContentsObserver(this)); |
405 #endif | 405 #endif |
| 406 loader_io_thread_notifier_.reset(new LoaderIOThreadNotifier(this)); |
406 wake_lock_service_context_.reset(new WakeLockServiceContext(this)); | 407 wake_lock_service_context_.reset(new WakeLockServiceContext(this)); |
407 } | 408 } |
408 | 409 |
409 WebContentsImpl::~WebContentsImpl() { | 410 WebContentsImpl::~WebContentsImpl() { |
410 is_being_destroyed_ = true; | 411 is_being_destroyed_ = true; |
411 | 412 |
412 rwh_input_event_router_.reset(); | 413 rwh_input_event_router_.reset(); |
413 | 414 |
414 for (FrameTreeNode* node : frame_tree_.Nodes()) { | 415 for (FrameTreeNode* node : frame_tree_.Nodes()) { |
415 // Delete all RFHs pending shutdown, which will lead the corresponding RVHs | 416 // Delete all RFHs pending shutdown, which will lead the corresponding RVHs |
(...skipping 1426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1842 !delegate_->ShouldCreateWebContents( | 1843 !delegate_->ShouldCreateWebContents( |
1843 this, route_id, main_frame_route_id, main_frame_widget_route_id, | 1844 this, route_id, main_frame_route_id, main_frame_widget_route_id, |
1844 params.window_container_type, params.frame_name, params.target_url, | 1845 params.window_container_type, params.frame_name, params.target_url, |
1845 partition_id, session_storage_namespace)) { | 1846 partition_id, session_storage_namespace)) { |
1846 if (route_id != MSG_ROUTING_NONE && | 1847 if (route_id != MSG_ROUTING_NONE && |
1847 !RenderViewHost::FromID(render_process_id, route_id)) { | 1848 !RenderViewHost::FromID(render_process_id, route_id)) { |
1848 // If the embedder didn't create a WebContents for this route, we need to | 1849 // If the embedder didn't create a WebContents for this route, we need to |
1849 // delete the RenderView that had already been created. | 1850 // delete the RenderView that had already been created. |
1850 Send(new ViewMsg_Close(route_id)); | 1851 Send(new ViewMsg_Close(route_id)); |
1851 } | 1852 } |
1852 GetRenderViewHost()->GetProcess()->ResumeRequestsForView(route_id); | 1853 // It's safe to only target the frame because the render process will not |
| 1854 // have a chance to create more frames at this point. |
| 1855 ResourceDispatcherHostImpl::ResumeBlockedRequestsForRouteFromUI( |
| 1856 GlobalFrameRoutingId(render_process_id, main_frame_route_id)); |
1853 return; | 1857 return; |
1854 } | 1858 } |
1855 | 1859 |
1856 // Create the new web contents. This will automatically create the new | 1860 // Create the new web contents. This will automatically create the new |
1857 // WebContentsView. In the future, we may want to create the view separately. | 1861 // WebContentsView. In the future, we may want to create the view separately. |
1858 CreateParams create_params(GetBrowserContext(), site_instance.get()); | 1862 CreateParams create_params(GetBrowserContext(), site_instance.get()); |
1859 create_params.routing_id = route_id; | 1863 create_params.routing_id = route_id; |
1860 create_params.main_frame_routing_id = main_frame_route_id; | 1864 create_params.main_frame_routing_id = main_frame_route_id; |
1861 create_params.main_frame_widget_routing_id = main_frame_widget_route_id; | 1865 create_params.main_frame_widget_routing_id = main_frame_widget_route_id; |
1862 create_params.main_frame_name = params.frame_name; | 1866 create_params.main_frame_name = params.frame_name; |
(...skipping 2889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4752 const WebContentsObserver::MediaPlayerId& id) { | 4756 const WebContentsObserver::MediaPlayerId& id) { |
4753 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStartedPlaying(id)); | 4757 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStartedPlaying(id)); |
4754 } | 4758 } |
4755 | 4759 |
4756 void WebContentsImpl::MediaStoppedPlaying( | 4760 void WebContentsImpl::MediaStoppedPlaying( |
4757 const WebContentsObserver::MediaPlayerId& id) { | 4761 const WebContentsObserver::MediaPlayerId& id) { |
4758 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStoppedPlaying(id)); | 4762 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStoppedPlaying(id)); |
4759 } | 4763 } |
4760 | 4764 |
4761 } // namespace content | 4765 } // namespace content |
OLD | NEW |