OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser/renderer_host/render_view_host.h" | 5 #include "content/browser/renderer_host/render_view_host.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 bool RenderViewHost::OnMessageReceived(const IPC::Message& msg) { | 626 bool RenderViewHost::OnMessageReceived(const IPC::Message& msg) { |
627 if (!BrowserMessageFilter::CheckCanDispatchOnUI(msg, this)) | 627 if (!BrowserMessageFilter::CheckCanDispatchOnUI(msg, this)) |
628 return true; | 628 return true; |
629 | 629 |
630 // Filter out most IPC messages if this renderer is swapped out. | 630 // Filter out most IPC messages if this renderer is swapped out. |
631 // We still want to certain ACKs to keep our state consistent. | 631 // We still want to certain ACKs to keep our state consistent. |
632 if (is_swapped_out_) | 632 if (is_swapped_out_) |
633 if (!content::SwappedOutMessages::CanHandleWhileSwappedOut(msg)) | 633 if (!content::SwappedOutMessages::CanHandleWhileSwappedOut(msg)) |
634 return true; | 634 return true; |
635 | 635 |
636 ObserverListBase<RenderViewHostObserver>::Iterator it(observers_); | 636 { |
637 RenderViewHostObserver* observer; | 637 // delegate_->OnMessageReceived can end up deleting |this|, in which case |
638 while ((observer = it.GetNext()) != NULL) { | 638 // the destructor for ObserverListBase::Iterator would access the deleted |
639 if (observer->OnMessageReceived(msg)) | 639 // observers_. |
640 return true; | 640 ObserverListBase<RenderViewHostObserver>::Iterator it(observers_); |
| 641 RenderViewHostObserver* observer; |
| 642 while ((observer = it.GetNext()) != NULL) |
| 643 if (observer->OnMessageReceived(msg)) |
| 644 return true; |
641 } | 645 } |
642 | 646 |
643 if (delegate_->OnMessageReceived(msg)) | 647 if (delegate_->OnMessageReceived(msg)) |
644 return true; | 648 return true; |
645 | 649 |
646 bool handled = true; | 650 bool handled = true; |
647 bool msg_is_ok = true; | 651 bool msg_is_ok = true; |
648 IPC_BEGIN_MESSAGE_MAP_EX(RenderViewHost, msg, msg_is_ok) | 652 IPC_BEGIN_MESSAGE_MAP_EX(RenderViewHost, msg, msg_is_ok) |
649 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowView, OnMsgShowView) | 653 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowView, OnMsgShowView) |
650 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowWidget, OnMsgShowWidget) | 654 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowWidget, OnMsgShowWidget) |
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1312 if (view) { | 1316 if (view) { |
1313 view->ShowPopupMenu(params.bounds, | 1317 view->ShowPopupMenu(params.bounds, |
1314 params.item_height, | 1318 params.item_height, |
1315 params.item_font_size, | 1319 params.item_font_size, |
1316 params.selected_item, | 1320 params.selected_item, |
1317 params.popup_items, | 1321 params.popup_items, |
1318 params.right_aligned); | 1322 params.right_aligned); |
1319 } | 1323 } |
1320 } | 1324 } |
1321 #endif | 1325 #endif |
OLD | NEW |