OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 // Represents the browser side of the browser <--> renderer communication | 5 // Represents the browser side of the browser <--> renderer communication |
6 // channel. There will be one RenderProcessHost per renderer process. | 6 // channel. There will be one RenderProcessHost per renderer process. |
7 | 7 |
8 #include "content/browser/renderer_host/render_process_host_impl.h" | 8 #include "content/browser/renderer_host/render_process_host_impl.h" |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 2090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2101 | 2101 |
2102 // Look up the map of site to process for the given browser_context, | 2102 // Look up the map of site to process for the given browser_context, |
2103 // in case we need to remove this process from it. It will be registered | 2103 // in case we need to remove this process from it. It will be registered |
2104 // under any sites it rendered that use process-per-site mode. | 2104 // under any sites it rendered that use process-per-site mode. |
2105 SiteProcessMap* map = | 2105 SiteProcessMap* map = |
2106 GetSiteProcessMapForBrowserContext(host->GetBrowserContext()); | 2106 GetSiteProcessMapForBrowserContext(host->GetBrowserContext()); |
2107 map->RemoveProcess(host); | 2107 map->RemoveProcess(host); |
2108 } | 2108 } |
2109 | 2109 |
2110 // static | 2110 // static |
2111 void RenderProcessHostImpl::CheckAllTerminated() { | |
2112 iterator iter(AllHostsIterator()); | |
2113 while (!iter.IsAtEnd()) { | |
2114 // The leftover hosts must have reset IPC channel and getting deleted soon. | |
2115 RenderProcessHostImpl* host = | |
2116 static_cast<RenderProcessHostImpl*>(iter.GetCurrentValue()); | |
2117 CHECK(host->listeners_.IsEmpty()); | |
2118 CHECK_EQ(0, host->worker_ref_count_); | |
2119 CHECK(!host->channel_); | |
2120 CHECK(host->deleting_soon_); | |
2121 } | |
2122 } | |
2123 | |
2124 // static | |
2125 void RenderProcessHostImpl::FilterURL(RenderProcessHost* rph, | 2111 void RenderProcessHostImpl::FilterURL(RenderProcessHost* rph, |
2126 bool empty_allowed, | 2112 bool empty_allowed, |
2127 GURL* url) { | 2113 GURL* url) { |
2128 ChildProcessSecurityPolicyImpl* policy = | 2114 ChildProcessSecurityPolicyImpl* policy = |
2129 ChildProcessSecurityPolicyImpl::GetInstance(); | 2115 ChildProcessSecurityPolicyImpl::GetInstance(); |
2130 | 2116 |
2131 if (empty_allowed && url->is_empty()) | 2117 if (empty_allowed && url->is_empty()) |
2132 return; | 2118 return; |
2133 | 2119 |
2134 if (!url->is_valid()) { | 2120 if (!url->is_valid()) { |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2778 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; | 2764 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; |
2779 | 2765 |
2780 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias | 2766 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias |
2781 // enough information here so that we can determine what the bad message was. | 2767 // enough information here so that we can determine what the bad message was. |
2782 base::debug::Alias(&error); | 2768 base::debug::Alias(&error); |
2783 bad_message::ReceivedBadMessage(process.get(), | 2769 bad_message::ReceivedBadMessage(process.get(), |
2784 bad_message::RPH_MOJO_PROCESS_ERROR); | 2770 bad_message::RPH_MOJO_PROCESS_ERROR); |
2785 } | 2771 } |
2786 | 2772 |
2787 } // namespace content | 2773 } // namespace content |
OLD | NEW |