| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/tracked_objects.h" | 5 #include "base/tracked_objects.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "base/stringprintf.h" | 12 #include "base/stringprintf.h" |
| 13 #include "base/threading/thread_restrictions.h" | 13 #include "base/threading/thread_restrictions.h" |
| 14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 | 15 |
| 16 using base::TimeDelta; | 16 using base::TimeDelta; |
| 17 | 17 |
| 18 namespace tracked_objects { | 18 namespace tracked_objects { |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 // Flag to compile out almost all of the task tracking code. | 21 // Flag to compile out almost all of the task tracking code. |
| 22 #if defined(NDEBUG) && defined(OS_MAC) | |
| 23 // Avoid problems with base_unittest crashes in Mac for now. | |
| 24 static const bool kTrackAllTaskObjects = false; | |
| 25 #else | |
| 26 static const bool kTrackAllTaskObjects = true; | 22 static const bool kTrackAllTaskObjects = true; |
| 27 #endif | |
| 28 | 23 |
| 29 // When ThreadData is first initialized, should we start in an ACTIVE state to | 24 // When ThreadData is first initialized, should we start in an ACTIVE state to |
| 30 // record all of the startup-time tasks, or should we start up DEACTIVATED, so | 25 // record all of the startup-time tasks, or should we start up DEACTIVATED, so |
| 31 // that we only record after parsing the command line flag --enable-tracking. | 26 // that we only record after parsing the command line flag --enable-tracking. |
| 32 // Note that the flag may force either state, so this really controls only the | 27 // Note that the flag may force either state, so this really controls only the |
| 33 // period of time up until that flag is parsed. If there is no flag seen, then | 28 // period of time up until that flag is parsed. If there is no flag seen, then |
| 34 // this state may prevail for much or all of the process lifetime. | 29 // this state may prevail for much or all of the process lifetime. |
| 35 static const ThreadData::Status kInitialStartupState = ThreadData::ACTIVE; | 30 static const ThreadData::Status kInitialStartupState = ThreadData::ACTIVE; |
| 36 } // anonymous namespace. | 31 } // anonymous namespace. |
| 37 | 32 |
| (...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1164 (combined_selectors_ & BIRTH_THREAD) ? "*" : | 1159 (combined_selectors_ & BIRTH_THREAD) ? "*" : |
| 1165 sample.birth().birth_thread()->thread_name().c_str(), | 1160 sample.birth().birth_thread()->thread_name().c_str(), |
| 1166 (combined_selectors_ & DEATH_THREAD) ? "*" : | 1161 (combined_selectors_ & DEATH_THREAD) ? "*" : |
| 1167 sample.DeathThreadName().c_str()); | 1162 sample.DeathThreadName().c_str()); |
| 1168 sample.birth().location().Write(!(combined_selectors_ & BIRTH_FILE), | 1163 sample.birth().location().Write(!(combined_selectors_ & BIRTH_FILE), |
| 1169 !(combined_selectors_ & BIRTH_FUNCTION), | 1164 !(combined_selectors_ & BIRTH_FUNCTION), |
| 1170 output); | 1165 output); |
| 1171 } | 1166 } |
| 1172 | 1167 |
| 1173 } // namespace tracked_objects | 1168 } // namespace tracked_objects |
| OLD | NEW |