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

Side by Side Diff: content/child/child_thread_impl.cc

Issue 2713553002: mac: Periodically shim new malloc zones immediately after startup. (Closed)
Patch Set: Rebase. Created 3 years, 10 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
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/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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 #include "services/service_manager/public/cpp/interface_factory.h" 71 #include "services/service_manager/public/cpp/interface_factory.h"
72 #include "services/service_manager/public/cpp/interface_provider.h" 72 #include "services/service_manager/public/cpp/interface_provider.h"
73 #include "services/service_manager/public/cpp/interface_registry.h" 73 #include "services/service_manager/public/cpp/interface_registry.h"
74 #include "services/service_manager/runner/common/client_util.h" 74 #include "services/service_manager/runner/common/client_util.h"
75 75
76 #if defined(OS_POSIX) 76 #if defined(OS_POSIX)
77 #include "base/posix/global_descriptors.h" 77 #include "base/posix/global_descriptors.h"
78 #include "content/public/common/content_descriptors.h" 78 #include "content/public/common/content_descriptors.h"
79 #endif 79 #endif
80 80
81 #if defined(OS_MACOSX)
82 #include "base/allocator/allocator_interception_mac.h"
83 #endif
84
81 using tracked_objects::ThreadData; 85 using tracked_objects::ThreadData;
82 86
83 namespace content { 87 namespace content {
84 namespace { 88 namespace {
85 89
86 // How long to wait for a connection to the browser process before giving up. 90 // How long to wait for a connection to the browser process before giving up.
87 const int kConnectionTimeoutS = 15; 91 const int kConnectionTimeoutS = 15;
88 92
89 base::LazyInstance<base::ThreadLocalPointer<ChildThreadImpl> > g_lazy_tls = 93 base::LazyInstance<base::ThreadLocalPointer<ChildThreadImpl> > g_lazy_tls =
90 LAZY_INSTANCE_INITIALIZER; 94 LAZY_INSTANCE_INITIALIZER;
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 int connection_timeout = kConnectionTimeoutS; 550 int connection_timeout = kConnectionTimeoutS;
547 std::string connection_override = 551 std::string connection_override =
548 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 552 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
549 switches::kIPCConnectionTimeout); 553 switches::kIPCConnectionTimeout);
550 if (!connection_override.empty()) { 554 if (!connection_override.empty()) {
551 int temp; 555 int temp;
552 if (base::StringToInt(connection_override, &temp)) 556 if (base::StringToInt(connection_override, &temp))
553 connection_timeout = temp; 557 connection_timeout = temp;
554 } 558 }
555 559
560 #if defined(OS_MACOSX)
561 base::allocator::PeriodicallyShimNewMallocZones();
562 #endif
563
556 message_loop_->task_runner()->PostDelayedTask( 564 message_loop_->task_runner()->PostDelayedTask(
557 FROM_HERE, base::Bind(&ChildThreadImpl::EnsureConnected, 565 FROM_HERE, base::Bind(&ChildThreadImpl::EnsureConnected,
558 channel_connected_factory_->GetWeakPtr()), 566 channel_connected_factory_->GetWeakPtr()),
559 base::TimeDelta::FromSeconds(connection_timeout)); 567 base::TimeDelta::FromSeconds(connection_timeout));
560 568
561 #if defined(OS_ANDROID) 569 #if defined(OS_ANDROID)
562 g_quit_closure.Get().BindToMainThread(); 570 g_quit_closure.Get().BindToMainThread();
563 #endif 571 #endif
564 } 572 }
565 573
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 connected_to_browser_ = true; 882 connected_to_browser_ = true;
875 child_info_ = local_info; 883 child_info_ = local_info;
876 browser_info_ = remote_info; 884 browser_info_ = remote_info;
877 } 885 }
878 886
879 bool ChildThreadImpl::IsInBrowserProcess() const { 887 bool ChildThreadImpl::IsInBrowserProcess() const {
880 return static_cast<bool>(browser_process_io_runner_); 888 return static_cast<bool>(browser_process_io_runner_);
881 } 889 }
882 890
883 } // namespace content 891 } // namespace content
OLDNEW
« base/allocator/allocator_interception_mac.h ('K') | « content/browser/browser_main_loop.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698