| 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 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 // In a multi-process mode, we immediately exit the renderer. | 915 // In a multi-process mode, we immediately exit the renderer. |
| 916 // Historically we had a graceful shutdown sequence here but it was | 916 // Historically we had a graceful shutdown sequence here but it was |
| 917 // 1) a waste of performance and 2) a source of lots of complicated | 917 // 1) a waste of performance and 2) a source of lots of complicated |
| 918 // crashes caused by shutdown ordering. Immediate exit eliminates | 918 // crashes caused by shutdown ordering. Immediate exit eliminates |
| 919 // those problems. | 919 // those problems. |
| 920 // | 920 // |
| 921 // In a single-process mode, we cannot call _exit(0) in Shutdown() because | 921 // In a single-process mode, we cannot call _exit(0) in Shutdown() because |
| 922 // it will exit the process before the browser side is ready to exit. | 922 // it will exit the process before the browser side is ready to exit. |
| 923 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 923 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 924 switches::kSingleProcess)) | 924 switches::kSingleProcess)) |
| 925 _exit(0); | 925 base::Process::TerminateCurrentProcessImmediately(0); |
| 926 } | 926 } |
| 927 | 927 |
| 928 bool RenderThreadImpl::ShouldBeDestroyed() { | 928 bool RenderThreadImpl::ShouldBeDestroyed() { |
| 929 DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( | 929 DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 930 switches::kSingleProcess)); | 930 switches::kSingleProcess)); |
| 931 // In a single-process mode, it is unsafe to destruct this renderer thread | 931 // In a single-process mode, it is unsafe to destruct this renderer thread |
| 932 // because we haven't run the shutdown sequence. Hence we leak the render | 932 // because we haven't run the shutdown sequence. Hence we leak the render |
| 933 // thread. | 933 // thread. |
| 934 // | 934 // |
| 935 // In this case, we also need to disable at-exit callbacks because some of | 935 // In this case, we also need to disable at-exit callbacks because some of |
| (...skipping 1501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2437 } | 2437 } |
| 2438 } | 2438 } |
| 2439 | 2439 |
| 2440 void RenderThreadImpl::OnRendererInterfaceRequest( | 2440 void RenderThreadImpl::OnRendererInterfaceRequest( |
| 2441 mojom::RendererAssociatedRequest request) { | 2441 mojom::RendererAssociatedRequest request) { |
| 2442 DCHECK(!renderer_binding_.is_bound()); | 2442 DCHECK(!renderer_binding_.is_bound()); |
| 2443 renderer_binding_.Bind(std::move(request)); | 2443 renderer_binding_.Bind(std::move(request)); |
| 2444 } | 2444 } |
| 2445 | 2445 |
| 2446 } // namespace content | 2446 } // namespace content |
| OLD | NEW |