| 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/public/app/content_main_runner.h" | 5 #include "content/public/app/content_main_runner.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "base/lazy_instance.h" | 21 #include "base/lazy_instance.h" |
| 22 #include "base/logging.h" | 22 #include "base/logging.h" |
| 23 #include "base/macros.h" | 23 #include "base/macros.h" |
| 24 #include "base/memory/scoped_ptr.h" | 24 #include "base/memory/scoped_ptr.h" |
| 25 #include "base/memory/scoped_vector.h" | 25 #include "base/memory/scoped_vector.h" |
| 26 #include "base/metrics/statistics_recorder.h" | 26 #include "base/metrics/statistics_recorder.h" |
| 27 #include "base/path_service.h" | 27 #include "base/path_service.h" |
| 28 #include "base/process/launch.h" | 28 #include "base/process/launch.h" |
| 29 #include "base/process/memory.h" | 29 #include "base/process/memory.h" |
| 30 #include "base/process/process_handle.h" | 30 #include "base/process/process_handle.h" |
| 31 #include "base/profiler/alternate_timer.h" | |
| 32 #include "base/profiler/scoped_tracker.h" | 31 #include "base/profiler/scoped_tracker.h" |
| 33 #include "base/strings/string_number_conversions.h" | 32 #include "base/strings/string_number_conversions.h" |
| 34 #include "base/strings/string_util.h" | 33 #include "base/strings/string_util.h" |
| 35 #include "base/strings/stringprintf.h" | 34 #include "base/strings/stringprintf.h" |
| 36 #include "base/trace_event/trace_event.h" | 35 #include "base/trace_event/trace_event.h" |
| 37 #include "build/build_config.h" | 36 #include "build/build_config.h" |
| 38 #include "components/tracing/trace_config_file.h" | 37 #include "components/tracing/trace_config_file.h" |
| 39 #include "components/tracing/trace_to_console.h" | 38 #include "components/tracing/trace_to_console.h" |
| 40 #include "components/tracing/tracing_switches.h" | 39 #include "components/tracing/tracing_switches.h" |
| 41 #include "content/browser/browser_main.h" | 40 #include "content/browser/browser_main.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 57 #include "ipc/ipc_switches.h" | 56 #include "ipc/ipc_switches.h" |
| 58 #include "media/base/media.h" | 57 #include "media/base/media.h" |
| 59 #include "sandbox/win/src/sandbox_types.h" | 58 #include "sandbox/win/src/sandbox_types.h" |
| 60 #include "ui/base/ui_base_paths.h" | 59 #include "ui/base/ui_base_paths.h" |
| 61 #include "ui/base/ui_base_switches.h" | 60 #include "ui/base/ui_base_switches.h" |
| 62 | 61 |
| 63 #ifdef V8_USE_EXTERNAL_STARTUP_DATA | 62 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
| 64 #include "gin/v8_initializer.h" | 63 #include "gin/v8_initializer.h" |
| 65 #endif | 64 #endif |
| 66 | 65 |
| 67 #if defined(USE_TCMALLOC) | |
| 68 #include "third_party/tcmalloc/chromium/src/gperftools/malloc_extension.h" | |
| 69 #endif | |
| 70 | |
| 71 #if !defined(OS_IOS) | 66 #if !defined(OS_IOS) |
| 72 #include "content/app/mojo/mojo_init.h" | 67 #include "content/app/mojo/mojo_init.h" |
| 73 #include "content/browser/gpu/gpu_process_host.h" | 68 #include "content/browser/gpu/gpu_process_host.h" |
| 74 #include "content/browser/renderer_host/render_process_host_impl.h" | 69 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 75 #include "content/browser/utility_process_host_impl.h" | 70 #include "content/browser/utility_process_host_impl.h" |
| 76 #include "content/public/plugin/content_plugin_client.h" | 71 #include "content/public/plugin/content_plugin_client.h" |
| 77 #include "content/public/renderer/content_renderer_client.h" | 72 #include "content/public/renderer/content_renderer_client.h" |
| 78 #include "content/public/utility/content_utility_client.h" | 73 #include "content/public/utility/content_utility_client.h" |
| 79 #endif | 74 #endif |
| 80 | 75 |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 sandbox_info_ = *params.sandbox_info; | 413 sandbox_info_ = *params.sandbox_info; |
| 419 #else // !OS_WIN | 414 #else // !OS_WIN |
| 420 | 415 |
| 421 #if defined(OS_ANDROID) | 416 #if defined(OS_ANDROID) |
| 422 // See note at the initialization of ExitManager, below; basically, | 417 // See note at the initialization of ExitManager, below; basically, |
| 423 // only Android builds have the ctor/dtor handlers set up to use | 418 // only Android builds have the ctor/dtor handlers set up to use |
| 424 // TRACE_EVENT right away. | 419 // TRACE_EVENT right away. |
| 425 TRACE_EVENT0("startup,benchmark", "ContentMainRunnerImpl::Initialize"); | 420 TRACE_EVENT0("startup,benchmark", "ContentMainRunnerImpl::Initialize"); |
| 426 #endif // OS_ANDROID | 421 #endif // OS_ANDROID |
| 427 | 422 |
| 428 #if !defined(OS_MACOSX) && defined(USE_TCMALLOC) | |
| 429 // Provide optional hook for monitoring allocation quantities on a | |
| 430 // per-thread basis. Only set the hook if the environment indicates this | |
| 431 // needs to be enabled. | |
| 432 const char* profiling = getenv(tracked_objects::kAlternateProfilerTime); | |
| 433 if (profiling && | |
| 434 (atoi(profiling) == tracked_objects::TIME_SOURCE_TYPE_TCMALLOC)) { | |
| 435 tracked_objects::SetAlternateTimeSource( | |
| 436 MallocExtension::GetBytesAllocatedOnCurrentThread, | |
| 437 tracked_objects::TIME_SOURCE_TYPE_TCMALLOC); | |
| 438 } | |
| 439 #endif // !OS_MACOSX && USE_TCMALLOC | |
| 440 | |
| 441 #if !defined(OS_IOS) | 423 #if !defined(OS_IOS) |
| 442 base::GlobalDescriptors* g_fds = base::GlobalDescriptors::GetInstance(); | 424 base::GlobalDescriptors* g_fds = base::GlobalDescriptors::GetInstance(); |
| 443 #endif | 425 #endif |
| 444 | 426 |
| 445 // On Android, | 427 // On Android, |
| 446 // - setlocale() is not supported. | 428 // - setlocale() is not supported. |
| 447 // - We do not override the signal handlers so that we can get | 429 // - We do not override the signal handlers so that we can get |
| 448 // stack trace when crashing. | 430 // stack trace when crashing. |
| 449 // - The ipc_fd is passed through the Java service. | 431 // - The ipc_fd is passed through the Java service. |
| 450 // Thus, these are all disabled. | 432 // Thus, these are all disabled. |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 | 795 |
| 814 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); | 796 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); |
| 815 }; | 797 }; |
| 816 | 798 |
| 817 // static | 799 // static |
| 818 ContentMainRunner* ContentMainRunner::Create() { | 800 ContentMainRunner* ContentMainRunner::Create() { |
| 819 return new ContentMainRunnerImpl(); | 801 return new ContentMainRunnerImpl(); |
| 820 } | 802 } |
| 821 | 803 |
| 822 } // namespace content | 804 } // namespace content |
| OLD | NEW |