Chromium Code Reviews| 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. |
|
nasko
2013/07/10 17:29:00
nit: Update the comment to include that we track c
Fady Samuel
2013/07/10 17:51:33
Done.
| |
| 91 registrar_.Add(this, NOTIFICATION_RENDERER_PROCESS_CLOSED, | |
| 92 NotificationService::AllSources()); | |
| 91 registrar_.Add(this, NOTIFICATION_RENDERER_PROCESS_CLOSING, | 93 registrar_.Add(this, NOTIFICATION_RENDERER_PROCESS_CLOSING, |
| 92 NotificationService::AllSources()); | 94 NotificationService::AllSources()); |
| 93 } | 95 } |
| 94 | 96 |
| 95 RenderViewHostImpl* RenderViewHostManager::current_host() const { | 97 RenderViewHostImpl* RenderViewHostManager::current_host() const { |
| 96 return render_view_host_; | 98 return render_view_host_; |
| 97 } | 99 } |
| 98 | 100 |
| 99 RenderViewHostImpl* RenderViewHostManager::pending_render_view_host() const { | 101 RenderViewHostImpl* RenderViewHostManager::pending_render_view_host() const { |
| 100 return pending_render_view_host_; | 102 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 | 392 // navigation. Thus, we no longer need to remember that the RenderViewHost |
| 391 // is part of a pending cross-site request. | 393 // is part of a pending cross-site request. |
| 392 pending_render_view_host_->SetHasPendingCrossSiteRequest(false); | 394 pending_render_view_host_->SetHasPendingCrossSiteRequest(false); |
| 393 } | 395 } |
| 394 | 396 |
| 395 void RenderViewHostManager::Observe( | 397 void RenderViewHostManager::Observe( |
| 396 int type, | 398 int type, |
| 397 const NotificationSource& source, | 399 const NotificationSource& source, |
| 398 const NotificationDetails& details) { | 400 const NotificationDetails& details) { |
| 399 switch (type) { | 401 switch (type) { |
| 402 case NOTIFICATION_RENDERER_PROCESS_CLOSED: | |
| 400 case NOTIFICATION_RENDERER_PROCESS_CLOSING: | 403 case NOTIFICATION_RENDERER_PROCESS_CLOSING: |
| 401 RendererProcessClosing( | 404 RendererProcessClosing( |
| 402 Source<RenderProcessHost>(source).ptr()); | 405 Source<RenderProcessHost>(source).ptr()); |
| 403 break; | 406 break; |
| 404 | 407 |
| 405 default: | 408 default: |
| 406 NOTREACHED(); | 409 NOTREACHED(); |
| 407 } | 410 } |
| 408 } | 411 } |
| 409 | 412 |
| (...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1004 RenderViewHostImpl* RenderViewHostManager::GetSwappedOutRenderViewHost( | 1007 RenderViewHostImpl* RenderViewHostManager::GetSwappedOutRenderViewHost( |
| 1005 SiteInstance* instance) { | 1008 SiteInstance* instance) { |
| 1006 RenderViewHostMap::iterator iter = swapped_out_hosts_.find(instance->GetId()); | 1009 RenderViewHostMap::iterator iter = swapped_out_hosts_.find(instance->GetId()); |
| 1007 if (iter != swapped_out_hosts_.end()) | 1010 if (iter != swapped_out_hosts_.end()) |
| 1008 return iter->second; | 1011 return iter->second; |
| 1009 | 1012 |
| 1010 return NULL; | 1013 return NULL; |
| 1011 } | 1014 } |
| 1012 | 1015 |
| 1013 } // namespace content | 1016 } // namespace content |
| OLD | NEW |