OLD | NEW |
---|---|
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "services/service_manager/embedder/main.h" | 5 #include "services/service_manager/embedder/main.h" |
6 | 6 |
7 #include "base/allocator/features.h" | 7 #include "base/allocator/features.h" |
8 #include "base/at_exit.h" | 8 #include "base/at_exit.h" |
9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
331 | 331 |
332 int Main(const MainParams& params) { | 332 int Main(const MainParams& params) { |
333 MainDelegate* delegate = params.delegate; | 333 MainDelegate* delegate = params.delegate; |
334 DCHECK(delegate); | 334 DCHECK(delegate); |
335 | 335 |
336 #if defined(OS_MACOSX) && BUILDFLAG(USE_EXPERIMENTAL_ALLOCATOR_SHIM) | 336 #if defined(OS_MACOSX) && BUILDFLAG(USE_EXPERIMENTAL_ALLOCATOR_SHIM) |
337 base::allocator::InitializeAllocatorShim(); | 337 base::allocator::InitializeAllocatorShim(); |
338 #endif | 338 #endif |
339 base::EnableTerminationOnOutOfMemory(); | 339 base::EnableTerminationOnOutOfMemory(); |
340 | 340 |
341 #if defined(OS_LINUX) | |
342 // The various desktop environments set this environment variable that allows | |
343 // the dbus client library to connect directly to the bus. When this variable | |
344 // is not set (test environments like xvfb-run), the dbus client library will | |
345 // fall back to auto-launch mode. Auto-launch is dangerous as it can cause | |
346 // hangs (crbug.com/715658) . This one line disables the dbus auto-launch, | |
347 // by clobbering the DBUS_SESSION_BUS_ADDRESS env variable if not already set. | |
348 // The old auto-launch behavior, if needed, can be restored by setting | |
349 // DBUS_SESSION_BUS_ADDRESS="autolaunch:" before launching chrome. | |
350 const int kNoOverrideIfAlreadySet = 0; | |
351 setenv("DBUS_SESSION_BUS_ADDRESS", "disabled:", kNoOverrideIfAlreadySet); | |
satorux1
2017/05/08 01:30:37
Several environmental variables, such as GNOME_DIS
| |
352 #endif | |
353 | |
341 #if defined(OS_WIN) | 354 #if defined(OS_WIN) |
342 base::win::RegisterInvalidParamHandler(); | 355 base::win::RegisterInvalidParamHandler(); |
343 ui::win::CreateATLModuleIfNeeded(); | 356 ui::win::CreateATLModuleIfNeeded(); |
344 #endif // defined(OS_WIN) | 357 #endif // defined(OS_WIN) |
345 | 358 |
346 #if !defined(OS_ANDROID) | 359 #if !defined(OS_ANDROID) |
347 // On Android, the command line is initialized when library is loaded. | 360 // On Android, the command line is initialized when library is loaded. |
348 int argc = 0; | 361 int argc = 0; |
349 const char** argv = nullptr; | 362 const char** argv = nullptr; |
350 | 363 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
472 autorelease_pool.reset(); | 485 autorelease_pool.reset(); |
473 #endif | 486 #endif |
474 | 487 |
475 if (process_type == ProcessType::kEmbedder) | 488 if (process_type == ProcessType::kEmbedder) |
476 delegate->ShutDownEmbedderProcess(); | 489 delegate->ShutDownEmbedderProcess(); |
477 | 490 |
478 return exit_code; | 491 return exit_code; |
479 } | 492 } |
480 | 493 |
481 } // namespace service_manager | 494 } // namespace service_manager |
OLD | NEW |