Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: base/tracked_objects.cc

Issue 1936093003: Fix gpu_video_decode_accelerator include order by renaming enum with X11 name collision (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename Status->ThreadStatus Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/tracked_objects.h" 5 #include "base/tracked_objects.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 9
10 #include "base/atomicops.h" 10 #include "base/atomicops.h"
(...skipping 16 matching lines...) Expand all
27 27
28 namespace tracked_objects { 28 namespace tracked_objects {
29 29
30 namespace { 30 namespace {
31 // When ThreadData is first initialized, should we start in an ACTIVE state to 31 // When ThreadData is first initialized, should we start in an ACTIVE state to
32 // record all of the startup-time tasks, or should we start up DEACTIVATED, so 32 // record all of the startup-time tasks, or should we start up DEACTIVATED, so
33 // that we only record after parsing the command line flag --enable-tracking. 33 // that we only record after parsing the command line flag --enable-tracking.
34 // Note that the flag may force either state, so this really controls only the 34 // Note that the flag may force either state, so this really controls only the
35 // period of time up until that flag is parsed. If there is no flag seen, then 35 // period of time up until that flag is parsed. If there is no flag seen, then
36 // this state may prevail for much or all of the process lifetime. 36 // this state may prevail for much or all of the process lifetime.
37 const ThreadData::Status kInitialStartupState = ThreadData::PROFILING_ACTIVE; 37 const ThreadData::ThreadStatus kInitialStartupState =
38 ThreadData::PROFILING_ACTIVE;
38 39
39 // Possible states of the profiler timing enabledness. 40 // Possible states of the profiler timing enabledness.
40 enum { 41 enum {
41 UNDEFINED_TIMING, 42 UNDEFINED_TIMING,
42 ENABLED_TIMING, 43 ENABLED_TIMING,
43 DISABLED_TIMING, 44 DISABLED_TIMING,
44 }; 45 };
45 46
46 // State of the profiler timing enabledness. 47 // State of the profiler timing enabledness.
47 base::subtle::Atomic32 g_profiler_timing_enabled = UNDEFINED_TIMING; 48 base::subtle::Atomic32 g_profiler_timing_enabled = UNDEFINED_TIMING;
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 ++incarnation_counter_; 699 ++incarnation_counter_;
699 700
700 // The lock is not critical for setting status_, but it doesn't hurt. It also 701 // The lock is not critical for setting status_, but it doesn't hurt. It also
701 // ensures that if we have a racy initialization, that we'll bail as soon as 702 // ensures that if we have a racy initialization, that we'll bail as soon as
702 // we get the lock earlier in this method. 703 // we get the lock earlier in this method.
703 base::subtle::Release_Store(&status_, kInitialStartupState); 704 base::subtle::Release_Store(&status_, kInitialStartupState);
704 DCHECK(base::subtle::NoBarrier_Load(&status_) != UNINITIALIZED); 705 DCHECK(base::subtle::NoBarrier_Load(&status_) != UNINITIALIZED);
705 } 706 }
706 707
707 // static 708 // static
708 void ThreadData::InitializeAndSetTrackingStatus(Status status) { 709 void ThreadData::InitializeAndSetTrackingStatus(ThreadStatus status) {
709 DCHECK_GE(status, DEACTIVATED); 710 DCHECK_GE(status, DEACTIVATED);
710 DCHECK_LE(status, PROFILING_ACTIVE); 711 DCHECK_LE(status, PROFILING_ACTIVE);
711 712
712 Initialize(); // No-op if already initialized. 713 Initialize(); // No-op if already initialized.
713 714
714 if (status > DEACTIVATED) 715 if (status > DEACTIVATED)
715 status = PROFILING_ACTIVE; 716 status = PROFILING_ACTIVE;
716 base::subtle::Release_Store(&status_, status); 717 base::subtle::Release_Store(&status_, status);
717 } 718 }
718 719
719 // static 720 // static
720 ThreadData::Status ThreadData::status() { 721 ThreadData::ThreadStatus ThreadData::status() {
721 return static_cast<ThreadData::Status>(base::subtle::Acquire_Load(&status_)); 722 return static_cast<ThreadData::ThreadStatus>(
723 base::subtle::Acquire_Load(&status_));
722 } 724 }
723 725
724 // static 726 // static
725 bool ThreadData::TrackingStatus() { 727 bool ThreadData::TrackingStatus() {
726 return base::subtle::Acquire_Load(&status_) > DEACTIVATED; 728 return base::subtle::Acquire_Load(&status_) > DEACTIVATED;
727 } 729 }
728 730
729 // static 731 // static
730 void ThreadData::EnableProfilerTiming() { 732 void ThreadData::EnableProfilerTiming() {
731 base::subtle::NoBarrier_Store(&g_profiler_timing_enabled, ENABLED_TIMING); 733 base::subtle::NoBarrier_Store(&g_profiler_timing_enabled, ENABLED_TIMING);
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 #endif 970 #endif
969 } 971 }
970 972
971 ProcessDataSnapshot::ProcessDataSnapshot(const ProcessDataSnapshot& other) = 973 ProcessDataSnapshot::ProcessDataSnapshot(const ProcessDataSnapshot& other) =
972 default; 974 default;
973 975
974 ProcessDataSnapshot::~ProcessDataSnapshot() { 976 ProcessDataSnapshot::~ProcessDataSnapshot() {
975 } 977 }
976 978
977 } // namespace tracked_objects 979 } // namespace tracked_objects
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698