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

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

Issue 1903663004: IPC: Fix attachment brokering race condition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase (scoped_ptr->std::unique_ptr) 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
« no previous file with comments | « content/child/child_thread_impl.cc ('k') | ipc/attachment_broker_mac_unittest.cc » ('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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 filter->OnFilterAdded(channel_.get()); 126 filter->OnFilterAdded(channel_.get());
127 } 127 }
128 128
129 void ChildProcessHostImpl::ForceShutdown() { 129 void ChildProcessHostImpl::ForceShutdown() {
130 Send(new ChildProcessMsg_Shutdown()); 130 Send(new ChildProcessMsg_Shutdown());
131 } 131 }
132 132
133 std::string ChildProcessHostImpl::CreateChannel() { 133 std::string ChildProcessHostImpl::CreateChannel() {
134 channel_id_ = IPC::Channel::GenerateVerifiedChannelID(std::string()); 134 channel_id_ = IPC::Channel::GenerateVerifiedChannelID(std::string());
135 channel_ = IPC::Channel::CreateServer(channel_id_, this); 135 channel_ = IPC::Channel::CreateServer(channel_id_, this);
136 if (!channel_->Connect())
137 return std::string();
138 #if USE_ATTACHMENT_BROKER 136 #if USE_ATTACHMENT_BROKER
139 IPC::AttachmentBroker::GetGlobal()->RegisterCommunicationChannel( 137 IPC::AttachmentBroker::GetGlobal()->RegisterCommunicationChannel(
140 channel_.get(), base::MessageLoopForIO::current()->task_runner()); 138 channel_.get(), base::MessageLoopForIO::current()->task_runner());
141 #endif 139 #endif
140 if (!channel_->Connect()) {
141 #if USE_ATTACHMENT_BROKER
142 IPC::AttachmentBroker::GetGlobal()->DeregisterCommunicationChannel(
143 channel_.get());
144 #endif
145 return std::string();
146 }
142 147
143 for (size_t i = 0; i < filters_.size(); ++i) 148 for (size_t i = 0; i < filters_.size(); ++i)
144 filters_[i]->OnFilterAdded(channel_.get()); 149 filters_[i]->OnFilterAdded(channel_.get());
145 150
146 // Make sure these messages get sent first. 151 // Make sure these messages get sent first.
147 #if defined(IPC_MESSAGE_LOG_ENABLED) 152 #if defined(IPC_MESSAGE_LOG_ENABLED)
148 bool enabled = IPC::Logging::GetInstance()->Enabled(); 153 bool enabled = IPC::Logging::GetInstance()->Enabled();
149 Send(new ChildProcessMsg_SetIPCLoggingEnabled(enabled)); 154 Send(new ChildProcessMsg_SetIPCLoggingEnabled(enabled));
150 #endif 155 #endif
151 156
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 } 329 }
325 330
326 void ChildProcessHostImpl::OnDeletedGpuMemoryBuffer( 331 void ChildProcessHostImpl::OnDeletedGpuMemoryBuffer(
327 gfx::GpuMemoryBufferId id, 332 gfx::GpuMemoryBufferId id,
328 const gpu::SyncToken& sync_token) { 333 const gpu::SyncToken& sync_token) {
329 // Note: Nothing to do here as ownership of shared memory backed 334 // Note: Nothing to do here as ownership of shared memory backed
330 // GpuMemoryBuffers is passed with IPC. 335 // GpuMemoryBuffers is passed with IPC.
331 } 336 }
332 337
333 } // namespace content 338 } // namespace content
OLDNEW
« no previous file with comments | « content/child/child_thread_impl.cc ('k') | ipc/attachment_broker_mac_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698