| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/stats_table.h" | 5 #include "base/stats_table.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/platform_thread.h" | 8 #include "base/platform_thread.h" |
| 9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
| 10 #include "base/shared_memory.h" | 10 #include "base/shared_memory.h" |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 // Mark the slot free by zeroing out the thread name. | 338 // Mark the slot free by zeroing out the thread name. |
| 339 wchar_t* name = impl_->thread_name(data->slot); | 339 wchar_t* name = impl_->thread_name(data->slot); |
| 340 *name = L'\0'; | 340 *name = L'\0'; |
| 341 | 341 |
| 342 // Remove the calling thread's TLS so that it cannot use the slot. | 342 // Remove the calling thread's TLS so that it cannot use the slot. |
| 343 tls_index_.Set(NULL); | 343 tls_index_.Set(NULL); |
| 344 delete data; | 344 delete data; |
| 345 } | 345 } |
| 346 | 346 |
| 347 void StatsTable::SlotReturnFunction(void* data) { | 347 void StatsTable::SlotReturnFunction(void* data) { |
| 348 // This is called by the TLS destructor, which on some platforms has |
| 349 // already cleared the TLS info, so use the tls_data argument |
| 350 // rather than trying to fetch it ourselves. |
| 348 StatsTableTLSData* tls_data = static_cast<StatsTableTLSData*>(data); | 351 StatsTableTLSData* tls_data = static_cast<StatsTableTLSData*>(data); |
| 349 if (tls_data) { | 352 if (tls_data) { |
| 350 DCHECK(tls_data->table); | 353 DCHECK(tls_data->table); |
| 351 tls_data->table->UnregisterThread(tls_data); | 354 tls_data->table->UnregisterThread(tls_data); |
| 352 } | 355 } |
| 353 } | 356 } |
| 354 | 357 |
| 355 int StatsTable::CountThreadsRegistered() const { | 358 int StatsTable::CountThreadsRegistered() const { |
| 356 if (!impl_) | 359 if (!impl_) |
| 357 return 0; | 360 return 0; |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 return NULL; | 549 return NULL; |
| 547 | 550 |
| 548 // Find the counter id for the counter. | 551 // Find the counter id for the counter. |
| 549 std::wstring str_name(name); | 552 std::wstring str_name(name); |
| 550 int counter = table->FindCounter(str_name); | 553 int counter = table->FindCounter(str_name); |
| 551 | 554 |
| 552 // Now we can find the location in the table. | 555 // Now we can find the location in the table. |
| 553 return table->GetLocation(counter, slot); | 556 return table->GetLocation(counter, slot); |
| 554 } | 557 } |
| 555 | 558 |
| OLD | NEW |