OLD | NEW |
1 // Copyright (c) 2010 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 #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> |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 | 300 |
301 // After the accumulation phase, the following accessor is used to process the | 301 // After the accumulation phase, the following accessor is used to process the |
302 // data. | 302 // data. |
303 Collection* collection(); | 303 Collection* collection(); |
304 | 304 |
305 // After collection of death data is complete, we can add entries for all the | 305 // After collection of death data is complete, we can add entries for all the |
306 // remaining living objects. | 306 // remaining living objects. |
307 void AddListOfLivingObjects(); | 307 void AddListOfLivingObjects(); |
308 | 308 |
309 private: | 309 private: |
| 310 typedef std::map<const BirthOnThread*, int> BirthCount; |
| 311 |
310 // This instance may be provided to several threads to contribute data. The | 312 // This instance may be provided to several threads to contribute data. The |
311 // following counter tracks how many more threads will contribute. When it is | 313 // following counter tracks how many more threads will contribute. When it is |
312 // zero, then all asynchronous contributions are complete, and locked access | 314 // zero, then all asynchronous contributions are complete, and locked access |
313 // is no longer needed. | 315 // is no longer needed. |
314 int count_of_contributing_threads_; | 316 int count_of_contributing_threads_; |
315 | 317 |
316 // The array that we collect data into. | 318 // The array that we collect data into. |
317 Collection collection_; | 319 Collection collection_; |
318 | 320 |
319 // The total number of births recorded at each location for which we have not | 321 // The total number of births recorded at each location for which we have not |
320 // seen a death count. | 322 // seen a death count. |
321 typedef std::map<const BirthOnThread*, int> BirthCount; | |
322 BirthCount global_birth_count_; | 323 BirthCount global_birth_count_; |
323 | 324 |
324 Lock accumulation_lock_; // Protects access during accumulation phase. | 325 Lock accumulation_lock_; // Protects access during accumulation phase. |
325 | 326 |
326 DISALLOW_COPY_AND_ASSIGN(DataCollector); | 327 DISALLOW_COPY_AND_ASSIGN(DataCollector); |
327 }; | 328 }; |
328 | 329 |
329 //------------------------------------------------------------------------------ | 330 //------------------------------------------------------------------------------ |
330 // Aggregation contains summaries (totals and subtotals) of groups of Snapshot | 331 // Aggregation contains summaries (totals and subtotals) of groups of Snapshot |
331 // instances to provide printing of these collections on a single line. | 332 // instances to provide printing of these collections on a single line. |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 }; | 661 }; |
661 static State state_; | 662 static State state_; |
662 | 663 |
663 DISALLOW_COPY_AND_ASSIGN(AutoTracking); | 664 DISALLOW_COPY_AND_ASSIGN(AutoTracking); |
664 }; | 665 }; |
665 | 666 |
666 | 667 |
667 } // namespace tracked_objects | 668 } // namespace tracked_objects |
668 | 669 |
669 #endif // BASE_TRACKED_OBJECTS_H_ | 670 #endif // BASE_TRACKED_OBJECTS_H_ |
OLD | NEW |