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 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 NOTREACHED() << "There should be only one RenderProcessHost when running " | 784 NOTREACHED() << "There should be only one RenderProcessHost when running " |
785 << "in-process."; | 785 << "in-process."; |
786 } | 786 } |
787 } | 787 } |
788 | 788 |
789 void RenderProcessHostImpl::RegisterRendererMainThreadFactory( | 789 void RenderProcessHostImpl::RegisterRendererMainThreadFactory( |
790 RendererMainThreadFactoryFunction create) { | 790 RendererMainThreadFactoryFunction create) { |
791 g_renderer_main_thread_factory = create; | 791 g_renderer_main_thread_factory = create; |
792 } | 792 } |
793 | 793 |
| 794 // static |
| 795 // TODO(alokp): Remove after collecting crash data. |
| 796 // Temporary checks to verify that all shared workers are terminated. |
| 797 // It is suspected that shared workers prevent render process hosts |
| 798 // from shutting down: crbug.com/608049 |
| 799 void RenderProcessHostImpl::CheckAllWorkersTerminated() { |
| 800 iterator iter(AllHostsIterator()); |
| 801 while (!iter.IsAtEnd()) { |
| 802 RenderProcessHostImpl* host = |
| 803 static_cast<RenderProcessHostImpl*>(iter.GetCurrentValue()); |
| 804 if (host->worker_ref_count() != 0) { |
| 805 std::string message = base::StringPrintf( |
| 806 "%zu service workers, %zu shared workers", |
| 807 host->service_worker_ref_count_, host->shared_worker_ref_count_); |
| 808 // Use separate CHECKs for better crash report readability. |
| 809 CHECK(host->service_worker_ref_count_ == 0 || |
| 810 host->shared_worker_ref_count_ == 0) |
| 811 << message; |
| 812 CHECK_EQ(0UL, host->service_worker_ref_count_) << message; |
| 813 CHECK_EQ(0UL, host->shared_worker_ref_count_) << message; |
| 814 } |
| 815 |
| 816 iter.Advance(); |
| 817 } |
| 818 } |
| 819 |
794 RenderProcessHostImpl::~RenderProcessHostImpl() { | 820 RenderProcessHostImpl::~RenderProcessHostImpl() { |
795 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 821 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
796 #ifndef NDEBUG | 822 #ifndef NDEBUG |
797 DCHECK(is_self_deleted_) | 823 DCHECK(is_self_deleted_) |
798 << "RenderProcessHostImpl is destroyed by something other than itself"; | 824 << "RenderProcessHostImpl is destroyed by something other than itself"; |
799 #endif | 825 #endif |
800 | 826 |
801 // Make sure to clean up the in-process renderer before the channel, otherwise | 827 // Make sure to clean up the in-process renderer before the channel, otherwise |
802 // it may still run and have its IPCs fail, causing asserts. | 828 // it may still run and have its IPCs fail, causing asserts. |
803 in_process_renderer_.reset(); | 829 in_process_renderer_.reset(); |
(...skipping 2136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2940 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; | 2966 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; |
2941 | 2967 |
2942 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias | 2968 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias |
2943 // enough information here so that we can determine what the bad message was. | 2969 // enough information here so that we can determine what the bad message was. |
2944 base::debug::Alias(&error); | 2970 base::debug::Alias(&error); |
2945 bad_message::ReceivedBadMessage(process.get(), | 2971 bad_message::ReceivedBadMessage(process.get(), |
2946 bad_message::RPH_MOJO_PROCESS_ERROR); | 2972 bad_message::RPH_MOJO_PROCESS_ERROR); |
2947 } | 2973 } |
2948 | 2974 |
2949 } // namespace content | 2975 } // namespace content |
OLD | NEW |