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/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 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 } | 659 } |
660 | 660 |
661 /////////////////////////////////////////////////////////////////////////////// | 661 /////////////////////////////////////////////////////////////////////////////// |
662 // RenderViewHost, IPC message handlers: | 662 // RenderViewHost, IPC message handlers: |
663 | 663 |
664 bool RenderViewHost::OnMessageReceived(const IPC::Message& msg) { | 664 bool RenderViewHost::OnMessageReceived(const IPC::Message& msg) { |
665 if (!BrowserMessageFilter::CheckCanDispatchOnUI(msg, this)) | 665 if (!BrowserMessageFilter::CheckCanDispatchOnUI(msg, this)) |
666 return true; | 666 return true; |
667 | 667 |
668 // Filter out most IPC messages if this renderer is swapped out. | 668 // Filter out most IPC messages if this renderer is swapped out. |
669 // We still want to certain ACKs to keep our state consistent. | 669 // We still want to handle certain ACKs to keep our state consistent. |
670 if (is_swapped_out_) | 670 if (is_swapped_out_) { |
671 if (!content::SwappedOutMessages::CanHandleWhileSwappedOut(msg)) | 671 if (!content::SwappedOutMessages::CanHandleWhileSwappedOut(msg)) { |
| 672 // If this is a synchronous message and we decided not to handle it, |
| 673 // we must send an error reply, or else the renderer will be stuck |
| 674 // and won't respond to future requests. |
| 675 if (msg.is_sync()) { |
| 676 IPC::Message* reply = IPC::SyncMessage::GenerateReply(&msg); |
| 677 reply->set_reply_error(); |
| 678 Send(reply); |
| 679 } |
| 680 // Don't continue looking for someone to handle it. |
672 return true; | 681 return true; |
| 682 } |
| 683 } |
673 | 684 |
674 ObserverListBase<content::RenderViewHostObserver>::Iterator it(observers_); | 685 ObserverListBase<content::RenderViewHostObserver>::Iterator it(observers_); |
675 content::RenderViewHostObserver* observer; | 686 content::RenderViewHostObserver* observer; |
676 while ((observer = it.GetNext()) != NULL) { | 687 while ((observer = it.GetNext()) != NULL) { |
677 if (observer->OnMessageReceived(msg)) | 688 if (observer->OnMessageReceived(msg)) |
678 return true; | 689 return true; |
679 } | 690 } |
680 | 691 |
681 if (delegate_->OnMessageReceived(msg)) | 692 if (delegate_->OnMessageReceived(msg)) |
682 return true; | 693 return true; |
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1534 | 1545 |
1535 void RenderViewHost::OnWebUISend(const GURL& source_url, | 1546 void RenderViewHost::OnWebUISend(const GURL& source_url, |
1536 const std::string& name, | 1547 const std::string& name, |
1537 const base::ListValue& args) { | 1548 const base::ListValue& args) { |
1538 delegate_->WebUISend(this, source_url, name, args); | 1549 delegate_->WebUISend(this, source_url, name, args); |
1539 } | 1550 } |
1540 | 1551 |
1541 void RenderViewHost::ClearPowerSaveBlockers() { | 1552 void RenderViewHost::ClearPowerSaveBlockers() { |
1542 STLDeleteValues(&power_save_blockers_); | 1553 STLDeleteValues(&power_save_blockers_); |
1543 } | 1554 } |
OLD | NEW |