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

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

Issue 324143002: Decouple IPC::MessageFilter from IPC::Channel (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing compilation errors Created 6 years, 6 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 | Annotate | Revision Log
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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 : delegate_(delegate), 137 : delegate_(delegate),
138 peer_handle_(base::kNullProcessHandle), 138 peer_handle_(base::kNullProcessHandle),
139 opening_channel_(false) { 139 opening_channel_(false) {
140 #if defined(OS_WIN) 140 #if defined(OS_WIN)
141 AddFilter(new FontCacheDispatcher()); 141 AddFilter(new FontCacheDispatcher());
142 #endif 142 #endif
143 } 143 }
144 144
145 ChildProcessHostImpl::~ChildProcessHostImpl() { 145 ChildProcessHostImpl::~ChildProcessHostImpl() {
146 for (size_t i = 0; i < filters_.size(); ++i) { 146 for (size_t i = 0; i < filters_.size(); ++i) {
147 filters_[i]->OnChannelClosing(); 147 filters_[i]->OnSenderClosing();
148 filters_[i]->OnFilterRemoved(); 148 filters_[i]->OnFilterRemoved();
149 } 149 }
150 150
151 base::CloseProcessHandle(peer_handle_); 151 base::CloseProcessHandle(peer_handle_);
152 } 152 }
153 153
154 void ChildProcessHostImpl::AddFilter(IPC::MessageFilter* filter) { 154 void ChildProcessHostImpl::AddFilter(IPC::MessageFilter* filter) {
155 filters_.push_back(filter); 155 filters_.push_back(filter);
156 156
157 if (channel_) 157 if (channel_)
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 271
272 void ChildProcessHostImpl::OnChannelConnected(int32 peer_pid) { 272 void ChildProcessHostImpl::OnChannelConnected(int32 peer_pid) {
273 if (!peer_handle_ && 273 if (!peer_handle_ &&
274 !base::OpenPrivilegedProcessHandle(peer_pid, &peer_handle_) && 274 !base::OpenPrivilegedProcessHandle(peer_pid, &peer_handle_) &&
275 !(peer_handle_ = delegate_->GetHandle())) { 275 !(peer_handle_ = delegate_->GetHandle())) {
276 NOTREACHED(); 276 NOTREACHED();
277 } 277 }
278 opening_channel_ = false; 278 opening_channel_ = false;
279 delegate_->OnChannelConnected(peer_pid); 279 delegate_->OnChannelConnected(peer_pid);
280 for (size_t i = 0; i < filters_.size(); ++i) 280 for (size_t i = 0; i < filters_.size(); ++i)
281 filters_[i]->OnChannelConnected(peer_pid); 281 filters_[i]->OnSenderConnected();
282 } 282 }
283 283
284 void ChildProcessHostImpl::OnChannelError() { 284 void ChildProcessHostImpl::OnChannelError() {
285 opening_channel_ = false; 285 opening_channel_ = false;
286 delegate_->OnChannelError(); 286 delegate_->OnChannelError();
287 287
288 for (size_t i = 0; i < filters_.size(); ++i) 288 for (size_t i = 0; i < filters_.size(); ++i)
289 filters_[i]->OnChannelError(); 289 filters_[i]->OnSenderError();
290 290
291 // This will delete host_, which will also destroy this! 291 // This will delete host_, which will also destroy this!
292 delegate_->OnChildDisconnected(); 292 delegate_->OnChildDisconnected();
293 } 293 }
294 294
295 void ChildProcessHostImpl::OnBadMessageReceived(const IPC::Message& message) { 295 void ChildProcessHostImpl::OnBadMessageReceived(const IPC::Message& message) {
296 delegate_->OnBadMessageReceived(message); 296 delegate_->OnBadMessageReceived(message);
297 } 297 }
298 298
299 void ChildProcessHostImpl::OnAllocateSharedMemory( 299 void ChildProcessHostImpl::OnAllocateSharedMemory(
(...skipping 14 matching lines...) Expand all
314 uint32 usage, 314 uint32 usage,
315 gfx::GpuMemoryBufferHandle* handle) { 315 gfx::GpuMemoryBufferHandle* handle) {
316 handle->type = gfx::SHARED_MEMORY_BUFFER; 316 handle->type = gfx::SHARED_MEMORY_BUFFER;
317 AllocateSharedMemory( 317 AllocateSharedMemory(
318 width * height * GpuMemoryBufferImpl::BytesPerPixel(internalformat), 318 width * height * GpuMemoryBufferImpl::BytesPerPixel(internalformat),
319 peer_handle_, 319 peer_handle_,
320 &handle->handle); 320 &handle->handle);
321 } 321 }
322 322
323 } // namespace content 323 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698