Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/child/child_thread_impl.h" | 5 #include "content/child/child_thread_impl.h" |
| 6 | 6 |
| 7 #include <signal.h> | 7 #include <signal.h> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 364 // We must make sure to instantiate the IPC Logger *before* we create the | 364 // We must make sure to instantiate the IPC Logger *before* we create the |
| 365 // channel, otherwise we can get a callback on the IO thread which creates | 365 // channel, otherwise we can get a callback on the IO thread which creates |
| 366 // the logger, and the logger does not like being created on the IO thread. | 366 // the logger, and the logger does not like being created on the IO thread. |
| 367 IPC::Logging::GetInstance(); | 367 IPC::Logging::GetInstance(); |
| 368 #endif | 368 #endif |
| 369 | 369 |
| 370 #if USE_ATTACHMENT_BROKER | 370 #if USE_ATTACHMENT_BROKER |
| 371 // The only reason a global would already exist is if the thread is being run | 371 // The only reason a global would already exist is if the thread is being run |
| 372 // in the browser process because of a command line switch. | 372 // in the browser process because of a command line switch. |
| 373 if (!IPC::AttachmentBroker::GetGlobal()) { | 373 if (!IPC::AttachmentBroker::GetGlobal()) { |
| 374 attachment_broker_.reset( | 374 // Intentionally leak the attachment broker so that it is never destroyed. |
|
Avi (use Gerrit)
2016/02/06 07:03:40
Mention _why_ you leak it, not just that you do.
| |
| 375 IPC::AttachmentBrokerUnprivileged::CreateBroker().release()); | 375 attachment_broker_ = |
| 376 IPC::AttachmentBrokerUnprivileged::CreateBroker().release(); | |
| 376 } | 377 } |
| 377 #endif | 378 #endif |
| 378 | 379 |
| 379 channel_ = | 380 channel_ = |
| 380 IPC::SyncChannel::Create(this, ChildProcess::current()->io_task_runner(), | 381 IPC::SyncChannel::Create(this, ChildProcess::current()->io_task_runner(), |
| 381 ChildProcess::current()->GetShutDownEvent()); | 382 ChildProcess::current()->GetShutDownEvent()); |
| 382 #ifdef IPC_MESSAGE_LOG_ENABLED | 383 #ifdef IPC_MESSAGE_LOG_ENABLED |
| 383 if (!IsInBrowserProcess()) | 384 if (!IsInBrowserProcess()) |
| 384 IPC::Logging::GetInstance()->SetIPCSender(this); | 385 IPC::Logging::GetInstance()->SetIPCSender(this); |
| 385 #endif | 386 #endif |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 732 void ChildThreadImpl::EnsureConnected() { | 733 void ChildThreadImpl::EnsureConnected() { |
| 733 VLOG(0) << "ChildThreadImpl::EnsureConnected()"; | 734 VLOG(0) << "ChildThreadImpl::EnsureConnected()"; |
| 734 base::Process::Current().Terminate(0, false); | 735 base::Process::Current().Terminate(0, false); |
| 735 } | 736 } |
| 736 | 737 |
| 737 bool ChildThreadImpl::IsInBrowserProcess() const { | 738 bool ChildThreadImpl::IsInBrowserProcess() const { |
| 738 return browser_process_io_runner_; | 739 return browser_process_io_runner_; |
| 739 } | 740 } |
| 740 | 741 |
| 741 } // namespace content | 742 } // namespace content |
| OLD | NEW |