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

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

Issue 19491004: Fix SessionStorage confusion between RenderViewHostImpl and NavigationController. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
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/render_view_host_manager.h" 5 #include "content/browser/web_contents/render_view_host_manager.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/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 int routing_id, 76 int routing_id,
77 int main_frame_routing_id) { 77 int main_frame_routing_id) {
78 // Create a RenderViewHost, once we have an instance. It is important to 78 // Create a RenderViewHost, once we have an instance. It is important to
79 // immediately give this SiteInstance to a RenderViewHost so that it is 79 // immediately give this SiteInstance to a RenderViewHost so that it is
80 // ref counted. 80 // ref counted.
81 if (!site_instance) 81 if (!site_instance)
82 site_instance = SiteInstance::Create(browser_context); 82 site_instance = SiteInstance::Create(browser_context);
83 render_view_host_ = static_cast<RenderViewHostImpl*>( 83 render_view_host_ = static_cast<RenderViewHostImpl*>(
84 RenderViewHostFactory::Create( 84 RenderViewHostFactory::Create(
85 site_instance, render_view_delegate_, render_widget_delegate_, 85 site_instance, render_view_delegate_, render_widget_delegate_,
86 routing_id, main_frame_routing_id, false, delegate_-> 86 routing_id, main_frame_routing_id, false));
87 GetControllerForRenderManager().GetSessionStorageNamespace(
88 site_instance)));
89 87
90 // Keep track of renderer processes as they start to shut down or are 88 // Keep track of renderer processes as they start to shut down or are
91 // crashed/killed. 89 // crashed/killed.
92 registrar_.Add(this, NOTIFICATION_RENDERER_PROCESS_CLOSED, 90 registrar_.Add(this, NOTIFICATION_RENDERER_PROCESS_CLOSED,
93 NotificationService::AllSources()); 91 NotificationService::AllSources());
94 registrar_.Add(this, NOTIFICATION_RENDERER_PROCESS_CLOSING, 92 registrar_.Add(this, NOTIFICATION_RENDERER_PROCESS_CLOSING,
95 NotificationService::AllSources()); 93 NotificationService::AllSources());
96 } 94 }
97 95
98 RenderViewHostImpl* RenderViewHostManager::current_host() const { 96 RenderViewHostImpl* RenderViewHostManager::current_host() const {
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 RenderViewHostImpl* new_render_view_host = static_cast<RenderViewHostImpl*>( 652 RenderViewHostImpl* new_render_view_host = static_cast<RenderViewHostImpl*>(
655 GetSwappedOutRenderViewHost(instance)); 653 GetSwappedOutRenderViewHost(instance));
656 if (new_render_view_host) { 654 if (new_render_view_host) {
657 // Prevent the process from exiting while we're trying to use it. 655 // Prevent the process from exiting while we're trying to use it.
658 if (!swapped_out) 656 if (!swapped_out)
659 new_render_view_host->GetProcess()->AddPendingView(); 657 new_render_view_host->GetProcess()->AddPendingView();
660 } else { 658 } else {
661 // Create a new RenderViewHost if we don't find an existing one. 659 // Create a new RenderViewHost if we don't find an existing one.
662 new_render_view_host = static_cast<RenderViewHostImpl*>( 660 new_render_view_host = static_cast<RenderViewHostImpl*>(
663 RenderViewHostFactory::Create(instance, 661 RenderViewHostFactory::Create(instance,
664 render_view_delegate_, render_widget_delegate_, MSG_ROUTING_NONE, 662 render_view_delegate_,
665 MSG_ROUTING_NONE, swapped_out, delegate_-> 663 render_widget_delegate_,
666 GetControllerForRenderManager().GetSessionStorageNamespace( 664 MSG_ROUTING_NONE,
667 instance))); 665 MSG_ROUTING_NONE,
666 swapped_out));
668 667
669 // If the new RVH is swapped out already, store it. Otherwise prevent the 668 // If the new RVH is swapped out already, store it. Otherwise prevent the
670 // process from exiting while we're trying to navigate in it. 669 // process from exiting while we're trying to navigate in it.
671 if (swapped_out) { 670 if (swapped_out) {
672 swapped_out_hosts_[instance->GetId()] = new_render_view_host; 671 swapped_out_hosts_[instance->GetId()] = new_render_view_host;
673 } else { 672 } else {
674 new_render_view_host->GetProcess()->AddPendingView(); 673 new_render_view_host->GetProcess()->AddPendingView();
675 } 674 }
676 675
677 bool success = InitRenderView(new_render_view_host, opener_route_id); 676 bool success = InitRenderView(new_render_view_host, opener_route_id);
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
1055 RenderViewHostImpl* RenderViewHostManager::GetSwappedOutRenderViewHost( 1054 RenderViewHostImpl* RenderViewHostManager::GetSwappedOutRenderViewHost(
1056 SiteInstance* instance) { 1055 SiteInstance* instance) {
1057 RenderViewHostMap::iterator iter = swapped_out_hosts_.find(instance->GetId()); 1056 RenderViewHostMap::iterator iter = swapped_out_hosts_.find(instance->GetId());
1058 if (iter != swapped_out_hosts_.end()) 1057 if (iter != swapped_out_hosts_.end())
1059 return iter->second; 1058 return iter->second;
1060 1059
1061 return NULL; 1060 return NULL;
1062 } 1061 }
1063 1062
1064 } // namespace content 1063 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/interstitial_page_impl.cc ('k') | content/browser/web_contents/web_contents_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698