| 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/public/test/mock_render_process_host.h" | 5 #include "content/public/test/mock_render_process_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 Details<RenderProcessHost::RendererClosedDetails>(&details)); | 75 Details<RenderProcessHost::RendererClosedDetails>(&details)); |
| 76 | 76 |
| 77 for (auto& observer : observers_) | 77 for (auto& observer : observers_) |
| 78 observer.RenderProcessExited(this, details.status, details.exit_code); | 78 observer.RenderProcessExited(this, details.status, details.exit_code); |
| 79 | 79 |
| 80 // Send every routing ID a FrameHostMsg_RenderProcessGone message. To ensure a | 80 // Send every routing ID a FrameHostMsg_RenderProcessGone message. To ensure a |
| 81 // predictable order for unittests which may assert against the order, we sort | 81 // predictable order for unittests which may assert against the order, we sort |
| 82 // the listeners by descending routing ID, instead of using the arbitrary | 82 // the listeners by descending routing ID, instead of using the arbitrary |
| 83 // hash-map order like RenderProcessHostImpl. | 83 // hash-map order like RenderProcessHostImpl. |
| 84 std::vector<std::pair<int32_t, IPC::Listener*>> sorted_listeners_; | 84 std::vector<std::pair<int32_t, IPC::Listener*>> sorted_listeners_; |
| 85 IDMap<IPC::Listener>::iterator iter(&listeners_); | 85 IDMap<IPC::Listener*>::iterator iter(&listeners_); |
| 86 while (!iter.IsAtEnd()) { | 86 while (!iter.IsAtEnd()) { |
| 87 sorted_listeners_.push_back( | 87 sorted_listeners_.push_back( |
| 88 std::make_pair(iter.GetCurrentKey(), iter.GetCurrentValue())); | 88 std::make_pair(iter.GetCurrentKey(), iter.GetCurrentValue())); |
| 89 iter.Advance(); | 89 iter.Advance(); |
| 90 } | 90 } |
| 91 std::sort(sorted_listeners_.rbegin(), sorted_listeners_.rend()); | 91 std::sort(sorted_listeners_.rbegin(), sorted_listeners_.rend()); |
| 92 | 92 |
| 93 for (auto& entry_pair : sorted_listeners_) { | 93 for (auto& entry_pair : sorted_listeners_) { |
| 94 entry_pair.second->OnMessageReceived(FrameHostMsg_RenderProcessGone( | 94 entry_pair.second->OnMessageReceived(FrameHostMsg_RenderProcessGone( |
| 95 entry_pair.first, static_cast<int>(details.status), details.exit_code)); | 95 entry_pair.first, static_cast<int>(details.status), details.exit_code)); |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 for (ScopedVector<MockRenderProcessHost>::iterator it = processes_.begin(); | 384 for (ScopedVector<MockRenderProcessHost>::iterator it = processes_.begin(); |
| 385 it != processes_.end(); ++it) { | 385 it != processes_.end(); ++it) { |
| 386 if (*it == host) { | 386 if (*it == host) { |
| 387 processes_.weak_erase(it); | 387 processes_.weak_erase(it); |
| 388 break; | 388 break; |
| 389 } | 389 } |
| 390 } | 390 } |
| 391 } | 391 } |
| 392 | 392 |
| 393 } // namespace content | 393 } // namespace content |
| OLD | NEW |