Chromium Code Reviews| 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" | |
| 7 #include "content/public/app/content_main.h" | 9 #include "content/public/app/content_main.h" |
| 8 | 10 |
| 9 #if defined(OS_WIN) | 11 #if defined(OS_WIN) |
| 10 #include "base/debug/dump_without_crashing.h" | 12 #include "base/debug/dump_without_crashing.h" |
| 11 #include "base/win/win_util.h" | 13 #include "base/win/win_util.h" |
| 12 #include "chrome/common/chrome_constants.h" | 14 #include "chrome/common/chrome_constants.h" |
| 13 | 15 |
| 14 #define DLLEXPORT __declspec(dllexport) | 16 #define DLLEXPORT __declspec(dllexport) |
| 15 | 17 |
| 16 // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling. | 18 // 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... | |
| 56 typedef void (__cdecl *DumpProcessFunction)(); | 58 typedef void (__cdecl *DumpProcessFunction)(); |
| 57 DumpProcessFunction DumpProcess = reinterpret_cast<DumpProcessFunction>( | 59 DumpProcessFunction DumpProcess = reinterpret_cast<DumpProcessFunction>( |
| 58 ::GetProcAddress(::GetModuleHandle(chrome::kBrowserProcessExecutableName), | 60 ::GetProcAddress(::GetModuleHandle(chrome::kBrowserProcessExecutableName), |
| 59 "DumpProcessWithoutCrash")); | 61 "DumpProcessWithoutCrash")); |
| 60 base::debug::SetDumpWithoutCrashingFunction(DumpProcess); | 62 base::debug::SetDumpWithoutCrashingFunction(DumpProcess); |
| 61 #else | 63 #else |
| 62 params.argc = argc; | 64 params.argc = argc; |
| 63 params.argv = argv; | 65 params.argv = argv; |
| 64 #endif | 66 #endif |
| 65 | 67 |
| 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(); | |
|
Alexei Svitkine (slow)
2015/01/30 14:09:23
Does this actually work?
My understanding (but ma
vadimt
2015/01/30 16:14:47
This works both in Debug and Release builds.
| |
| 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 | |
| 66 int rv = content::ContentMain(params); | 84 int rv = content::ContentMain(params); |
| 67 | 85 |
| 68 #if defined(OS_WIN) | 86 #if defined(OS_WIN) |
| 69 base::win::SetShouldCrashOnProcessDetach(false); | 87 base::win::SetShouldCrashOnProcessDetach(false); |
| 70 #endif | 88 #endif |
| 71 | 89 |
| 72 return rv; | 90 return rv; |
| 73 } | 91 } |
| OLD | NEW |