| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/renderer/render_frame_impl.h" | 5 #include "content/renderer/render_frame_impl.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 993 | 993 |
| 994 void RenderFrameImpl::OnSwapOut(int proxy_routing_id) { | 994 void RenderFrameImpl::OnSwapOut(int proxy_routing_id) { |
| 995 RenderFrameProxy* proxy = NULL; | 995 RenderFrameProxy* proxy = NULL; |
| 996 bool is_site_per_process = | 996 bool is_site_per_process = |
| 997 CommandLine::ForCurrentProcess()->HasSwitch(switches::kSitePerProcess); | 997 CommandLine::ForCurrentProcess()->HasSwitch(switches::kSitePerProcess); |
| 998 | 998 |
| 999 // Only run unload if we're not swapped out yet, but send the ack either way. | 999 // Only run unload if we're not swapped out yet, but send the ack either way. |
| 1000 if (!is_swapped_out_ || !render_view_->is_swapped_out_) { | 1000 if (!is_swapped_out_ || !render_view_->is_swapped_out_) { |
| 1001 // Swap this RenderFrame out so the frame can navigate to a page rendered by | 1001 // Swap this RenderFrame out so the frame can navigate to a page rendered by |
| 1002 // a different process. This involves running the unload handler and | 1002 // a different process. This involves running the unload handler and |
| 1003 // clearing the page. Once WasSwappedOut is called, we also allow this | 1003 // clearing the page. We also allow this process to exit if there are no |
| 1004 // process to exit if there are no other active RenderFrames in it. | 1004 // other active RenderFrames in it. |
| 1005 | 1005 |
| 1006 // Send an UpdateState message before we get swapped out. Create the | 1006 // Send an UpdateState message before we get swapped out. Create the |
| 1007 // RenderFrameProxy as well so its routing id is registered for receiving | 1007 // RenderFrameProxy as well so its routing id is registered for receiving |
| 1008 // IPC messages. | 1008 // IPC messages. |
| 1009 render_view_->SyncNavigationState(); | 1009 render_view_->SyncNavigationState(); |
| 1010 proxy = RenderFrameProxy::CreateProxyToReplaceFrame(this, | 1010 proxy = RenderFrameProxy::CreateProxyToReplaceFrame(this, |
| 1011 proxy_routing_id); | 1011 proxy_routing_id); |
| 1012 | 1012 |
| 1013 // Synchronously run the unload handler before sending the ACK. | 1013 // Synchronously run the unload handler before sending the ACK. |
| 1014 // TODO(creis): Call dispatchUnloadEvent unconditionally here to support | 1014 // TODO(creis): Call dispatchUnloadEvent unconditionally here to support |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1067 if (frame_->parent()) { | 1067 if (frame_->parent()) { |
| 1068 frame_->swap(proxy->web_frame()); | 1068 frame_->swap(proxy->web_frame()); |
| 1069 if (is_site_per_process) { | 1069 if (is_site_per_process) { |
| 1070 // TODO(nasko): delete the frame here, since we've replaced it with a | 1070 // TODO(nasko): delete the frame here, since we've replaced it with a |
| 1071 // proxy. | 1071 // proxy. |
| 1072 } | 1072 } |
| 1073 } else { | 1073 } else { |
| 1074 set_render_frame_proxy(proxy); | 1074 set_render_frame_proxy(proxy); |
| 1075 } | 1075 } |
| 1076 } | 1076 } |
| 1077 |
| 1078 // Safe to exit if no one else is using the process. |
| 1079 if (!frame_->parent()) |
| 1080 render_view_->WasSwappedOut(); |
| 1077 } | 1081 } |
| 1078 | 1082 |
| 1079 void RenderFrameImpl::OnContextMenuClosed( | 1083 void RenderFrameImpl::OnContextMenuClosed( |
| 1080 const CustomContextMenuContext& custom_context) { | 1084 const CustomContextMenuContext& custom_context) { |
| 1081 if (custom_context.request_id) { | 1085 if (custom_context.request_id) { |
| 1082 // External request, should be in our map. | 1086 // External request, should be in our map. |
| 1083 ContextMenuClient* client = | 1087 ContextMenuClient* client = |
| 1084 pending_context_menus_.Lookup(custom_context.request_id); | 1088 pending_context_menus_.Lookup(custom_context.request_id); |
| 1085 if (client) { | 1089 if (client) { |
| 1086 client->OnMenuClosed(custom_context.request_id); | 1090 client->OnMenuClosed(custom_context.request_id); |
| (...skipping 2632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3719 | 3723 |
| 3720 #if defined(ENABLE_BROWSER_CDMS) | 3724 #if defined(ENABLE_BROWSER_CDMS) |
| 3721 RendererCdmManager* RenderFrameImpl::GetCdmManager() { | 3725 RendererCdmManager* RenderFrameImpl::GetCdmManager() { |
| 3722 if (!cdm_manager_) | 3726 if (!cdm_manager_) |
| 3723 cdm_manager_ = new RendererCdmManager(this); | 3727 cdm_manager_ = new RendererCdmManager(this); |
| 3724 return cdm_manager_; | 3728 return cdm_manager_; |
| 3725 } | 3729 } |
| 3726 #endif // defined(ENABLE_BROWSER_CDMS) | 3730 #endif // defined(ENABLE_BROWSER_CDMS) |
| 3727 | 3731 |
| 3728 } // namespace content | 3732 } // namespace content |
| OLD | NEW |