Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(527)

Unified Diff: content/browser/loader/resource_message_filter.cc

Issue 1970693002: Use mojo for Chrome Loading, Part 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/loader/resource_message_filter.cc
diff --git a/content/browser/loader/resource_message_filter.cc b/content/browser/loader/resource_message_filter.cc
index 186bf66316ef0ebe2a3f3df44d01520e9d2146bd..3e0613108d1f0fac0d4748eedc89cbe89364187d 100644
--- a/content/browser/loader/resource_message_filter.cc
+++ b/content/browser/loader/resource_message_filter.cc
@@ -64,7 +64,35 @@ const HostZoomMap* ResourceMessageFilter::GetHostZoomMap() const {
return NULL;
}
+bool ResourceMessageFilter::Send(IPC::Message* message) {
+ if (message->is_sync()) {
+ // We don't support sending synchronous messages from the browser. If we
+ // really needed it, we can make this class derive from SyncMessageFilter
+ // but it seems better to not allow sending synchronous messages from the
+ // browser, since it might allow a corrupt/malicious renderer to hang us.
jam 2016/05/13 00:55:05 no need for the second part of this comment, we do
yhirano 2016/05/17 12:38:49 Done.
+ NOTREACHED() << "Can't send sync message through ResourceMessageFilter!";
+ return false;
+ }
+
+ if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE,
+ base::Bind(base::IgnoreResult(&ResourceMessageFilter::Send), this,
+ message));
+ return true;
+ }
+
+ if (ResourceDispatcherHostImpl::Get()->SendWithMojoIfPossible(*message,
+ this)) {
+ delete message;
+ return true;
+ }
+
+ return BrowserMessageFilter::Send(message);
+}
+
base::WeakPtr<ResourceMessageFilter> ResourceMessageFilter::GetWeakPtr() {
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
return weak_ptr_factory_.GetWeakPtr();
}

Powered by Google App Engine
This is Rietveld 408576698