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

Side by Side Diff: content/common/child_process_host_impl.cc

Issue 1260053003: Update contents to use attachment broker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ipc_refactor2
Patch Set: Use new api. Created 5 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/child/child_thread_impl.cc ('k') | content/public/common/child_process_host.h » ('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/common/child_process_host_impl.h" 5 #include "content/common/child_process_host_impl.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/atomic_sequence_num.h" 9 #include "base/atomic_sequence_num.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 // intolerant of a non-executable heap to work properly on 10.7. This 142 // intolerant of a non-executable heap to work properly on 10.7. This
143 // results in Chromium Helper EH.app or Google Chrome Helper EH.app. 143 // results in Chromium Helper EH.app or Google Chrome Helper EH.app.
144 child_path = TransformPathForFeature(child_path, "EH"); 144 child_path = TransformPathForFeature(child_path, "EH");
145 } 145 }
146 #endif 146 #endif
147 147
148 return child_path; 148 return child_path;
149 } 149 }
150 150
151 // static 151 // static
152 IPC::AttachmentBroker* ChildProcessHost::GetAttachmentBroker() { 152 IPC::AttachmentBrokerPrivileged* ChildProcessHost::GetAttachmentBroker() {
153 #if defined(OS_WIN) 153 #if USE_ATTACHMENT_BROKER
154 return &g_attachment_broker.Get(); 154 return &g_attachment_broker.Get();
155 #else 155 #else
156 return nullptr; 156 return nullptr;
157 #endif // defined(OS_WIN) 157 #endif // USE_ATTACHMENT_BROKER
158 } 158 }
159 159
160 ChildProcessHostImpl::ChildProcessHostImpl(ChildProcessHostDelegate* delegate) 160 ChildProcessHostImpl::ChildProcessHostImpl(ChildProcessHostDelegate* delegate)
161 : delegate_(delegate), 161 : delegate_(delegate),
162 opening_channel_(false) { 162 opening_channel_(false) {
163 #if defined(OS_WIN) 163 #if defined(OS_WIN)
164 AddFilter(new FontCacheDispatcher()); 164 AddFilter(new FontCacheDispatcher());
165 #endif 165 #endif
166 } 166 }
167 167
168 ChildProcessHostImpl::~ChildProcessHostImpl() { 168 ChildProcessHostImpl::~ChildProcessHostImpl() {
169 #if USE_ATTACHMENT_BROKER
170 g_attachment_broker.Get().DeregisterCommunicationChannel(channel_.get());
171 #endif
169 for (size_t i = 0; i < filters_.size(); ++i) { 172 for (size_t i = 0; i < filters_.size(); ++i) {
170 filters_[i]->OnChannelClosing(); 173 filters_[i]->OnChannelClosing();
171 filters_[i]->OnFilterRemoved(); 174 filters_[i]->OnFilterRemoved();
172 } 175 }
173 } 176 }
174 177
175 void ChildProcessHostImpl::AddFilter(IPC::MessageFilter* filter) { 178 void ChildProcessHostImpl::AddFilter(IPC::MessageFilter* filter) {
176 filters_.push_back(filter); 179 filters_.push_back(filter);
177 180
178 if (channel_) 181 if (channel_)
179 filter->OnFilterAdded(channel_.get()); 182 filter->OnFilterAdded(channel_.get());
180 } 183 }
181 184
182 void ChildProcessHostImpl::ForceShutdown() { 185 void ChildProcessHostImpl::ForceShutdown() {
183 Send(new ChildProcessMsg_Shutdown()); 186 Send(new ChildProcessMsg_Shutdown());
184 } 187 }
185 188
186 std::string ChildProcessHostImpl::CreateChannel() { 189 std::string ChildProcessHostImpl::CreateChannel() {
187 channel_id_ = IPC::Channel::GenerateVerifiedChannelID(std::string()); 190 channel_id_ = IPC::Channel::GenerateVerifiedChannelID(std::string());
188 channel_ = 191 channel_ =
189 IPC::Channel::CreateServer(channel_id_, this, GetAttachmentBroker()); 192 IPC::Channel::CreateServer(channel_id_, this, GetAttachmentBroker());
190 if (!channel_->Connect()) 193 if (!channel_->Connect())
191 return std::string(); 194 return std::string();
195 #if USE_ATTACHMENT_BROKER
196 g_attachment_broker.Get().RegisterCommunicationChannel(channel_.get());
197 #endif
192 198
193 for (size_t i = 0; i < filters_.size(); ++i) 199 for (size_t i = 0; i < filters_.size(); ++i)
194 filters_[i]->OnFilterAdded(channel_.get()); 200 filters_[i]->OnFilterAdded(channel_.get());
195 201
196 // Make sure these messages get sent first. 202 // Make sure these messages get sent first.
197 #if defined(IPC_MESSAGE_LOG_ENABLED) 203 #if defined(IPC_MESSAGE_LOG_ENABLED)
198 bool enabled = IPC::Logging::GetInstance()->Enabled(); 204 bool enabled = IPC::Logging::GetInstance()->Enabled();
199 Send(new ChildProcessMsg_SetIPCLoggingEnabled(enabled)); 205 Send(new ChildProcessMsg_SetIPCLoggingEnabled(enabled));
200 #endif 206 #endif
201 207
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 } 377 }
372 378
373 void ChildProcessHostImpl::OnDeletedGpuMemoryBuffer( 379 void ChildProcessHostImpl::OnDeletedGpuMemoryBuffer(
374 gfx::GpuMemoryBufferId id, 380 gfx::GpuMemoryBufferId id,
375 uint32 sync_point) { 381 uint32 sync_point) {
376 // Note: Nothing to do here as ownership of shared memory backed 382 // Note: Nothing to do here as ownership of shared memory backed
377 // GpuMemoryBuffers is passed with IPC. 383 // GpuMemoryBuffers is passed with IPC.
378 } 384 }
379 385
380 } // namespace content 386 } // namespace content
OLDNEW
« no previous file with comments | « content/child/child_thread_impl.cc ('k') | content/public/common/child_process_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698