Skip to content

Commit e243822

Browse files
committed
use correct dispatcher host to receive and send messages
1 parent 2380387 commit e243822

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/api/dispatcher_host.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include "content/nw/src/shell_browser_context.h"
3939
#include "content/nw/src/nw_shell.h"
4040
#include "content/public/browser/render_process_host.h"
41+
#include "content/public/browser/render_view_host.h"
4142

4243
using content::WebContents;
4344
using content::ShellBrowserContext;
@@ -94,10 +95,13 @@ void DispatcherHost::SendEvent(Base* object,
9495
}
9596

9697
bool DispatcherHost::Send(IPC::Message* message) {
97-
return content::WebContentsObserver::Send(message);
98+
return render_view_host_->Send(message);
9899
}
99100

100-
bool DispatcherHost::OnMessageReceived(const IPC::Message& message) {
101+
bool DispatcherHost::OnMessageReceived(content::RenderViewHost* render_view_host,
102+
const IPC::Message& message) {
103+
if (render_view_host != render_view_host_)
104+
return false;
101105
bool handled = true;
102106
base::ThreadRestrictions::ScopedAllowIO allow_io;
103107
base::ThreadRestrictions::ScopedAllowWait allow_wait;

src/api/dispatcher_host.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class DispatcherHost : public content::WebContentsObserver {
8989

9090
// RenderViewHostObserver implementation.
9191
// WebContentsObserver implementation:
92-
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
92+
virtual bool OnMessageReceived(content::RenderViewHost* render_view_host, const IPC::Message& message) OVERRIDE;
9393

9494
void OnAllocateObject(int object_id,
9595
const std::string& type,

0 commit comments

Comments
 (0)