Chromium Code Reviews| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 161 char* counter_names_table_; | 161 char* counter_names_table_; |
| 162 int* data_table_; | 162 int* data_table_; |
| 163 }; | 163 }; |
| 164 | 164 |
| 165 // static | 165 // static |
| 166 StatsTable::Private* StatsTable::Private::New(const std::string& name, | 166 StatsTable::Private* StatsTable::Private::New(const std::string& name, |
| 167 int size, | 167 int size, |
| 168 int max_threads, | 168 int max_threads, |
| 169 int max_counters) { | 169 int max_counters) { |
| 170 scoped_ptr<Private> priv(new Private()); | 170 scoped_ptr<Private> priv(new Private()); |
| 171 if (!priv->shared_memory_.CreateNamed(name, true, size)) | 171 if (!priv->shared_memory_.CreateNamed(name, true, size, false)) |
|
Mark Mentovai
2011/11/29 20:10:44
I’m looking at uses like this. What’s true? What’s
| |
| 172 return NULL; | 172 return NULL; |
| 173 if (!priv->shared_memory_.Map(size)) | 173 if (!priv->shared_memory_.Map(size)) |
| 174 return NULL; | 174 return NULL; |
| 175 void* memory = priv->shared_memory_.memory(); | 175 void* memory = priv->shared_memory_.memory(); |
| 176 | 176 |
| 177 TableHeader* header = static_cast<TableHeader*>(memory); | 177 TableHeader* header = static_cast<TableHeader*>(memory); |
| 178 | 178 |
| 179 // If the version does not match, then assume the table needs | 179 // If the version does not match, then assume the table needs |
| 180 // to be initialized. | 180 // to be initialized. |
| 181 if (header->version != kTableVersion) | 181 if (header->version != kTableVersion) |
| (...skipping 369 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 |