| 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/renderer/render_thread_impl.h" | 5 #include "content/renderer/render_thread_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 941 // In a multi-process mode, we immediately exit the renderer. | 941 // In a multi-process mode, we immediately exit the renderer. |
| 942 // Historically we had a graceful shutdown sequence here but it was | 942 // Historically we had a graceful shutdown sequence here but it was |
| 943 // 1) a waste of performance and 2) a source of lots of complicated | 943 // 1) a waste of performance and 2) a source of lots of complicated |
| 944 // crashes caused by shutdown ordering. Immediate exit eliminates | 944 // crashes caused by shutdown ordering. Immediate exit eliminates |
| 945 // those problems. | 945 // those problems. |
| 946 // | 946 // |
| 947 // In a single-process mode, we cannot call _exit(0) in Shutdown() because | 947 // In a single-process mode, we cannot call _exit(0) in Shutdown() because |
| 948 // it will exit the process before the browser side is ready to exit. | 948 // it will exit the process before the browser side is ready to exit. |
| 949 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 949 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 950 switches::kSingleProcess)) | 950 switches::kSingleProcess)) |
| 951 _exit(0); | 951 base::Process::Current().TerminateCurrentProcessImmediately(0); |
| 952 } | 952 } |
| 953 | 953 |
| 954 bool RenderThreadImpl::ShouldBeDestroyed() { | 954 bool RenderThreadImpl::ShouldBeDestroyed() { |
| 955 DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( | 955 DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 956 switches::kSingleProcess)); | 956 switches::kSingleProcess)); |
| 957 // In a single-process mode, it is unsafe to destruct this renderer thread | 957 // In a single-process mode, it is unsafe to destruct this renderer thread |
| 958 // because we haven't run the shutdown sequence. Hence we leak the render | 958 // because we haven't run the shutdown sequence. Hence we leak the render |
| 959 // thread. | 959 // thread. |
| 960 // | 960 // |
| 961 // In this case, we also need to disable at-exit callbacks because some of | 961 // In this case, we also need to disable at-exit callbacks because some of |
| (...skipping 1459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2421 } | 2421 } |
| 2422 } | 2422 } |
| 2423 | 2423 |
| 2424 void RenderThreadImpl::OnRendererInterfaceRequest( | 2424 void RenderThreadImpl::OnRendererInterfaceRequest( |
| 2425 mojom::RendererAssociatedRequest request) { | 2425 mojom::RendererAssociatedRequest request) { |
| 2426 DCHECK(!renderer_binding_.is_bound()); | 2426 DCHECK(!renderer_binding_.is_bound()); |
| 2427 renderer_binding_.Bind(std::move(request)); | 2427 renderer_binding_.Bind(std::move(request)); |
| 2428 } | 2428 } |
| 2429 | 2429 |
| 2430 } // namespace content | 2430 } // namespace content |
| OLD | NEW |