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