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

Side by Side Diff: base/stats_table.cc

Issue 243102: Convert base dependencies to use sys_string_conversions instead of the ICU... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « base/process_util_mac.mm ('k') | base/string16.cc » ('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) 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/scoped_ptr.h" 10 #include "base/scoped_ptr.h"
11 #include "base/shared_memory.h" 11 #include "base/shared_memory.h"
12 #include "base/string_piece.h" 12 #include "base/string_piece.h"
13 #include "base/string_util.h" 13 #include "base/string_util.h"
14 #include "base/sys_string_conversions.h"
15 #include "base/thread_local_storage.h" 14 #include "base/thread_local_storage.h"
15 #include "base/utf_string_conversions.h"
16 16
17 #if defined(OS_POSIX) 17 #if defined(OS_POSIX)
18 #include "errno.h" 18 #include "errno.h"
19 #endif 19 #endif
20 20
21 // The StatsTable uses a shared memory segment that is laid out as follows 21 // The StatsTable uses a shared memory segment that is laid out as follows
22 // 22 //
23 // +-------------------------------------------+ 23 // +-------------------------------------------+
24 // | Version | Size | MaxCounters | MaxThreads | 24 // | Version | Size | MaxCounters | MaxThreads |
25 // +-------------------------------------------+ 25 // +-------------------------------------------+
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 char* counter_names_table_; 163 char* counter_names_table_;
164 int* data_table_; 164 int* data_table_;
165 }; 165 };
166 166
167 // static 167 // static
168 StatsTablePrivate* StatsTablePrivate::New(const std::string& name, 168 StatsTablePrivate* StatsTablePrivate::New(const std::string& name,
169 int size, 169 int size,
170 int max_threads, 170 int max_threads,
171 int max_counters) { 171 int max_counters) {
172 scoped_ptr<StatsTablePrivate> priv(new StatsTablePrivate()); 172 scoped_ptr<StatsTablePrivate> priv(new StatsTablePrivate());
173 if (!priv->shared_memory_.Create(base::SysUTF8ToWide(name), false, true, 173 if (!priv->shared_memory_.Create(UTF8ToWide(name), false, true, size))
174 size))
175 return NULL; 174 return NULL;
176 if (!priv->shared_memory_.Map(size)) 175 if (!priv->shared_memory_.Map(size))
177 return NULL; 176 return NULL;
178 void* memory = priv->shared_memory_.memory(); 177 void* memory = priv->shared_memory_.memory();
179 178
180 TableHeader* header = static_cast<TableHeader*>(memory); 179 TableHeader* header = static_cast<TableHeader*>(memory);
181 180
182 // If the version does not match, then assume the table needs 181 // If the version does not match, then assume the table needs
183 // to be initialized. 182 // to be initialized.
184 if (header->version != kTableVersion) 183 if (header->version != kTableVersion)
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 if (!slot && !(slot = table->RegisterThread(""))) 548 if (!slot && !(slot = table->RegisterThread("")))
550 return NULL; 549 return NULL;
551 550
552 // Find the counter id for the counter. 551 // Find the counter id for the counter.
553 std::string str_name(name); 552 std::string str_name(name);
554 int counter = table->FindCounter(str_name); 553 int counter = table->FindCounter(str_name);
555 554
556 // Now we can find the location in the table. 555 // Now we can find the location in the table.
557 return table->GetLocation(counter, slot); 556 return table->GetLocation(counter, slot);
558 } 557 }
OLDNEW
« no previous file with comments | « base/process_util_mac.mm ('k') | base/string16.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698