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

Side by Side Diff: base/tracked_objects.h

Issue 5986012: Move thread local stuff from base to base/threading and consistently use the... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « base/threading/thread_local_win.cc ('k') | base/tracked_objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #ifndef BASE_TRACKED_OBJECTS_H_ 5 #ifndef BASE_TRACKED_OBJECTS_H_
6 #define BASE_TRACKED_OBJECTS_H_ 6 #define BASE_TRACKED_OBJECTS_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/lock.h" 13 #include "base/lock.h"
14 #include "base/thread_local_storage.h"
15 #include "base/tracked.h" 14 #include "base/tracked.h"
15 #include "base/threading/thread_local_storage.h"
16 16
17 // TrackedObjects provides a database of stats about objects (generally Tasks) 17 // TrackedObjects provides a database of stats about objects (generally Tasks)
18 // that are tracked. Tracking means their birth, death, duration, birth thread, 18 // that are tracked. Tracking means their birth, death, duration, birth thread,
19 // death thread, and birth place are recorded. This data is carefully spread 19 // death thread, and birth place are recorded. This data is carefully spread
20 // across a series of objects so that the counts and times can be rapidly 20 // across a series of objects so that the counts and times can be rapidly
21 // updated without (usually) having to lock the data, and hence there is usually 21 // updated without (usually) having to lock the data, and hence there is usually
22 // very little contention caused by the tracking. The data can be viewed via 22 // very little contention caused by the tracking. The data can be viewed via
23 // the about:tasks URL, with a variety of sorting and filtering choices. 23 // the about:tasks URL, with a variety of sorting and filtering choices.
24 // 24 //
25 // These classes serve as the basis of a profiler of sorts for the Tasks system. 25 // These classes serve as the basis of a profiler of sorts for the Tasks system.
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 class RunTheStatic; 564 class RunTheStatic;
565 #endif 565 #endif
566 566
567 // Each registered thread is called to set status_ to SHUTDOWN. 567 // Each registered thread is called to set status_ to SHUTDOWN.
568 // This is done redundantly on every registered thread because it is not 568 // This is done redundantly on every registered thread because it is not
569 // protected by a mutex. Running on all threads guarantees we get the 569 // protected by a mutex. Running on all threads guarantees we get the
570 // notification into the memory cache of all possible threads. 570 // notification into the memory cache of all possible threads.
571 static void ShutdownDisablingFurtherTracking(); 571 static void ShutdownDisablingFurtherTracking();
572 572
573 // We use thread local store to identify which ThreadData to interact with. 573 // We use thread local store to identify which ThreadData to interact with.
574 static TLSSlot tls_index_; 574 static base::ThreadLocalStorage::Slot tls_index_;
575 575
576 // Link to the most recently created instance (starts a null terminated list). 576 // Link to the most recently created instance (starts a null terminated list).
577 static ThreadData* first_; 577 static ThreadData* first_;
578 // Protection for access to first_. 578 // Protection for access to first_.
579 static Lock list_lock_; 579 static Lock list_lock_;
580 580
581 // We set status_ to SHUTDOWN when we shut down the tracking service. This 581 // We set status_ to SHUTDOWN when we shut down the tracking service. This
582 // setting is redundantly established by all participating threads so that we 582 // setting is redundantly established by all participating threads so that we
583 // are *guaranteed* (without locking) that all threads can "see" the status 583 // are *guaranteed* (without locking) that all threads can "see" the status
584 // and avoid additional calls into the service. 584 // and avoid additional calls into the service.
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 }; 660 };
661 static State state_; 661 static State state_;
662 662
663 DISALLOW_COPY_AND_ASSIGN(AutoTracking); 663 DISALLOW_COPY_AND_ASSIGN(AutoTracking);
664 }; 664 };
665 665
666 666
667 } // namespace tracked_objects 667 } // namespace tracked_objects
668 668
669 #endif // BASE_TRACKED_OBJECTS_H_ 669 #endif // BASE_TRACKED_OBJECTS_H_
OLDNEW
« no previous file with comments | « base/threading/thread_local_win.cc ('k') | base/tracked_objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698