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/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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, delegate_-> |
87 GetControllerForRenderManager().GetSessionStorageNamespace( | 87 GetControllerForRenderManager().GetSessionStorageNamespace( |
88 site_instance))); | 88 site_instance))); |
89 | 89 |
90 // Keep track of renderer processes as they start to shut down. | 90 // Keep track of renderer processes as they start to shut down or are |
| 91 // crashed/killed. |
| 92 registrar_.Add(this, NOTIFICATION_RENDERER_PROCESS_CLOSED, |
| 93 NotificationService::AllSources()); |
91 registrar_.Add(this, NOTIFICATION_RENDERER_PROCESS_CLOSING, | 94 registrar_.Add(this, NOTIFICATION_RENDERER_PROCESS_CLOSING, |
92 NotificationService::AllSources()); | 95 NotificationService::AllSources()); |
93 } | 96 } |
94 | 97 |
95 RenderViewHostImpl* RenderViewHostManager::current_host() const { | 98 RenderViewHostImpl* RenderViewHostManager::current_host() const { |
96 return render_view_host_; | 99 return render_view_host_; |
97 } | 100 } |
98 | 101 |
99 RenderViewHostImpl* RenderViewHostManager::pending_render_view_host() const { | 102 RenderViewHostImpl* RenderViewHostManager::pending_render_view_host() const { |
100 return pending_render_view_host_; | 103 return pending_render_view_host_; |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 // navigation. Thus, we no longer need to remember that the RenderViewHost | 393 // navigation. Thus, we no longer need to remember that the RenderViewHost |
391 // is part of a pending cross-site request. | 394 // is part of a pending cross-site request. |
392 pending_render_view_host_->SetHasPendingCrossSiteRequest(false); | 395 pending_render_view_host_->SetHasPendingCrossSiteRequest(false); |
393 } | 396 } |
394 | 397 |
395 void RenderViewHostManager::Observe( | 398 void RenderViewHostManager::Observe( |
396 int type, | 399 int type, |
397 const NotificationSource& source, | 400 const NotificationSource& source, |
398 const NotificationDetails& details) { | 401 const NotificationDetails& details) { |
399 switch (type) { | 402 switch (type) { |
| 403 case NOTIFICATION_RENDERER_PROCESS_CLOSED: |
400 case NOTIFICATION_RENDERER_PROCESS_CLOSING: | 404 case NOTIFICATION_RENDERER_PROCESS_CLOSING: |
401 RendererProcessClosing( | 405 RendererProcessClosing( |
402 Source<RenderProcessHost>(source).ptr()); | 406 Source<RenderProcessHost>(source).ptr()); |
403 break; | 407 break; |
404 | 408 |
405 default: | 409 default: |
406 NOTREACHED(); | 410 NOTREACHED(); |
407 } | 411 } |
408 } | 412 } |
409 | 413 |
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1004 RenderViewHostImpl* RenderViewHostManager::GetSwappedOutRenderViewHost( | 1008 RenderViewHostImpl* RenderViewHostManager::GetSwappedOutRenderViewHost( |
1005 SiteInstance* instance) { | 1009 SiteInstance* instance) { |
1006 RenderViewHostMap::iterator iter = swapped_out_hosts_.find(instance->GetId()); | 1010 RenderViewHostMap::iterator iter = swapped_out_hosts_.find(instance->GetId()); |
1007 if (iter != swapped_out_hosts_.end()) | 1011 if (iter != swapped_out_hosts_.end()) |
1008 return iter->second; | 1012 return iter->second; |
1009 | 1013 |
1010 return NULL; | 1014 return NULL; |
1011 } | 1015 } |
1012 | 1016 |
1013 } // namespace content | 1017 } // namespace content |
OLD | NEW |