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

Side by Side Diff: base/tracked_objects.cc

Issue 16387012: Annotate the intentional test-only leak in base/tracked_objects.cc. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Another refresh. Created 7 years, 6 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
« no previous file with comments | « no previous file | tools/heapcheck/suppressions.txt » ('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) 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 <math.h> 7 #include <math.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/debug/leak_annotations.h"
11 #include "base/format_macros.h" 12 #include "base/format_macros.h"
12 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
13 #include "base/process_util.h" 14 #include "base/process_util.h"
14 #include "base/profiler/alternate_timer.h" 15 #include "base/profiler/alternate_timer.h"
15 #include "base/stringprintf.h" 16 #include "base/stringprintf.h"
16 #include "base/third_party/valgrind/memcheck.h" 17 #include "base/third_party/valgrind/memcheck.h"
17 #include "base/threading/thread_restrictions.h" 18 #include "base/threading/thread_restrictions.h"
18 #include "base/port.h" 19 #include "base/port.h"
19 20
20 using base::TimeDelta; 21 using base::TimeDelta;
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 802
802 // Put most global static back in pristine shape. 803 // Put most global static back in pristine shape.
803 worker_thread_data_creation_count_ = 0; 804 worker_thread_data_creation_count_ = 0;
804 cleanup_count_ = 0; 805 cleanup_count_ = 0;
805 tls_index_.Set(NULL); 806 tls_index_.Set(NULL);
806 status_ = DORMANT_DURING_TESTS; // Almost UNINITIALIZED. 807 status_ = DORMANT_DURING_TESTS; // Almost UNINITIALIZED.
807 808
808 // To avoid any chance of racing in unit tests, which is the only place we 809 // To avoid any chance of racing in unit tests, which is the only place we
809 // call this function, we may sometimes leak all the data structures we 810 // call this function, we may sometimes leak all the data structures we
810 // recovered, as they may still be in use on threads from prior tests! 811 // recovered, as they may still be in use on threads from prior tests!
811 if (leak) 812 if (leak) {
813 ThreadData* thread_data = thread_data_list;
814 while (thread_data) {
815 ANNOTATE_LEAKING_OBJECT_PTR(thread_data);
816 thread_data = thread_data->next();
817 }
812 return; 818 return;
819 }
813 820
814 // When we want to cleanup (on a single thread), here is what we do. 821 // When we want to cleanup (on a single thread), here is what we do.
815 822
816 // Do actual recursive delete in all ThreadData instances. 823 // Do actual recursive delete in all ThreadData instances.
817 while (thread_data_list) { 824 while (thread_data_list) {
818 ThreadData* next_thread_data = thread_data_list; 825 ThreadData* next_thread_data = thread_data_list;
819 thread_data_list = thread_data_list->next(); 826 thread_data_list = thread_data_list->next();
820 827
821 for (BirthMap::iterator it = next_thread_data->birth_map_.begin(); 828 for (BirthMap::iterator it = next_thread_data->birth_map_.begin();
822 next_thread_data->birth_map_.end() != it; ++it) 829 next_thread_data->birth_map_.end() != it; ++it)
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 : process_id(base::GetCurrentProcId()) { 870 : process_id(base::GetCurrentProcId()) {
864 #else 871 #else
865 : process_id(0) { 872 : process_id(0) {
866 #endif 873 #endif
867 } 874 }
868 875
869 ProcessDataSnapshot::~ProcessDataSnapshot() { 876 ProcessDataSnapshot::~ProcessDataSnapshot() {
870 } 877 }
871 878
872 } // namespace tracked_objects 879 } // namespace tracked_objects
OLDNEW
« no previous file with comments | « no previous file | tools/heapcheck/suppressions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698