| 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 2727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2738 // it. Memory that is not actualy used won't be physically mapped by the | 2738 // it. Memory that is not actualy used won't be physically mapped by the |
| 2739 // system. RendererMetrics usage, as reported in UMA, peaked around 0.7MiB | 2739 // system. RendererMetrics usage, as reported in UMA, peaked around 0.7MiB |
| 2740 // as of 2016-12-20. | 2740 // as of 2016-12-20. |
| 2741 std::unique_ptr<base::SharedMemory> shm(new base::SharedMemory()); | 2741 std::unique_ptr<base::SharedMemory> shm(new base::SharedMemory()); |
| 2742 if (!shm->CreateAndMapAnonymous(2 << 20)) // 2 MiB | 2742 if (!shm->CreateAndMapAnonymous(2 << 20)) // 2 MiB |
| 2743 return; | 2743 return; |
| 2744 metrics_allocator_.reset(new base::SharedPersistentMemoryAllocator( | 2744 metrics_allocator_.reset(new base::SharedPersistentMemoryAllocator( |
| 2745 std::move(shm), GetID(), "RendererMetrics", /*readonly=*/false)); | 2745 std::move(shm), GetID(), "RendererMetrics", /*readonly=*/false)); |
| 2746 } | 2746 } |
| 2747 | 2747 |
| 2748 base::SharedMemoryHandle shm_handle; | 2748 base::SharedMemoryHandle shm_handle = |
| 2749 metrics_allocator_->shared_memory()->ShareToProcess(destination, &shm_handle); | 2749 metrics_allocator_->shared_memory()->handle().Duplicate(); |
| 2750 Send(new ChildProcessMsg_SetHistogramMemory( | 2750 Send(new ChildProcessMsg_SetHistogramMemory( |
| 2751 shm_handle, metrics_allocator_->shared_memory()->mapped_size())); | 2751 shm_handle, metrics_allocator_->shared_memory()->mapped_size())); |
| 2752 } | 2752 } |
| 2753 | 2753 |
| 2754 void RenderProcessHostImpl::ProcessDied(bool already_dead, | 2754 void RenderProcessHostImpl::ProcessDied(bool already_dead, |
| 2755 RendererClosedDetails* known_details) { | 2755 RendererClosedDetails* known_details) { |
| 2756 // Our child process has died. If we didn't expect it, it's a crash. | 2756 // Our child process has died. If we didn't expect it, it's a crash. |
| 2757 // In any case, we need to let everyone know it's gone. | 2757 // In any case, we need to let everyone know it's gone. |
| 2758 // The OnChannelError notification can fire multiple times due to nested sync | 2758 // The OnChannelError notification can fire multiple times due to nested sync |
| 2759 // calls to a renderer. If we don't have a valid channel here it means we | 2759 // calls to a renderer. If we don't have a valid channel here it means we |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3130 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; | 3130 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; |
| 3131 | 3131 |
| 3132 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. | 3132 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. |
| 3133 // Capture the error message in a crash key value. | 3133 // Capture the error message in a crash key value. |
| 3134 base::debug::ScopedCrashKey error_key_value("mojo-message-error", error); | 3134 base::debug::ScopedCrashKey error_key_value("mojo-message-error", error); |
| 3135 bad_message::ReceivedBadMessage(render_process_id, | 3135 bad_message::ReceivedBadMessage(render_process_id, |
| 3136 bad_message::RPH_MOJO_PROCESS_ERROR); | 3136 bad_message::RPH_MOJO_PROCESS_ERROR); |
| 3137 } | 3137 } |
| 3138 | 3138 |
| 3139 } // namespace content | 3139 } // namespace content |
| OLD | NEW |