| 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 "chrome/app/chrome_main_delegate.h" | 5 #include "chrome/app/chrome_main_delegate.h" |
| 6 | 6 |
| 7 #include "base/profiler/scoped_tracker.h" | |
| 8 #include "chrome/common/chrome_version_info.h" | |
| 9 #include "content/public/app/content_main.h" | 7 #include "content/public/app/content_main.h" |
| 10 | 8 |
| 11 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
| 12 #include "base/debug/dump_without_crashing.h" | 10 #include "base/debug/dump_without_crashing.h" |
| 13 #include "base/win/win_util.h" | 11 #include "base/win/win_util.h" |
| 14 #include "chrome/common/chrome_constants.h" | 12 #include "chrome/common/chrome_constants.h" |
| 15 | 13 |
| 16 #define DLLEXPORT __declspec(dllexport) | 14 #define DLLEXPORT __declspec(dllexport) |
| 17 | 15 |
| 18 // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling. | 16 // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 typedef void (__cdecl *DumpProcessFunction)(); | 56 typedef void (__cdecl *DumpProcessFunction)(); |
| 59 DumpProcessFunction DumpProcess = reinterpret_cast<DumpProcessFunction>( | 57 DumpProcessFunction DumpProcess = reinterpret_cast<DumpProcessFunction>( |
| 60 ::GetProcAddress(::GetModuleHandle(chrome::kBrowserProcessExecutableName), | 58 ::GetProcAddress(::GetModuleHandle(chrome::kBrowserProcessExecutableName), |
| 61 "DumpProcessWithoutCrash")); | 59 "DumpProcessWithoutCrash")); |
| 62 base::debug::SetDumpWithoutCrashingFunction(DumpProcess); | 60 base::debug::SetDumpWithoutCrashingFunction(DumpProcess); |
| 63 #else | 61 #else |
| 64 params.argc = argc; | 62 params.argc = argc; |
| 65 params.argv = argv; | 63 params.argv = argv; |
| 66 #endif | 64 #endif |
| 67 | 65 |
| 68 // TODO(vadimt): Remove the switch statement below once crbug.com/453640 is | |
| 69 // fixed. | |
| 70 // Enable profiler instrumentation depending on the channel. | |
| 71 switch (chrome::VersionInfo::GetChannel()) { | |
| 72 case chrome::VersionInfo::CHANNEL_UNKNOWN: | |
| 73 case chrome::VersionInfo::CHANNEL_CANARY: | |
| 74 tracked_objects::ScopedTracker::Enable(); | |
| 75 break; | |
| 76 | |
| 77 case chrome::VersionInfo::CHANNEL_DEV: | |
| 78 case chrome::VersionInfo::CHANNEL_BETA: | |
| 79 case chrome::VersionInfo::CHANNEL_STABLE: | |
| 80 // Don't enable instrumentation. | |
| 81 break; | |
| 82 } | |
| 83 | |
| 84 int rv = content::ContentMain(params); | 66 int rv = content::ContentMain(params); |
| 85 | 67 |
| 86 #if defined(OS_WIN) | 68 #if defined(OS_WIN) |
| 87 base::win::SetShouldCrashOnProcessDetach(false); | 69 base::win::SetShouldCrashOnProcessDetach(false); |
| 88 #endif | 70 #endif |
| 89 | 71 |
| 90 return rv; | 72 return rv; |
| 91 } | 73 } |
| OLD | NEW |