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 { | 636 ObserverListBase<RenderViewHostObserver>::Iterator it(observers_); |
637 // delegate_->OnMessageReceived can end up deleting |this|, in which case | 637 RenderViewHostObserver* observer; |
638 // the destructor for ObserverListBase::Iterator would access the deleted | 638 while ((observer = it.GetNext()) != NULL) { |
639 // observers_. | 639 if (observer->OnMessageReceived(msg)) |
640 ObserverListBase<RenderViewHostObserver>::Iterator it(observers_); | 640 return true; |
641 RenderViewHostObserver* observer; | |
642 while ((observer = it.GetNext()) != NULL) | |
643 if (observer->OnMessageReceived(msg)) | |
644 return true; | |
645 } | 641 } |
646 | 642 |
647 if (delegate_->OnMessageReceived(msg)) | 643 if (delegate_->OnMessageReceived(msg)) |
648 return true; | 644 return true; |
649 | 645 |
650 bool handled = true; | 646 bool handled = true; |
651 bool msg_is_ok = true; | 647 bool msg_is_ok = true; |
652 IPC_BEGIN_MESSAGE_MAP_EX(RenderViewHost, msg, msg_is_ok) | 648 IPC_BEGIN_MESSAGE_MAP_EX(RenderViewHost, msg, msg_is_ok) |
653 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowView, OnMsgShowView) | 649 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowView, OnMsgShowView) |
654 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowWidget, OnMsgShowWidget) | 650 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowWidget, OnMsgShowWidget) |
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1316 if (view) { | 1312 if (view) { |
1317 view->ShowPopupMenu(params.bounds, | 1313 view->ShowPopupMenu(params.bounds, |
1318 params.item_height, | 1314 params.item_height, |
1319 params.item_font_size, | 1315 params.item_font_size, |
1320 params.selected_item, | 1316 params.selected_item, |
1321 params.popup_items, | 1317 params.popup_items, |
1322 params.right_aligned); | 1318 params.right_aligned); |
1323 } | 1319 } |
1324 } | 1320 } |
1325 #endif | 1321 #endif |
OLD | NEW |