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