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