| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 #include "services/service_manager/public/cpp/interface_factory.h" | 72 #include "services/service_manager/public/cpp/interface_factory.h" |
| 73 #include "services/service_manager/public/cpp/interface_provider.h" | 73 #include "services/service_manager/public/cpp/interface_provider.h" |
| 74 #include "services/service_manager/public/cpp/interface_registry.h" | 74 #include "services/service_manager/public/cpp/interface_registry.h" |
| 75 #include "services/service_manager/runner/common/client_util.h" | 75 #include "services/service_manager/runner/common/client_util.h" |
| 76 | 76 |
| 77 #if defined(OS_POSIX) | 77 #if defined(OS_POSIX) |
| 78 #include "base/posix/global_descriptors.h" | 78 #include "base/posix/global_descriptors.h" |
| 79 #include "content/public/common/content_descriptors.h" | 79 #include "content/public/common/content_descriptors.h" |
| 80 #endif | 80 #endif |
| 81 | 81 |
| 82 #if defined(OS_MACOSX) |
| 83 #include "base/allocator/allocator_interception_mac.h" |
| 84 #endif |
| 85 |
| 82 using tracked_objects::ThreadData; | 86 using tracked_objects::ThreadData; |
| 83 | 87 |
| 84 namespace content { | 88 namespace content { |
| 85 namespace { | 89 namespace { |
| 86 | 90 |
| 87 // How long to wait for a connection to the browser process before giving up. | 91 // How long to wait for a connection to the browser process before giving up. |
| 88 const int kConnectionTimeoutS = 15; | 92 const int kConnectionTimeoutS = 15; |
| 89 | 93 |
| 90 base::LazyInstance<base::ThreadLocalPointer<ChildThreadImpl>>::DestructorAtExit | 94 base::LazyInstance<base::ThreadLocalPointer<ChildThreadImpl>>::DestructorAtExit |
| 91 g_lazy_tls = LAZY_INSTANCE_INITIALIZER; | 95 g_lazy_tls = LAZY_INSTANCE_INITIALIZER; |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 int connection_timeout = kConnectionTimeoutS; | 556 int connection_timeout = kConnectionTimeoutS; |
| 553 std::string connection_override = | 557 std::string connection_override = |
| 554 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 558 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 555 switches::kIPCConnectionTimeout); | 559 switches::kIPCConnectionTimeout); |
| 556 if (!connection_override.empty()) { | 560 if (!connection_override.empty()) { |
| 557 int temp; | 561 int temp; |
| 558 if (base::StringToInt(connection_override, &temp)) | 562 if (base::StringToInt(connection_override, &temp)) |
| 559 connection_timeout = temp; | 563 connection_timeout = temp; |
| 560 } | 564 } |
| 561 | 565 |
| 566 #if defined(OS_MACOSX) |
| 567 if (base::CommandLine::InitializedForCurrentProcess() && |
| 568 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 569 switches::kEnableHeapProfiling)) { |
| 570 base::allocator::PeriodicallyShimNewMallocZones(); |
| 571 } |
| 572 #endif |
| 573 |
| 562 message_loop_->task_runner()->PostDelayedTask( | 574 message_loop_->task_runner()->PostDelayedTask( |
| 563 FROM_HERE, base::Bind(&ChildThreadImpl::EnsureConnected, | 575 FROM_HERE, base::Bind(&ChildThreadImpl::EnsureConnected, |
| 564 channel_connected_factory_->GetWeakPtr()), | 576 channel_connected_factory_->GetWeakPtr()), |
| 565 base::TimeDelta::FromSeconds(connection_timeout)); | 577 base::TimeDelta::FromSeconds(connection_timeout)); |
| 566 | 578 |
| 567 #if defined(OS_ANDROID) | 579 #if defined(OS_ANDROID) |
| 568 g_quit_closure.Get().BindToMainThread(); | 580 g_quit_closure.Get().BindToMainThread(); |
| 569 #endif | 581 #endif |
| 570 } | 582 } |
| 571 | 583 |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 875 connected_to_browser_ = true; | 887 connected_to_browser_ = true; |
| 876 child_info_ = local_info; | 888 child_info_ = local_info; |
| 877 browser_info_ = remote_info; | 889 browser_info_ = remote_info; |
| 878 } | 890 } |
| 879 | 891 |
| 880 bool ChildThreadImpl::IsInBrowserProcess() const { | 892 bool ChildThreadImpl::IsInBrowserProcess() const { |
| 881 return static_cast<bool>(browser_process_io_runner_); | 893 return static_cast<bool>(browser_process_io_runner_); |
| 882 } | 894 } |
| 883 | 895 |
| 884 } // namespace content | 896 } // namespace content |
| OLD | NEW |