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

Side by Side 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 unified diff | Download patch
OLDNEW
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/loader/resource_message_filter.h" 5 #include "content/browser/loader/resource_message_filter.h"
6 6
7 #include "content/browser/appcache/chrome_appcache_service.h" 7 #include "content/browser/appcache/chrome_appcache_service.h"
8 #include "content/browser/fileapi/chrome_blob_storage_context.h" 8 #include "content/browser/fileapi/chrome_blob_storage_context.h"
9 #include "content/browser/host_zoom_level_context.h" 9 #include "content/browser/host_zoom_level_context.h"
10 #include "content/browser/loader/resource_dispatcher_host_impl.h" 10 #include "content/browser/loader/resource_dispatcher_host_impl.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 return get_contexts_callback_.Run(resource_type, origin_pid, resource_context, 57 return get_contexts_callback_.Run(resource_type, origin_pid, resource_context,
58 request_context); 58 request_context);
59 } 59 }
60 60
61 const HostZoomMap* ResourceMessageFilter::GetHostZoomMap() const { 61 const HostZoomMap* ResourceMessageFilter::GetHostZoomMap() const {
62 if (host_zoom_level_context_.get()) 62 if (host_zoom_level_context_.get())
63 return host_zoom_level_context_->GetHostZoomMap(); 63 return host_zoom_level_context_->GetHostZoomMap();
64 return NULL; 64 return NULL;
65 } 65 }
66 66
67 bool ResourceMessageFilter::Send(IPC::Message* message) {
68 if (message->is_sync()) {
69 // We don't support sending synchronous messages from the browser. If we
70 // really needed it, we can make this class derive from SyncMessageFilter
71 // but it seems better to not allow sending synchronous messages from the
72 // 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.
73 NOTREACHED() << "Can't send sync message through ResourceMessageFilter!";
74 return false;
75 }
76
77 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
78 BrowserThread::PostTask(
79 BrowserThread::IO, FROM_HERE,
80 base::Bind(base::IgnoreResult(&ResourceMessageFilter::Send), this,
81 message));
82 return true;
83 }
84
85 if (ResourceDispatcherHostImpl::Get()->SendWithMojoIfPossible(*message,
86 this)) {
87 delete message;
88 return true;
89 }
90
91 return BrowserMessageFilter::Send(message);
92 }
93
67 base::WeakPtr<ResourceMessageFilter> ResourceMessageFilter::GetWeakPtr() { 94 base::WeakPtr<ResourceMessageFilter> ResourceMessageFilter::GetWeakPtr() {
95 DCHECK_CURRENTLY_ON(BrowserThread::IO);
68 return weak_ptr_factory_.GetWeakPtr(); 96 return weak_ptr_factory_.GetWeakPtr();
69 } 97 }
70 98
71 } // namespace content 99 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698