| 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 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 #include "ipc/ipc_switches.h" | 62 #include "ipc/ipc_switches.h" |
| 63 #include "ipc/ipc_sync_channel.h" | 63 #include "ipc/ipc_sync_channel.h" |
| 64 #include "ipc/ipc_sync_message_filter.h" | 64 #include "ipc/ipc_sync_message_filter.h" |
| 65 #include "ipc/mojo/ipc_channel_mojo.h" | 65 #include "ipc/mojo/ipc_channel_mojo.h" |
| 66 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h" | 66 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h" |
| 67 | 67 |
| 68 #if defined(TCMALLOC_TRACE_MEMORY_SUPPORTED) | 68 #if defined(TCMALLOC_TRACE_MEMORY_SUPPORTED) |
| 69 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h" | 69 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h" |
| 70 #endif | 70 #endif |
| 71 | 71 |
| 72 #if defined(OS_MACOSX) | |
| 73 #include "content/child/child_io_surface_manager_mac.h" | |
| 74 #endif | |
| 75 | |
| 76 #if defined(USE_OZONE) | 72 #if defined(USE_OZONE) |
| 77 #include "ui/ozone/public/client_native_pixmap_factory.h" | 73 #include "ui/ozone/public/client_native_pixmap_factory.h" |
| 78 #endif | 74 #endif |
| 79 | 75 |
| 80 #if defined(MOJO_SHELL_CLIENT) | 76 #if defined(MOJO_SHELL_CLIENT) |
| 81 #include "content/common/mojo/mojo_shell_connection_impl.h" | 77 #include "content/common/mojo/mojo_shell_connection_impl.h" |
| 82 #endif | 78 #endif |
| 83 | 79 |
| 84 using tracked_objects::ThreadData; | 80 using tracked_objects::ThreadData; |
| 85 | 81 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 _exit(0); | 167 _exit(0); |
| 172 #endif | 168 #endif |
| 173 } | 169 } |
| 174 | 170 |
| 175 protected: | 171 protected: |
| 176 ~SuicideOnChannelErrorFilter() override {} | 172 ~SuicideOnChannelErrorFilter() override {} |
| 177 }; | 173 }; |
| 178 | 174 |
| 179 #endif // OS(POSIX) | 175 #endif // OS(POSIX) |
| 180 | 176 |
| 181 #if defined(OS_MACOSX) | |
| 182 class IOSurfaceManagerFilter : public IPC::MessageFilter { | |
| 183 public: | |
| 184 // Overridden from IPC::MessageFilter: | |
| 185 bool OnMessageReceived(const IPC::Message& message) override { | |
| 186 bool handled = true; | |
| 187 IPC_BEGIN_MESSAGE_MAP(IOSurfaceManagerFilter, message) | |
| 188 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetIOSurfaceManagerToken, | |
| 189 OnSetIOSurfaceManagerToken) | |
| 190 IPC_MESSAGE_UNHANDLED(handled = false) | |
| 191 IPC_END_MESSAGE_MAP() | |
| 192 return handled; | |
| 193 } | |
| 194 | |
| 195 protected: | |
| 196 ~IOSurfaceManagerFilter() override {} | |
| 197 | |
| 198 void OnSetIOSurfaceManagerToken(const IOSurfaceManagerToken& token) { | |
| 199 ChildIOSurfaceManager::GetInstance()->set_token(token); | |
| 200 } | |
| 201 }; | |
| 202 #endif | |
| 203 | |
| 204 #if defined(USE_OZONE) | 177 #if defined(USE_OZONE) |
| 205 class ClientNativePixmapFactoryFilter : public IPC::MessageFilter { | 178 class ClientNativePixmapFactoryFilter : public IPC::MessageFilter { |
| 206 public: | 179 public: |
| 207 // Overridden from IPC::MessageFilter: | 180 // Overridden from IPC::MessageFilter: |
| 208 bool OnMessageReceived(const IPC::Message& message) override { | 181 bool OnMessageReceived(const IPC::Message& message) override { |
| 209 bool handled = true; | 182 bool handled = true; |
| 210 IPC_BEGIN_MESSAGE_MAP(ClientNativePixmapFactoryFilter, message) | 183 IPC_BEGIN_MESSAGE_MAP(ClientNativePixmapFactoryFilter, message) |
| 211 IPC_MESSAGE_HANDLER(ChildProcessMsg_InitializeClientNativePixmapFactory, | 184 IPC_MESSAGE_HANDLER(ChildProcessMsg_InitializeClientNativePixmapFactory, |
| 212 OnInitializeClientNativePixmapFactory) | 185 OnInitializeClientNativePixmapFactory) |
| 213 IPC_MESSAGE_UNHANDLED(handled = false) | 186 IPC_MESSAGE_UNHANDLED(handled = false) |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 power_monitor_source.Pass())); | 446 power_monitor_source.Pass())); |
| 474 } | 447 } |
| 475 | 448 |
| 476 #if defined(OS_POSIX) | 449 #if defined(OS_POSIX) |
| 477 // Check that --process-type is specified so we don't do this in unit tests | 450 // Check that --process-type is specified so we don't do this in unit tests |
| 478 // and single-process mode. | 451 // and single-process mode. |
| 479 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessType)) | 452 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessType)) |
| 480 channel_->AddFilter(new SuicideOnChannelErrorFilter()); | 453 channel_->AddFilter(new SuicideOnChannelErrorFilter()); |
| 481 #endif | 454 #endif |
| 482 | 455 |
| 483 #if defined(OS_MACOSX) | |
| 484 channel_->AddFilter(new IOSurfaceManagerFilter()); | |
| 485 #endif | |
| 486 | |
| 487 #if defined(USE_OZONE) | 456 #if defined(USE_OZONE) |
| 488 channel_->AddFilter(new ClientNativePixmapFactoryFilter()); | 457 channel_->AddFilter(new ClientNativePixmapFactoryFilter()); |
| 489 #endif | 458 #endif |
| 490 | 459 |
| 491 // Add filters passed here via options. | 460 // Add filters passed here via options. |
| 492 for (auto startup_filter : options.startup_filters) { | 461 for (auto startup_filter : options.startup_filters) { |
| 493 channel_->AddFilter(startup_filter); | 462 channel_->AddFilter(startup_filter); |
| 494 } | 463 } |
| 495 | 464 |
| 496 ConnectChannel(options.use_mojo_channel); | 465 ConnectChannel(options.use_mojo_channel); |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 766 void ChildThreadImpl::EnsureConnected() { | 735 void ChildThreadImpl::EnsureConnected() { |
| 767 VLOG(0) << "ChildThreadImpl::EnsureConnected()"; | 736 VLOG(0) << "ChildThreadImpl::EnsureConnected()"; |
| 768 base::Process::Current().Terminate(0, false); | 737 base::Process::Current().Terminate(0, false); |
| 769 } | 738 } |
| 770 | 739 |
| 771 bool ChildThreadImpl::IsInBrowserProcess() const { | 740 bool ChildThreadImpl::IsInBrowserProcess() const { |
| 772 return browser_process_io_runner_; | 741 return browser_process_io_runner_; |
| 773 } | 742 } |
| 774 | 743 |
| 775 } // namespace content | 744 } // namespace content |
| OLD | NEW |