OLD | NEW |
1 // Copyright (c) 2011 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 #include "base/metrics/stats_table.h" | 5 #include "base/metrics/stats_table.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 | 424 |
425 int* StatsTable::FindLocation(const char* name) { | 425 int* StatsTable::FindLocation(const char* name) { |
426 // Get the static StatsTable | 426 // Get the static StatsTable |
427 StatsTable *table = StatsTable::current(); | 427 StatsTable *table = StatsTable::current(); |
428 if (!table) | 428 if (!table) |
429 return NULL; | 429 return NULL; |
430 | 430 |
431 // Get the slot for this thread. Try to register | 431 // Get the slot for this thread. Try to register |
432 // it if none exists. | 432 // it if none exists. |
433 int slot = table->GetSlot(); | 433 int slot = table->GetSlot(); |
434 if (!slot && !(slot = table->RegisterThread(""))) | 434 if (!slot && !(slot = table->RegisterThread(std::string()))) |
435 return NULL; | 435 return NULL; |
436 | 436 |
437 // Find the counter id for the counter. | 437 // Find the counter id for the counter. |
438 std::string str_name(name); | 438 std::string str_name(name); |
439 int counter = table->FindCounter(str_name); | 439 int counter = table->FindCounter(str_name); |
440 | 440 |
441 // Now we can find the location in the table. | 441 // Now we can find the location in the table. |
442 return table->GetLocation(counter, slot); | 442 return table->GetLocation(counter, slot); |
443 } | 443 } |
444 | 444 |
445 void StatsTable::UnregisterThread() { | 445 void StatsTable::UnregisterThread() { |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 static_cast<TLSData*>(tls_index_.Get()); | 551 static_cast<TLSData*>(tls_index_.Get()); |
552 if (!data) | 552 if (!data) |
553 return NULL; | 553 return NULL; |
554 | 554 |
555 DCHECK(data->slot); | 555 DCHECK(data->slot); |
556 DCHECK_EQ(data->table, this); | 556 DCHECK_EQ(data->table, this); |
557 return data; | 557 return data; |
558 } | 558 } |
559 | 559 |
560 } // namespace base | 560 } // namespace base |
OLD | NEW |