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

Side by Side Diff: content/public/browser/browser_message_filter.cc

Issue 2164783005: Adds BrowserAssociatedInterface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@early-channel-setup
Patch Set: no CONTENT_EXPORT Created 4 years, 4 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
« no previous file with comments | « content/public/browser/browser_message_filter.h ('k') | content/test/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/public/browser/browser_message_filter.h" 5 #include "content/public/browser/browser_message_filter.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/dump_without_crashing.h" 10 #include "base/debug/dump_without_crashing.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 const uint32_t* message_classes_to_filter, 107 const uint32_t* message_classes_to_filter,
108 size_t num_message_classes_to_filter) 108 size_t num_message_classes_to_filter)
109 : internal_(nullptr), 109 : internal_(nullptr),
110 sender_(nullptr), 110 sender_(nullptr),
111 message_classes_to_filter_( 111 message_classes_to_filter_(
112 message_classes_to_filter, 112 message_classes_to_filter,
113 message_classes_to_filter + num_message_classes_to_filter) { 113 message_classes_to_filter + num_message_classes_to_filter) {
114 DCHECK(num_message_classes_to_filter); 114 DCHECK(num_message_classes_to_filter);
115 } 115 }
116 116
117 void BrowserMessageFilter::AddAssociatedInterface(
118 const std::string& name,
119 const IPC::ChannelProxy::GenericAssociatedInterfaceFactory& factory) {
120 associated_interfaces_.emplace_back(name, factory);
121 }
122
117 base::ProcessHandle BrowserMessageFilter::PeerHandle() { 123 base::ProcessHandle BrowserMessageFilter::PeerHandle() {
118 return peer_process_.Handle(); 124 return peer_process_.Handle();
119 } 125 }
120 126
121 void BrowserMessageFilter::OnDestruct() const { 127 void BrowserMessageFilter::OnDestruct() const {
122 delete this; 128 delete this;
123 } 129 }
124 130
125 bool BrowserMessageFilter::Send(IPC::Message* message) { 131 bool BrowserMessageFilter::Send(IPC::Message* message) {
126 if (message->is_sync()) { 132 if (message->is_sync()) {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 } 183 }
178 184
179 IPC::MessageFilter* BrowserMessageFilter::GetFilter() { 185 IPC::MessageFilter* BrowserMessageFilter::GetFilter() {
180 // We create this on demand so that if a filter is used in a unit test but 186 // We create this on demand so that if a filter is used in a unit test but
181 // never attached to a channel, we don't leak Internal and this; 187 // never attached to a channel, we don't leak Internal and this;
182 DCHECK(!internal_) << "Should only be called once."; 188 DCHECK(!internal_) << "Should only be called once.";
183 internal_ = new Internal(this); 189 internal_ = new Internal(this);
184 return internal_; 190 return internal_;
185 } 191 }
186 192
193 void BrowserMessageFilter::RegisterAssociatedInterfaces(
194 IPC::ChannelProxy* proxy) {
195 for (const auto& entry : associated_interfaces_)
196 proxy->AddGenericAssociatedInterfaceForIOThread(entry.first, entry.second);
197 associated_interfaces_.clear();
198 }
199
187 } // namespace content 200 } // namespace content
OLDNEW
« no previous file with comments | « content/public/browser/browser_message_filter.h ('k') | content/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698