diff options
31 files changed, 377 insertions, 376 deletions
diff --git a/base/histogram.cc b/base/histogram.cc index 384716d..2b05077 100644 --- a/base/histogram.cc +++ b/base/histogram.cc @@ -25,7 +25,7 @@ const int Histogram::kHexRangePrintingFlag = 0x8000; Histogram::Histogram(const wchar_t* name, Sample minimum, Sample maximum, size_t bucket_count) - : StatsRate(name), + : StatsRate(WideToASCII(name).c_str()), histogram_name_(WideToASCII(name)), declared_min_(minimum), declared_max_(maximum), @@ -39,7 +39,7 @@ Histogram::Histogram(const wchar_t* name, Sample minimum, Histogram::Histogram(const wchar_t* name, TimeDelta minimum, TimeDelta maximum, size_t bucket_count) - : StatsRate(name), + : StatsRate(WideToASCII(name).c_str()), histogram_name_(WideToASCII(name)), declared_min_(static_cast<int> (minimum.InMilliseconds())), declared_max_(static_cast<int> (maximum.InMilliseconds())), diff --git a/base/stats_counters.h b/base/stats_counters.h index 5dc7b89c..9927c19 100644 --- a/base/stats_counters.h +++ b/base/stats_counters.h @@ -74,10 +74,10 @@ class StatsCounter { public: // Create a StatsCounter object. - explicit StatsCounter(const std::wstring& name) + explicit StatsCounter(const std::string& name) : counter_id_(-1) { // We prepend the name with 'c:' to indicate that it is a counter. - name_ = L"c:"; + name_ = "c:"; name_.append(name); }; @@ -146,7 +146,7 @@ class StatsCounter { if (counter_id_ == -1) { counter_id_ = table->FindCounter(name_); if (table->GetSlot() == 0) { - if (!table->RegisterThread(L"")) { + if (!table->RegisterThread("")) { // There is no room for this thread. This thread // cannot use counters. counter_id_ = 0; @@ -163,7 +163,7 @@ class StatsCounter { return NULL; } - std::wstring name_; + std::string name_; // The counter id in the table. We initialize to -1 (an invalid value) // and then cache it once it has been looked up. The counter_id is // valid across all threads and processes. @@ -177,9 +177,9 @@ class StatsCounter { class StatsCounterTimer : protected StatsCounter { public: // Constructs and starts the timer. - explicit StatsCounterTimer(const std::wstring& name) { + explicit StatsCounterTimer(const std::string& name) { // we prepend the name with 't:' to indicate that it is a timer. - name_ = L"t:"; + name_ = "t:"; name_.append(name); } @@ -230,10 +230,10 @@ class StatsCounterTimer : protected StatsCounter { class StatsRate : public StatsCounterTimer { public: // Constructs and starts the timer. - explicit StatsRate(const wchar_t* name) + explicit StatsRate(const char* name) : StatsCounterTimer(name), counter_(name), - largest_add_(std::wstring(L" ").append(name).append(L"MAX").c_str()) { + largest_add_(std::string(" ").append(name).append("MAX").c_str()) { } virtual void Add(int value) { diff --git a/base/stats_table.cc b/base/stats_table.cc index 72cc5ab..1f25457 100644 --- a/base/stats_table.cc +++ b/base/stats_table.cc @@ -70,7 +70,7 @@ namespace { const int kTableVersion = 0x13131313; // The name for un-named counters and threads in the table. -const wchar_t kUnknownName[] = L"<unknown>"; +const char kUnknownName[] = "<unknown>"; // Calculates delta to align an offset to the size of an int inline int AlignOffset(int offset) { @@ -109,7 +109,7 @@ class StatsTablePrivate { // Construct a new StatsTablePrivate based on expected size parameters, or // return NULL on failure. - static StatsTablePrivate* New(const std::wstring& name, int size, + static StatsTablePrivate* New(const std::string& name, int size, int max_threads, int max_counters); base::SharedMemory* shared_memory() { return &shared_memory_; } @@ -122,7 +122,7 @@ class StatsTablePrivate { int max_threads() const { return table_header_->max_threads; } // Accessors for our tables - wchar_t* thread_name(int slot_id) const { + char* thread_name(int slot_id) const { return &thread_names_table_[ (slot_id-1) * (StatsTable::kMaxThreadNameLength)]; } @@ -132,7 +132,7 @@ class StatsTablePrivate { int* thread_pid(int slot_id) const { return &(thread_pid_table_[slot_id-1]); } - wchar_t* counter_name(int counter_id) const { + char* counter_name(int counter_id) const { return &counter_names_table_[ (counter_id-1) * (StatsTable::kMaxCounterNameLength)]; } @@ -154,21 +154,21 @@ class StatsTablePrivate { base::SharedMemory shared_memory_; TableHeader* table_header_; - wchar_t* thread_names_table_; + char* thread_names_table_; int* thread_tid_table_; int* thread_pid_table_; - wchar_t* counter_names_table_; + char* counter_names_table_; int* data_table_; }; // static -StatsTablePrivate* StatsTablePrivate::New(const std::wstring& name, +StatsTablePrivate* StatsTablePrivate::New(const std::string& name, int size, int max_threads, int max_counters) { scoped_ptr<StatsTablePrivate> priv(new StatsTablePrivate()); - if (!priv->shared_memory_.Create(name, false, true, size)) + if (!priv->shared_memory_.Create(UTF8ToWide(name), false, true, size)) return NULL; if (!priv->shared_memory_.Map(size)) return NULL; @@ -212,8 +212,8 @@ void StatsTablePrivate::ComputeMappedPointers(void* memory) { // Verify we're looking at a valid StatsTable. DCHECK_EQ(table_header_->version, kTableVersion); - thread_names_table_ = reinterpret_cast<wchar_t*>(data + offset); - offset += sizeof(wchar_t) * + thread_names_table_ = reinterpret_cast<char*>(data + offset); + offset += sizeof(char) * max_threads() * StatsTable::kMaxThreadNameLength; offset += AlignOffset(offset); @@ -225,8 +225,8 @@ void StatsTablePrivate::ComputeMappedPointers(void* memory) { offset += sizeof(int) * max_threads(); offset += AlignOffset(offset); - counter_names_table_ = reinterpret_cast<wchar_t*>(data + offset); - offset += sizeof(wchar_t) * + counter_names_table_ = reinterpret_cast<char*>(data + offset); + offset += sizeof(char) * max_counters() * StatsTable::kMaxCounterNameLength; offset += AlignOffset(offset); @@ -241,14 +241,14 @@ void StatsTablePrivate::ComputeMappedPointers(void* memory) { // We keep a singleton table which can be easily accessed. StatsTable* StatsTable::global_table_ = NULL; -StatsTable::StatsTable(const std::wstring& name, int max_threads, +StatsTable::StatsTable(const std::string& name, int max_threads, int max_counters) : impl_(NULL), tls_index_(SlotReturnFunction) { int table_size = AlignedSize(sizeof(StatsTablePrivate::TableHeader)) + - AlignedSize((max_counters * sizeof(wchar_t) * kMaxCounterNameLength)) + - AlignedSize((max_threads * sizeof(wchar_t) * kMaxThreadNameLength)) + + AlignedSize((max_counters * sizeof(char) * kMaxCounterNameLength)) + + AlignedSize((max_threads * sizeof(char) * kMaxThreadNameLength)) + AlignedSize(max_threads * sizeof(int)) + AlignedSize(max_threads * sizeof(int)) + AlignedSize((sizeof(int) * (max_counters * max_threads))); @@ -282,7 +282,7 @@ StatsTable::~StatsTable() { global_table_ = NULL; } -int StatsTable::RegisterThread(const std::wstring& name) { +int StatsTable::RegisterThread(const std::string& name) { int slot = 0; // Registering a thread requires that we lock the shared memory @@ -298,10 +298,10 @@ int StatsTable::RegisterThread(const std::wstring& name) { DCHECK(impl_); // We have space, so consume a column in the table. - std::wstring thread_name = name; + std::string thread_name = name; if (name.empty()) thread_name = kUnknownName; - base::wcslcpy(impl_->thread_name(slot), thread_name.c_str(), + base::strlcpy(impl_->thread_name(slot), thread_name.c_str(), kMaxThreadNameLength); *(impl_->thread_tid(slot)) = PlatformThread::CurrentId(); *(impl_->thread_pid(slot)) = base::GetCurrentProcId(); @@ -336,8 +336,8 @@ void StatsTable::UnregisterThread(StatsTableTLSData* data) { DCHECK(impl_); // Mark the slot free by zeroing out the thread name. - wchar_t* name = impl_->thread_name(data->slot); - *name = L'\0'; + char* name = impl_->thread_name(data->slot); + *name = '\0'; // Remove the calling thread's TLS so that it cannot use the slot. tls_index_.Set(NULL); @@ -363,8 +363,8 @@ int StatsTable::CountThreadsRegistered() const { // We intentionally do not lock the table during the operation. int count = 0; for (int index = 1; index <= impl_->max_threads(); index++) { - wchar_t* name = impl_->thread_name(index); - if (*name != L'\0') + char* name = impl_->thread_name(index); + if (*name != '\0') count++; } return count; @@ -391,7 +391,7 @@ int StatsTable::FindEmptyThread() const { int index = 1; for (; index <= impl_->max_threads(); index++) { - wchar_t* name = impl_->thread_name(index); + char* name = impl_->thread_name(index); if (!*name) break; } @@ -400,7 +400,7 @@ int StatsTable::FindEmptyThread() const { return index; } -int StatsTable::FindCounterOrEmptyRow(const std::wstring& name) const { +int StatsTable::FindCounterOrEmptyRow(const std::string& name) const { // Note: the API returns slots numbered from 1..N, although // internally, the array is 0..N-1. This is so that we can return // zero as "not found". @@ -413,16 +413,16 @@ int StatsTable::FindCounterOrEmptyRow(const std::wstring& name) const { int free_slot = 0; for (int index = 1; index <= impl_->max_counters(); index++) { - wchar_t* row_name = impl_->counter_name(index); + char* row_name = impl_->counter_name(index); if (!*row_name && !free_slot) free_slot = index; // save that we found a free slot - else if (!wcsncmp(row_name, name.c_str(), kMaxCounterNameLength)) + else if (!strncmp(row_name, name.c_str(), kMaxCounterNameLength)) return index; } return free_slot; } -int StatsTable::FindCounter(const std::wstring& name) { +int StatsTable::FindCounter(const std::string& name) { // Note: the API returns counters numbered from 1..N, although // internally, the array is 0..N-1. This is so that we can return // zero as "not found". @@ -444,7 +444,7 @@ int StatsTable::FindCounter(const std::wstring& name) { return AddCounter(name); } -int StatsTable::AddCounter(const std::wstring& name) { +int StatsTable::AddCounter(const std::string& name) { DCHECK(impl_); if (!impl_) @@ -461,10 +461,10 @@ int StatsTable::AddCounter(const std::wstring& name) { if (!counter_id) return 0; - std::wstring counter_name = name; + std::string counter_name = name; if (name.empty()) counter_name = kUnknownName; - base::wcslcpy(impl_->counter_name(counter_id), counter_name.c_str(), + base::strlcpy(impl_->counter_name(counter_id), counter_name.c_str(), kMaxCounterNameLength); } @@ -486,7 +486,7 @@ int* StatsTable::GetLocation(int counter_id, int slot_id) const { return &(row[slot_id-1]); } -const wchar_t* StatsTable::GetRowName(int index) const { +const char* StatsTable::GetRowName(int index) const { if (!impl_) return NULL; @@ -510,7 +510,7 @@ int StatsTable::GetRowValue(int index) const { return GetRowValue(index, 0); } -int StatsTable::GetCounterValue(const std::wstring& name, int pid) { +int StatsTable::GetCounterValue(const std::string& name, int pid) { if (!impl_) return 0; @@ -520,7 +520,7 @@ int StatsTable::GetCounterValue(const std::wstring& name, int pid) { return GetRowValue(row, pid); } -int StatsTable::GetCounterValue(const std::wstring& name) { +int StatsTable::GetCounterValue(const std::string& name) { return GetCounterValue(name, 0); } @@ -536,7 +536,7 @@ int StatsTable::GetMaxThreads() const { return impl_->max_threads(); } -int* StatsTable::FindLocation(const wchar_t* name) { +int* StatsTable::FindLocation(const char* name) { // Get the static StatsTable StatsTable *table = StatsTable::current(); if (!table) @@ -545,11 +545,11 @@ int* StatsTable::FindLocation(const wchar_t* name) { // Get the slot for this thread. Try to register // it if none exists. int slot = table->GetSlot(); - if (!slot && !(slot = table->RegisterThread(L""))) + if (!slot && !(slot = table->RegisterThread(""))) return NULL; // Find the counter id for the counter. - std::wstring str_name(name); + std::string str_name(name); int counter = table->FindCounter(str_name); // Now we can find the location in the table. diff --git a/base/stats_table.h b/base/stats_table.h index 48da71a..18fb3dba 100644 --- a/base/stats_table.h +++ b/base/stats_table.h @@ -46,7 +46,7 @@ class StatsTable { // // max_counters is the maximum number of counters the table will support. // If the StatsTable already exists, this number is ignored. - StatsTable(const std::wstring& name, int max_threads, int max_counters); + StatsTable(const std::string& name, int max_threads, int max_counters); // Destroys the StatsTable. When the last StatsTable is destroyed // (across all processes), the StatsTable is removed from disk. @@ -74,7 +74,7 @@ class StatsTable { // // On success, returns the slot id for this thread. On failure, // returns 0. - int RegisterThread(const std::wstring& name); + int RegisterThread(const std::string& name); // Returns the number of threads currently registered. This is really not // useful except for diagnostics and debugging. @@ -86,7 +86,7 @@ class StatsTable { // If the counter does not exist, attempts to create a row for the new // counter. If there is no space in the table for the new counter, // returns 0. - int FindCounter(const std::wstring& name); + int FindCounter(const std::string& name); // TODO(mbelshe): implement RemoveCounter. @@ -96,7 +96,7 @@ class StatsTable { // Gets the counter name at a particular row. If the row is empty, // returns NULL. - const wchar_t* GetRowName(int index) const; + const char* GetRowName(int index) const; // Gets the sum of the values for a particular row. int GetRowValue(int index) const; @@ -106,11 +106,11 @@ class StatsTable { // Gets the sum of the values for a particular counter. If the counter // does not exist, creates the counter. - int GetCounterValue(const std::wstring& name); + int GetCounterValue(const std::string& name); // Gets the sum of the values for a particular counter for a given pid. // If the counter does not exist, creates the counter. - int GetCounterValue(const std::wstring& name, int pid); + int GetCounterValue(const std::string& name, int pid); // The maxinum number of counters/rows in the table. int GetMaxCounters() const; @@ -129,7 +129,7 @@ class StatsTable { // Convenience function to lookup a counter location for a // counter by name for the calling thread. Will register // the thread if it is not already registered. - static int* FindLocation(const wchar_t *name); + static int* FindLocation(const char *name); private: // Returns the space occupied by a thread in the table. Generally used @@ -154,7 +154,7 @@ class StatsTable { // Locates a counter in the table or finds an empty row. Returns a // number > 0 on success, or 0 on failure. The caller must hold the // shared_memory_lock when calling this function. - int FindCounterOrEmptyRow(const std::wstring& name) const; + int FindCounterOrEmptyRow(const std::string& name) const; // Internal function to add a counter to the StatsTable. Assumes that // the counter does not already exist in the table. @@ -164,13 +164,13 @@ class StatsTable { // // On success, returns the counter_id for the newly added counter. // On failure, returns 0. - int AddCounter(const std::wstring& name); + int AddCounter(const std::string& name); // Get the TLS data for the calling thread. Returns NULL if none is // initialized. StatsTableTLSData* GetTLSData() const; - typedef base::hash_map<std::wstring, int> CountersMap; + typedef base::hash_map<std::string, int> CountersMap; bool opened_; StatsTablePrivate* impl_; diff --git a/base/stats_table_unittest.cc b/base/stats_table_unittest.cc index 68a07ac..59b1215 100644 --- a/base/stats_table_unittest.cc +++ b/base/stats_table_unittest.cc @@ -24,27 +24,27 @@ class StatsTableTest : public MultiProcessTest { // Open a StatsTable and verify that we can write to each of the // locations in the table. TEST_F(StatsTableTest, VerifySlots) { - const std::wstring kTableName = L"VerifySlotsStatTable"; + const std::string kTableName = "VerifySlotsStatTable"; const int kMaxThreads = 1; const int kMaxCounter = 5; StatsTable table(kTableName, kMaxThreads, kMaxCounter); // Register a single thread. - std::wstring thread_name = L"mainThread"; + std::string thread_name = "mainThread"; int slot_id = table.RegisterThread(thread_name); EXPECT_TRUE(slot_id); // Fill up the table with counters. - std::wstring counter_base_name = L"counter"; + std::string counter_base_name = "counter"; for (int index=0; index < kMaxCounter; index++) { - std::wstring counter_name = counter_base_name; - StringAppendF(&counter_name, L"counter.ctr%d", index); + std::string counter_name = counter_base_name; + StringAppendF(&counter_name, "counter.ctr%d", index); int counter_id = table.FindCounter(counter_name); EXPECT_GT(counter_id, 0); } // Try to allocate an additional thread. Verify it fails. - slot_id = table.RegisterThread(L"too many threads"); + slot_id = table.RegisterThread("too many threads"); EXPECT_EQ(slot_id, 0); // Try to allocate an additional counter. Verify it fails. @@ -53,16 +53,16 @@ TEST_F(StatsTableTest, VerifySlots) { } // CounterZero will continually be set to 0. -const std::wstring kCounterZero = L"CounterZero"; +const std::string kCounterZero = "CounterZero"; // Counter1313 will continually be set to 1313. -const std::wstring kCounter1313 = L"Counter1313"; +const std::string kCounter1313 = "Counter1313"; // CounterIncrement will be incremented each time. -const std::wstring kCounterIncrement = L"CounterIncrement"; +const std::string kCounterIncrement = "CounterIncrement"; // CounterDecrement will be decremented each time. -const std::wstring kCounterDecrement = L"CounterDecrement"; +const std::string kCounterDecrement = "CounterDecrement"; // CounterMixed will be incremented by odd numbered threads and // decremented by even threads. -const std::wstring kCounterMixed = L"CounterMixed"; +const std::string kCounterMixed = "CounterMixed"; // The number of thread loops that we will do. const int kThreadLoops = 1000; @@ -101,7 +101,7 @@ void StatsTableThread::Run() { // Create a few threads and have them poke on their counters. TEST_F(StatsTableTest, MultipleThreads) { // Create a stats table. - const std::wstring kTableName = L"MultipleThreadStatTable"; + const std::string kTableName = "MultipleThreadStatTable"; const int kMaxThreads = 20; const int kMaxCounter = 5; StatsTable table(kTableName, kMaxThreads, kMaxCounter); @@ -133,25 +133,25 @@ TEST_F(StatsTableTest, MultipleThreads) { StatsCounter mixed_counter(kCounterMixed); // Verify the various counters are correct. - std::wstring name; - name = L"c:" + kCounterZero; + std::string name; + name = "c:" + kCounterZero; EXPECT_EQ(0, table.GetCounterValue(name)); - name = L"c:" + kCounter1313; + name = "c:" + kCounter1313; EXPECT_EQ(1313 * kMaxThreads, table.GetCounterValue(name)); - name = L"c:" + kCounterIncrement; + name = "c:" + kCounterIncrement; EXPECT_EQ(kMaxThreads * kThreadLoops, table.GetCounterValue(name)); - name = L"c:" + kCounterDecrement; + name = "c:" + kCounterDecrement; EXPECT_EQ(-kMaxThreads * kThreadLoops, table.GetCounterValue(name)); - name = L"c:" + kCounterMixed; + name = "c:" + kCounterMixed; EXPECT_EQ((kMaxThreads % 2) * kThreadLoops, table.GetCounterValue(name)); EXPECT_EQ(0, table.CountThreadsRegistered()); } -const std::wstring kTableName = L"MultipleProcessStatTable"; +const std::string kTableName = "MultipleProcessStatTable"; MULTIPROCESS_TEST_MAIN(StatsTableMultipleProcessMain) { // Each process will open the shared memory and set counters @@ -177,7 +177,7 @@ MULTIPROCESS_TEST_MAIN(StatsTableMultipleProcessMain) { // Create a few processes and have them poke on their counters. TEST_F(StatsTableTest, MultipleProcesses) { // Create a stats table. - const std::wstring kTableName = L"MultipleProcessStatTable"; + const std::string kTableName = "MultipleProcessStatTable"; const int kMaxProcs = 20; const int kMaxCounter = 5; StatsTable table(kTableName, kMaxProcs, kMaxCounter); @@ -207,16 +207,16 @@ TEST_F(StatsTableTest, MultipleProcesses) { StatsCounter decrement_counter(kCounterDecrement); // Verify the various counters are correct. - std::wstring name; - name = L"c:" + kCounterZero; + std::string name; + name = "c:" + kCounterZero; EXPECT_EQ(0, table.GetCounterValue(name)); - name = L"c:" + kCounter1313; + name = "c:" + kCounter1313; EXPECT_EQ(1313 * kMaxProcs, table.GetCounterValue(name)); - name = L"c:" + kCounterIncrement; + name = "c:" + kCounterIncrement; EXPECT_EQ(kMaxProcs * kThreadLoops, table.GetCounterValue(name)); - name = L"c:" + kCounterDecrement; + name = "c:" + kCounterDecrement; EXPECT_EQ(-kMaxProcs * kThreadLoops, table.GetCounterValue(name)); EXPECT_EQ(0, table.CountThreadsRegistered()); @@ -224,7 +224,7 @@ TEST_F(StatsTableTest, MultipleProcesses) { class MockStatsCounter : public StatsCounter { public: - MockStatsCounter(const std::wstring& name) + MockStatsCounter(const std::string& name) : StatsCounter(name) {} int* Pointer() { return GetPtr(); } }; @@ -232,50 +232,50 @@ class MockStatsCounter : public StatsCounter { // Test some basic StatsCounter operations TEST_F(StatsTableTest, StatsCounter) { // Create a stats table. - const std::wstring kTableName = L"StatTable"; + const std::string kTableName = "StatTable"; const int kMaxThreads = 20; const int kMaxCounter = 5; StatsTable table(kTableName, kMaxThreads, kMaxCounter); StatsTable::set_current(&table); - MockStatsCounter foo(L"foo"); + MockStatsCounter foo("foo"); // Test initial state. EXPECT_TRUE(foo.Enabled()); EXPECT_NE(foo.Pointer(), static_cast<int*>(0)); - EXPECT_EQ(0, table.GetCounterValue(L"c:foo")); + EXPECT_EQ(0, table.GetCounterValue("c:foo")); EXPECT_EQ(0, *(foo.Pointer())); // Test Increment. while(*(foo.Pointer()) < 123) foo.Increment(); - EXPECT_EQ(123, table.GetCounterValue(L"c:foo")); + EXPECT_EQ(123, table.GetCounterValue("c:foo")); foo.Add(0); - EXPECT_EQ(123, table.GetCounterValue(L"c:foo")); + EXPECT_EQ(123, table.GetCounterValue("c:foo")); foo.Add(-1); - EXPECT_EQ(122, table.GetCounterValue(L"c:foo")); + EXPECT_EQ(122, table.GetCounterValue("c:foo")); // Test Set. foo.Set(0); - EXPECT_EQ(0, table.GetCounterValue(L"c:foo")); + EXPECT_EQ(0, table.GetCounterValue("c:foo")); foo.Set(100); - EXPECT_EQ(100, table.GetCounterValue(L"c:foo")); + EXPECT_EQ(100, table.GetCounterValue("c:foo")); foo.Set(-1); - EXPECT_EQ(-1, table.GetCounterValue(L"c:foo")); + EXPECT_EQ(-1, table.GetCounterValue("c:foo")); foo.Set(0); - EXPECT_EQ(0, table.GetCounterValue(L"c:foo")); + EXPECT_EQ(0, table.GetCounterValue("c:foo")); // Test Decrement. foo.Decrement(1); - EXPECT_EQ(-1, table.GetCounterValue(L"c:foo")); + EXPECT_EQ(-1, table.GetCounterValue("c:foo")); foo.Decrement(0); - EXPECT_EQ(-1, table.GetCounterValue(L"c:foo")); + EXPECT_EQ(-1, table.GetCounterValue("c:foo")); foo.Decrement(-1); - EXPECT_EQ(0, table.GetCounterValue(L"c:foo")); + EXPECT_EQ(0, table.GetCounterValue("c:foo")); } class MockStatsCounterTimer : public StatsCounterTimer { public: - MockStatsCounterTimer(const std::wstring& name) + MockStatsCounterTimer(const std::string& name) : StatsCounterTimer(name) {} TimeTicks start_time() { return start_time_; } @@ -285,13 +285,13 @@ class MockStatsCounterTimer : public StatsCounterTimer { // Test some basic StatsCounterTimer operations TEST_F(StatsTableTest, StatsCounterTimer) { // Create a stats table. - const std::wstring kTableName = L"StatTable"; + const std::string kTableName = "StatTable"; const int kMaxThreads = 20; const int kMaxCounter = 5; StatsTable table(kTableName, kMaxThreads, kMaxCounter); StatsTable::set_current(&table); - MockStatsCounterTimer bar(L"bar"); + MockStatsCounterTimer bar("bar"); // Test initial state. EXPECT_FALSE(bar.Running()); @@ -302,62 +302,62 @@ TEST_F(StatsTableTest, StatsCounterTimer) { bar.Start(); PlatformThread::Sleep(500); bar.Stop(); - EXPECT_LE(500, table.GetCounterValue(L"t:bar")); + EXPECT_LE(500, table.GetCounterValue("t:bar")); // Verify that timing again is additive. bar.Start(); PlatformThread::Sleep(500); bar.Stop(); - EXPECT_LE(1000, table.GetCounterValue(L"t:bar")); + EXPECT_LE(1000, table.GetCounterValue("t:bar")); } // Test some basic StatsRate operations TEST_F(StatsTableTest, StatsRate) { // Create a stats table. - const std::wstring kTableName = L"StatTable"; + const std::string kTableName = "StatTable"; const int kMaxThreads = 20; const int kMaxCounter = 5; StatsTable table(kTableName, kMaxThreads, kMaxCounter); StatsTable::set_current(&table); - StatsRate baz(L"baz"); + StatsRate baz("baz"); // Test initial state. EXPECT_FALSE(baz.Running()); - EXPECT_EQ(0, table.GetCounterValue(L"c:baz")); - EXPECT_EQ(0, table.GetCounterValue(L"t:baz")); + EXPECT_EQ(0, table.GetCounterValue("c:baz")); + EXPECT_EQ(0, table.GetCounterValue("t:baz")); // Do some timing. baz.Start(); PlatformThread::Sleep(500); baz.Stop(); - EXPECT_EQ(1, table.GetCounterValue(L"c:baz")); - EXPECT_LE(500, table.GetCounterValue(L"t:baz")); + EXPECT_EQ(1, table.GetCounterValue("c:baz")); + EXPECT_LE(500, table.GetCounterValue("t:baz")); // Verify that timing again is additive. baz.Start(); PlatformThread::Sleep(500); baz.Stop(); - EXPECT_EQ(2, table.GetCounterValue(L"c:baz")); - EXPECT_LE(1000, table.GetCounterValue(L"t:baz")); + EXPECT_EQ(2, table.GetCounterValue("c:baz")); + EXPECT_LE(1000, table.GetCounterValue("t:baz")); } // Test some basic StatsScope operations TEST_F(StatsTableTest, StatsScope) { // Create a stats table. - const std::wstring kTableName = L"StatTable"; + const std::string kTableName = "StatTable"; const int kMaxThreads = 20; const int kMaxCounter = 5; StatsTable table(kTableName, kMaxThreads, kMaxCounter); StatsTable::set_current(&table); - StatsCounterTimer foo(L"foo"); - StatsRate bar(L"bar"); + StatsCounterTimer foo("foo"); + StatsRate bar("bar"); // Test initial state. - EXPECT_EQ(0, table.GetCounterValue(L"t:foo")); - EXPECT_EQ(0, table.GetCounterValue(L"t:bar")); - EXPECT_EQ(0, table.GetCounterValue(L"c:bar")); + EXPECT_EQ(0, table.GetCounterValue("t:foo")); + EXPECT_EQ(0, table.GetCounterValue("t:bar")); + EXPECT_EQ(0, table.GetCounterValue("c:bar")); // Try a scope. { @@ -365,9 +365,9 @@ TEST_F(StatsTableTest, StatsScope) { StatsScope<StatsRate> timer2(bar); PlatformThread::Sleep(500); } - EXPECT_LE(500, table.GetCounterValue(L"t:foo")); - EXPECT_LE(500, table.GetCounterValue(L"t:bar")); - EXPECT_EQ(1, table.GetCounterValue(L"c:bar")); + EXPECT_LE(500, table.GetCounterValue("t:foo")); + EXPECT_LE(500, table.GetCounterValue("t:bar")); + EXPECT_EQ(1, table.GetCounterValue("c:bar")); // Try a second scope. { @@ -375,9 +375,9 @@ TEST_F(StatsTableTest, StatsScope) { StatsScope<StatsRate> timer2(bar); PlatformThread::Sleep(500); } - EXPECT_LE(1000, table.GetCounterValue(L"t:foo")); - EXPECT_LE(1000, table.GetCounterValue(L"t:bar")); - EXPECT_EQ(2, table.GetCounterValue(L"c:bar")); + EXPECT_LE(1000, table.GetCounterValue("t:foo")); + EXPECT_LE(1000, table.GetCounterValue("t:bar")); + EXPECT_EQ(2, table.GetCounterValue("c:bar")); } } // namespace base diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc index 2beeffb..4922118 100644 --- a/chrome/browser/browser_about_handler.cc +++ b/chrome/browser/browser_about_handler.cc @@ -383,17 +383,17 @@ std::string BrowserAboutHandler::AboutStats() { // NOTE: Counters start at index 1. for (int index = 1; index <= table->GetMaxCounters(); index++) { // Get the counter's full name - std::wstring full_name = table->GetRowName(index); + std::string full_name = table->GetRowName(index); if (full_name.length() == 0) break; - DCHECK(full_name[1] == L':'); - wchar_t counter_type = full_name[0]; - std::wstring name = full_name.substr(2); + DCHECK(full_name[1] == ':'); + char counter_type = full_name[0]; + std::string name = full_name.substr(2); // JSON doesn't allow '.' in names. size_t pos; - while ( ( pos = name.find(L".") ) != -1 ) - name.replace(pos, 1, L":"); + while ((pos = name.find(".")) != -1) + name.replace(pos, 1, ":"); // Try to see if this name already exists. DictionaryValue* counter = NULL; @@ -403,7 +403,7 @@ std::string BrowserAboutHandler::AboutStats() { if (counters->GetDictionary(scan_index, &dictionary)) { std::wstring scan_name; if (dictionary->GetString(L"name", &scan_name) && - scan_name == name) { + WideToASCII(scan_name) == name) { counter = dictionary; } } else { @@ -413,12 +413,12 @@ std::string BrowserAboutHandler::AboutStats() { if (counter == NULL) { counter = new DictionaryValue(); - counter->SetString(L"name", name); + counter->SetString(L"name", ASCIIToWide(name)); counters->Append(counter); } switch (counter_type) { - case L'c': + case 'c': { int new_value = table->GetRowValue(index); int prior_value = 0; @@ -430,12 +430,12 @@ std::string BrowserAboutHandler::AboutStats() { counter->SetInteger(L"delta", delta); } break; - case L'm': + case 'm': { // TODO(mbelshe): implement me. } break; - case L't': + case 't': { int time = table->GetRowValue(index); counter->SetInteger(L"time", time); diff --git a/chrome/browser/jankometer.cc b/chrome/browser/jankometer.cc index d67f51c..9247484 100644 --- a/chrome/browser/jankometer.cc +++ b/chrome/browser/jankometer.cc @@ -51,7 +51,7 @@ const bool kPlaySounds = false; class JankWatchdog : public Watchdog { public: JankWatchdog(const TimeDelta& duration, - const std::wstring& thread_watched_name, + const std::string& thread_watched_name, bool enabled) : Watchdog(duration, thread_watched_name, enabled), thread_name_watched_(thread_watched_name), @@ -68,7 +68,7 @@ class JankWatchdog : public Watchdog { } private: - std::wstring thread_name_watched_; + std::string thread_name_watched_; int alarm_count_; DISALLOW_EVIL_CONSTRUCTORS(JankWatchdog); @@ -78,17 +78,17 @@ class JankWatchdog : public Watchdog { class JankObserver : public base::RefCountedThreadSafe<JankObserver>, public MessageLoopForUI::Observer { public: - JankObserver(const wchar_t* thread_name, + JankObserver(const char* thread_name, const TimeDelta& excessive_duration, bool watchdog_enable) : MaxMessageDelay_(excessive_duration), - slow_processing_counter_(std::wstring(L"Chrome.SlowMsg") + thread_name), - queueing_delay_counter_(std::wstring(L"Chrome.DelayMsg") + thread_name), + slow_processing_counter_(std::string("Chrome.SlowMsg") + thread_name), + queueing_delay_counter_(std::string("Chrome.DelayMsg") + thread_name), process_times_((std::wstring(L"Chrome.ProcMsgL ") - + thread_name).c_str(), 1, 3600000, 50), + + ASCIIToWide(thread_name)).c_str(), 1, 3600000, 50), total_times_((std::wstring(L"Chrome.TotalMsgL ") - + thread_name).c_str(), 1, 3600000, 50), - total_time_watchdog_(excessive_duration, std::wstring(thread_name), + + ASCIIToWide(thread_name)).c_str(), 1, 3600000, 50), + total_time_watchdog_(excessive_duration, ASCIIToWide(thread_name), watchdog_enable) { process_times_.SetFlags(kUmaTargetedHistogramFlag); total_times_.SetFlags(kUmaTargetedHistogramFlag); @@ -192,7 +192,7 @@ void InstallJankometer(const CommandLine &parsed_command_line) { // Install on the UI thread. ui_observer = new JankObserver( - L"UI", + "UI", TimeDelta::FromMilliseconds(kMaxUIMessageDelayMs), ui_watchdog_enabled); ui_observer->AddRef(); @@ -202,7 +202,7 @@ void InstallJankometer(const CommandLine &parsed_command_line) { // interaction with web pages. We must proxy to that thread before we can // add our observer. io_observer = new JankObserver( - L"IO", + "IO", TimeDelta::FromMilliseconds(kMaxIOMessageDelayMs), io_watchdog_enabled); io_observer->AddRef(); diff --git a/chrome/browser/safe_browsing/safe_browsing_database_bloom.cc b/chrome/browser/safe_browsing/safe_browsing_database_bloom.cc index f7eaeeb..6f2740f 100644 --- a/chrome/browser/safe_browsing/safe_browsing_database_bloom.cc +++ b/chrome/browser/safe_browsing/safe_browsing_database_bloom.cc @@ -441,7 +441,7 @@ void SafeBrowsingDatabaseBloom::UpdateFinished(bool update_succeeded) { } void SafeBrowsingDatabaseBloom::InsertAdd(SBPrefix host, SBEntry* entry) { - STATS_COUNTER(L"SB.HostInsert", 1); + STATS_COUNTER("SB.HostInsert", 1); int encoded = EncodeChunkId(entry->chunk_id(), entry->list_id()); if (entry->type() == SBEntry::ADD_FULL_HASH) { @@ -470,7 +470,7 @@ void SafeBrowsingDatabaseBloom::InsertAdd(SBPrefix host, SBEntry* entry) { void SafeBrowsingDatabaseBloom::InsertAddPrefix(SBPrefix prefix, int encoded_chunk) { - STATS_COUNTER(L"SB.PrefixAdd", 1); + STATS_COUNTER("SB.PrefixAdd", 1); std::string sql = "INSERT INTO add_prefix (chunk, prefix) VALUES (?, ?)"; SQLITE_UNIQUE_STATEMENT(statement, *statement_cache_, sql.c_str()); if (!statement.is_valid()) { @@ -493,7 +493,7 @@ void SafeBrowsingDatabaseBloom::InsertAddFullHash(SBPrefix prefix, int encoded_chunk, base::Time receive_time, SBFullHash full_prefix) { - STATS_COUNTER(L"SB.PrefixAddFull", 1); + STATS_COUNTER("SB.PrefixAddFull", 1); std::string sql = "INSERT INTO add_full_hash " "(chunk, prefix, receive_time, full_hash) " "VALUES (?,?,?,?)"; @@ -518,7 +518,7 @@ void SafeBrowsingDatabaseBloom::InsertAddFullHash(SBPrefix prefix, void SafeBrowsingDatabaseBloom::InsertSub( int chunk_id, SBPrefix host, SBEntry* entry) { - STATS_COUNTER(L"SB.HostDelete", 1); + STATS_COUNTER("SB.HostDelete", 1); int encoded = EncodeChunkId(chunk_id, entry->list_id()); int encoded_add; @@ -550,7 +550,7 @@ void SafeBrowsingDatabaseBloom::InsertSub( void SafeBrowsingDatabaseBloom::InsertSubPrefix(SBPrefix prefix, int encoded_chunk, int encoded_add_chunk) { - STATS_COUNTER(L"SB.PrefixSub", 1); + STATS_COUNTER("SB.PrefixSub", 1); std::string sql = "INSERT INTO sub_prefix (chunk, add_chunk, prefix) VALUES (?,?,?)"; SQLITE_UNIQUE_STATEMENT(statement, *statement_cache_, sql.c_str()); @@ -575,7 +575,7 @@ void SafeBrowsingDatabaseBloom::InsertSubFullHash(SBPrefix prefix, int encoded_add_chunk, SBFullHash full_prefix, bool use_temp_table) { - STATS_COUNTER(L"SB.PrefixSubFull", 1); + STATS_COUNTER("SB.PrefixSubFull", 1); std::string sql = "INSERT INTO "; if (use_temp_table) { sql += "sub_full_tmp"; @@ -658,7 +658,7 @@ void SafeBrowsingDatabaseBloom::DeleteChunks( bool SafeBrowsingDatabaseBloom::ChunkExists(int list_id, ChunkType type, int chunk_id) { - STATS_COUNTER(L"SB.ChunkSelect", 1); + STATS_COUNTER("SB.ChunkSelect", 1); int encoded = EncodeChunkId(chunk_id, list_id); bool ret; if (type == ADD_CHUNK) @@ -866,7 +866,7 @@ int SafeBrowsingDatabaseBloom::PairCompare(const void* arg1, const void* arg2) { bool SafeBrowsingDatabaseBloom::BuildAddPrefixList(SBPair* adds) { // Read add_prefix into memory and sort it. - STATS_COUNTER(L"SB.HostSelectForBloomFilter", 1); + STATS_COUNTER("SB.HostSelectForBloomFilter", 1); SQLITE_UNIQUE_STATEMENT(add_prefix, *statement_cache_, "SELECT chunk, prefix FROM add_prefix"); if (!add_prefix.is_valid()) { diff --git a/chrome/browser/safe_browsing/safe_browsing_database_impl.cc b/chrome/browser/safe_browsing/safe_browsing_database_impl.cc index 6d61fd9..47c0e85 100644 --- a/chrome/browser/safe_browsing/safe_browsing_database_impl.cc +++ b/chrome/browser/safe_browsing/safe_browsing_database_impl.cc @@ -362,7 +362,7 @@ void SafeBrowsingDatabaseImpl::CheckUrl(const std::string& host, bool SafeBrowsingDatabaseImpl::ReadInfo(int host_key, SBHostInfo* info, int* id) { - STATS_COUNTER(L"SB.HostSelect", 1); + STATS_COUNTER("SB.HostSelect", 1); SQLITE_UNIQUE_STATEMENT(statement, *statement_cache_, "SELECT id, entries FROM hosts WHERE host=?"); if (!statement.is_valid()) { @@ -416,9 +416,9 @@ void SafeBrowsingDatabaseImpl::WriteInfo(int host_key, int start_index = 0; if (id != 0) { statement->bind_int(start_index++, id); - STATS_COUNTER(L"SB.HostReplace", 1); + STATS_COUNTER("SB.HostReplace", 1); } else { - STATS_COUNTER(L"SB.HostInsert", 1); + STATS_COUNTER("SB.HostInsert", 1); } statement->bind_int(start_index++, host_key); @@ -433,7 +433,7 @@ void SafeBrowsingDatabaseImpl::WriteInfo(int host_key, } void SafeBrowsingDatabaseImpl::DeleteInfo(int host_key) { - STATS_COUNTER(L"SB.HostDelete", 1); + STATS_COUNTER("SB.HostDelete", 1); SQLITE_UNIQUE_STATEMENT(statement, *statement_cache_, "DELETE FROM hosts WHERE host=?"); if (!statement.is_valid()) { @@ -704,7 +704,7 @@ void SafeBrowsingDatabaseImpl::DeleteChunks( void SafeBrowsingDatabaseImpl::AddDel(const std::string& list_name, int add_chunk_id) { - STATS_COUNTER(L"SB.ChunkSelect", 1); + STATS_COUNTER("SB.ChunkSelect", 1); int list_id = GetListID(list_name); // Find all the prefixes that came from the given add_chunk_id. SQLITE_UNIQUE_STATEMENT(statement, *statement_cache_, @@ -777,7 +777,7 @@ void SafeBrowsingDatabaseImpl::SubDel(const std::string& list_name, void SafeBrowsingDatabaseImpl::AddChunkInformation( int list_id, ChunkType type, int chunk_id, const std::string& hostkeys) { - STATS_COUNTER(L"SB.ChunkInsert", 1); + STATS_COUNTER("SB.ChunkInsert", 1); SQLITE_UNIQUE_STATEMENT(statement, *statement_cache_, "INSERT INTO chunks (list_id, chunk_type, chunk_id, hostkeys) " "VALUES (?,?,?,?)"); @@ -827,7 +827,7 @@ void SafeBrowsingDatabaseImpl::GetChunkIds(int list_id, ChunkType type, std::string* list) { list->clear(); - STATS_COUNTER(L"SB.ChunkSelect", 1); + STATS_COUNTER("SB.ChunkSelect", 1); SQLITE_UNIQUE_STATEMENT(statement, *statement_cache_, "SELECT chunk_id FROM chunks WHERE list_id=? AND chunk_type=? " "ORDER BY chunk_id"); @@ -859,7 +859,7 @@ void SafeBrowsingDatabaseImpl::GetChunkIds(int list_id, bool SafeBrowsingDatabaseImpl::ChunkExists(int list_id, ChunkType type, int chunk_id) { - STATS_COUNTER(L"SB.ChunkSelect", 1); + STATS_COUNTER("SB.ChunkSelect", 1); SQLITE_UNIQUE_STATEMENT(statement, *statement_cache_, "SELECT chunk_id FROM chunks WHERE" " list_id=? AND chunk_type=? AND chunk_id=?"); @@ -883,7 +883,7 @@ void SafeBrowsingDatabaseImpl::RemoveChunkId(int list_id, ChunkType type, int chunk_id) { // Also remove the add chunk id from add_chunks - STATS_COUNTER(L"SB.ChunkDelete", 1); + STATS_COUNTER("SB.ChunkDelete", 1); SQLITE_UNIQUE_STATEMENT(statement, *statement_cache_, "DELETE FROM chunks WHERE list_id=? AND chunk_type=? AND chunk_id=?"); if (!statement.is_valid()) { @@ -995,7 +995,7 @@ void SafeBrowsingDatabaseImpl::BuildBloomFilter() { void SafeBrowsingDatabaseImpl::OnReadHostKeys(int start_id) { // Since reading all the keys in one go could take > 20 seconds, instead we // read them in small chunks. - STATS_COUNTER(L"SB.HostSelectForBloomFilter", 1); + STATS_COUNTER("SB.HostSelectForBloomFilter", 1); SQLITE_UNIQUE_STATEMENT(statement, *statement_cache_, "SELECT host,id FROM hosts WHERE id > ? ORDER BY id"); if (!statement.is_valid()) { @@ -1087,7 +1087,7 @@ void SafeBrowsingDatabaseImpl::BeginTransaction() { void SafeBrowsingDatabaseImpl::EndTransaction() { if (--transaction_count_ == 0) { if (transaction_.get() != NULL) { - STATS_COUNTER(L"SB.TransactionCommit", 1); + STATS_COUNTER("SB.TransactionCommit", 1); transaction_->Commit(); transaction_.reset(); } diff --git a/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc index 15d437a..d63b131 100644 --- a/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc +++ b/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc @@ -1011,14 +1011,9 @@ TEST(SafeBrowsingDatabase, HashCaching) { TearDownTestDatabase(database); } -void PrintStat(const wchar_t* name) { -#if defined(OS_WIN) +void PrintStat(const char* name) { int value = StatsTable::current()->GetCounterValue(name); - LOG(INFO) << StringPrintf(L"%ls %d", name, value); -#else - // TODO(port): Enable when StatsTable is ported. - NOTIMPLEMENTED(); -#endif + LOG(INFO) << StringPrintf("%s %d", name, value); } std::wstring GetFullSBDataPath(const std::wstring& path) { @@ -1096,15 +1091,15 @@ void PeformUpdate(const std::wstring& initial_db, (Time::Now() - before_time).InMilliseconds()); #endif - PrintStat(L"c:SB.HostSelect"); - PrintStat(L"c:SB.HostSelectForBloomFilter"); - PrintStat(L"c:SB.HostReplace"); - PrintStat(L"c:SB.HostInsert"); - PrintStat(L"c:SB.HostDelete"); - PrintStat(L"c:SB.ChunkSelect"); - PrintStat(L"c:SB.ChunkInsert"); - PrintStat(L"c:SB.ChunkDelete"); - PrintStat(L"c:SB.TransactionCommit"); + PrintStat("c:SB.HostSelect"); + PrintStat("c:SB.HostSelectForBloomFilter"); + PrintStat("c:SB.HostReplace"); + PrintStat("c:SB.HostInsert"); + PrintStat("c:SB.HostDelete"); + PrintStat("c:SB.ChunkSelect"); + PrintStat("c:SB.ChunkInsert"); + PrintStat("c:SB.ChunkDelete"); + PrintStat("c:SB.TransactionCommit"); delete database; } diff --git a/chrome/browser/task_manager.cc b/chrome/browser/task_manager.cc index 009d44c..423a55f 100644 --- a/chrome/browser/task_manager.cc +++ b/chrome/browser/task_manager.cc @@ -201,7 +201,7 @@ int TaskManagerTableModel::GetStatsValue(TaskManager::Resource* resource, int col_id) { StatsTable* table = StatsTable::current(); if (table != NULL) { - const wchar_t* counter = table->GetRowName(col_id); + const char* counter = table->GetRowName(col_id); if (counter != NULL && counter[0] != '\0') { return table->GetCounterValue(counter, base::GetProcId(resource->GetProcess())); @@ -783,14 +783,15 @@ void TaskManagerContents::UpdateStatsCounters() { int max = stats->GetMaxCounters(); // skip the first row (it's header data) for (int i = 1; i < max; i++) { - const wchar_t* row = stats->GetRowName(i); - if (row != NULL && row[0] != L'\0' && !tab_table_->HasColumn(i)) { + const char* row = stats->GetRowName(i); + if (row != NULL && row[0] != '\0' && !tab_table_->HasColumn(i)) { // TODO(erikkay): Use l10n to get display names for stats. Right // now we're just displaying the internal counter name. Perhaps // stat names not in the string table would be filtered out. // TODO(erikkay): Width is hard-coded right now, so many column // names are clipped. - views::TableColumn col(i, row, views::TableColumn::RIGHT, 90, 0); + views::TableColumn col(i, ASCIIToWide(row), views::TableColumn::RIGHT, + 90, 0); col.sortable = true; columns_.push_back(col); tab_table_->AddColumn(col); diff --git a/chrome/common/chrome_constants.cc b/chrome/common/chrome_constants.cc index 57749a1..b7e9eec 100644 --- a/chrome/common/chrome_constants.cc +++ b/chrome/common/chrome_constants.cc @@ -10,10 +10,10 @@ namespace chrome { const wchar_t kBrowserProcessExecutableName[] = L"chrome.exe"; #if defined(GOOGLE_CHROME_BUILD) const wchar_t kBrowserAppName[] = L"Chrome"; -const wchar_t kStatsFilename[] = L"ChromeStats"; +const char kStatsFilename[] = "ChromeStats"; #else const wchar_t kBrowserAppName[] = L"Chromium"; -const wchar_t kStatsFilename[] = L"ChromiumStats"; +const char kStatsFilename[] = "ChromiumStats"; #endif const wchar_t kExternalTabWindowClass[] = L"Chrome_ExternalTabContainer"; const wchar_t kMessageWindowClass[] = L"Chrome_MessageWindow"; diff --git a/chrome/common/chrome_constants.h b/chrome/common/chrome_constants.h index 46fa329..a838699 100644 --- a/chrome/common/chrome_constants.h +++ b/chrome/common/chrome_constants.h @@ -17,7 +17,7 @@ extern const wchar_t kCrashReportLog[]; extern const wchar_t kTestingInterfaceDLL[]; extern const wchar_t kNotSignedInProfile[]; extern const wchar_t kNotSignedInID[]; -extern const wchar_t kStatsFilename[]; +extern const char kStatsFilename[]; extern const wchar_t kBrowserResourcesDll[]; // filenames diff --git a/chrome/common/chrome_counters.cc b/chrome/common/chrome_counters.cc index 9ac86b8..1e91528 100644 --- a/chrome/common/chrome_counters.cc +++ b/chrome/common/chrome_counters.cc @@ -20,37 +20,37 @@ namespace chrome { // would be it. But these are small objects, so this is ok. StatsCounter& Counters::ipc_send_counter() { - static StatsCounter* ctr = new StatsCounter(L"IPC.SendMsgCount"); + static StatsCounter* ctr = new StatsCounter("IPC.SendMsgCount"); return *ctr; } StatsCounterTimer& Counters::chrome_main() { - static StatsCounterTimer* ctr = new StatsCounterTimer(L"Chrome.Init"); + static StatsCounterTimer* ctr = new StatsCounterTimer("Chrome.Init"); return *ctr; } StatsCounterTimer& Counters::renderer_main() { - static StatsCounterTimer* ctr = new StatsCounterTimer(L"Chrome.RendererInit"); + static StatsCounterTimer* ctr = new StatsCounterTimer("Chrome.RendererInit"); return *ctr; } StatsCounterTimer& Counters::spellcheck_init() { - static StatsCounterTimer* ctr = new StatsCounterTimer(L"SpellCheck.Init"); + static StatsCounterTimer* ctr = new StatsCounterTimer("SpellCheck.Init"); return *ctr; } StatsRate& Counters::spellcheck_lookup() { - static StatsRate* ctr = new StatsRate(L"SpellCheck.Lookup"); + static StatsRate* ctr = new StatsRate("SpellCheck.Lookup"); return *ctr; } StatsCounterTimer& Counters::plugin_load() { - static StatsCounterTimer* ctr = new StatsCounterTimer(L"ChromePlugin.Load"); + static StatsCounterTimer* ctr = new StatsCounterTimer("ChromePlugin.Load"); return *ctr; } StatsRate& Counters::plugin_intercept() { - static StatsRate* ctr = new StatsRate(L"ChromePlugin.Intercept"); + static StatsRate* ctr = new StatsRate("ChromePlugin.Intercept"); return *ctr; } diff --git a/chrome/renderer/net/render_dns_queue.cc b/chrome/renderer/net/render_dns_queue.cc index 5a0b15e0..94c0ea0 100644 --- a/chrome/renderer/net/render_dns_queue.cc +++ b/chrome/renderer/net/render_dns_queue.cc @@ -38,7 +38,7 @@ DnsQueue::PushResult DnsQueue::Push(const char* source, if (0 < size_ && readable_ + length < buffer_sentinel_ && 0 == strncmp(source, &buffer_[readable_], unsigned_length) && '\0' == buffer_[readable_ + unsigned_length]) { - SIMPLE_STATS_COUNTER(L"DNS.PrefetchDnsRedundantPush"); + SIMPLE_STATS_COUNTER("DNS.PrefetchDnsRedundantPush"); // We already wrote this name to the queue, so we'll skip this repeat. return REDUNDANT_PUSH; @@ -56,7 +56,7 @@ DnsQueue::PushResult DnsQueue::Push(const char* source, } if (length + 1 >= available_space) { - SIMPLE_STATS_COUNTER(L"DNS.PrefetchDnsQueueFull"); + SIMPLE_STATS_COUNTER("DNS.PrefetchDnsQueueFull"); return OVERFLOW_PUSH; // Not enough space to push. } diff --git a/chrome/test/unit/chrome_test_suite.h b/chrome/test/unit/chrome_test_suite.h index cb97f0d..92f000f 100644 --- a/chrome/test/unit/chrome_test_suite.h +++ b/chrome/test/unit/chrome_test_suite.h @@ -46,7 +46,7 @@ protected: ResourceBundle::GetSharedInstance().LoadThemeResources(); // initialize the global StatsTable for unit_tests - stats_table_ = new StatsTable(L"unit_tests", 20, 200); + stats_table_ = new StatsTable("unit_tests", 20, 200); StatsTable::set_current(stats_table_); } diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc index c22101c..ab2212b 100644 --- a/net/url_request/url_request.cc +++ b/net/url_request/url_request.cc @@ -49,7 +49,7 @@ URLRequest::URLRequest(const GURL& url, Delegate* delegate) redirect_limit_(kMaxRedirects), final_upload_progress_(0) { URLREQUEST_COUNT_CTOR(); - SIMPLE_STATS_COUNTER(L"URLRequestCount"); + SIMPLE_STATS_COUNTER("URLRequestCount"); origin_pid_ = base::GetCurrentProcId(); // Sanity check out environment. diff --git a/tools/memory_watcher/memory_watcher.cc b/tools/memory_watcher/memory_watcher.cc index c7d0565..d5e11db 100644 --- a/tools/memory_watcher/memory_watcher.cc +++ b/tools/memory_watcher/memory_watcher.cc @@ -15,10 +15,10 @@ #include "tools/memory_watcher/call_stack.h" #include "tools/memory_watcher/preamble_patcher.h" -static StatsCounter mem_in_use(L"MemoryInUse.Bytes"); -static StatsCounter mem_in_use_blocks(L"MemoryInUse.Blocks"); -static StatsCounter mem_in_use_allocs(L"MemoryInUse.Allocs"); -static StatsCounter mem_in_use_frees(L"MemoryInUse.Frees"); +static StatsCounter mem_in_use("MemoryInUse.Bytes"); +static StatsCounter mem_in_use_blocks("MemoryInUse.Blocks"); +static StatsCounter mem_in_use_allocs("MemoryInUse.Allocs"); +static StatsCounter mem_in_use_frees("MemoryInUse.Frees"); // --------------------------------------------------------------------- diff --git a/webkit/glue/chromium_bridge_impl.cc b/webkit/glue/chromium_bridge_impl.cc index 515e2e8..9745a76 100644 --- a/webkit/glue/chromium_bridge_impl.cc +++ b/webkit/glue/chromium_bridge_impl.cc @@ -445,17 +445,22 @@ void ChromiumBridge::stopSharedTimer() { // StatsCounters -------------------------------------------------------------- -void ChromiumBridge::decrementStatsCounter(const wchar_t* name) { +void ChromiumBridge::decrementStatsCounter(const char* name) { StatsCounter(name).Decrement(); } -void ChromiumBridge::incrementStatsCounter(const wchar_t* name) { +void ChromiumBridge::incrementStatsCounter(const char* name) { StatsCounter(name).Increment(); } #if USE(V8) +// TODO(evanm): remove this conversion thunk once v8 supports plain char* +// counter functions. +static int* CounterFunction(const wchar_t* name) { + return StatsTable::FindLocation(WideToASCII(name).c_str()); +} void ChromiumBridge::initV8CounterFunction() { - v8::V8::SetCounterFunction(StatsTable::FindLocation); + v8::V8::SetCounterFunction(CounterFunction); } #endif diff --git a/webkit/glue/plugins/plugin_lib.cc b/webkit/glue/plugins/plugin_lib.cc index c79d2cf..96296dc 100644 --- a/webkit/glue/plugins/plugin_lib.cc +++ b/webkit/glue/plugins/plugin_lib.cc @@ -29,8 +29,8 @@ namespace NPAPI { -const wchar_t kPluginLibrariesLoadedCounter[] = L"PluginLibrariesLoaded"; -const wchar_t kPluginInstancesActiveCounter[] = L"PluginInstancesActive"; +const char kPluginLibrariesLoadedCounter[] = "PluginLibrariesLoaded"; +const char kPluginInstancesActiveCounter[] = "PluginInstancesActive"; PluginLib::PluginMap* PluginLib::loaded_libs_; diff --git a/webkit/glue/plugins/webplugin_delegate_impl.cc b/webkit/glue/plugins/webplugin_delegate_impl.cc index fd31ab7..9282de7 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl.cc +++ b/webkit/glue/plugins/webplugin_delegate_impl.cc @@ -22,7 +22,7 @@ #include "webkit/glue/plugins/plugin_stream_url.h" #include "webkit/glue/webkit_glue.h" -static StatsCounter windowless_queue(L"Plugin.ThrottleQueue"); +static StatsCounter windowless_queue("Plugin.ThrottleQueue"); static const wchar_t kNativeWindowClassName[] = L"NativeWindowClass"; static const wchar_t kWebPluginDelegateProperty[] = @@ -885,7 +885,7 @@ void WebPluginDelegateImpl::WindowlessPaint(HDC hdc, // NOTE: NPAPI is not 64bit safe. It puts pointers into 32bit values. paint_event.wParam = PtrToUlong(hdc); paint_event.lParam = PtrToUlong(&damage_rect_win); - static StatsRate plugin_paint(L"Plugin.Paint"); + static StatsRate plugin_paint("Plugin.Paint"); StatsScope<StatsRate> scope(plugin_paint); instance()->NPP_HandleEvent(&paint_event); } diff --git a/webkit/glue/webframe_impl.cc b/webkit/glue/webframe_impl.cc index 4ee45f9..a5a8fda 100644 --- a/webkit/glue/webframe_impl.cc +++ b/webkit/glue/webframe_impl.cc @@ -183,7 +183,8 @@ using WebCore::XPathResult; // once we figure out how to make tickmark support work again! static const size_t kNoTickmark = size_t(-1); -static const wchar_t* const kWebFrameActiveCount = L"WebFrameActiveCount"; +// Key for a StatsCounter tracking how many WebFrames are active. +static const char* const kWebFrameActiveCount = "WebFrameActiveCount"; static const char* const kOSDType = "application/opensearchdescription+xml"; static const char* const kOSDRel = "search"; @@ -487,7 +488,7 @@ bool WebFrameImpl::GetPreviousState(GURL* url, std::wstring* title, if (!item) return false; - static StatsCounterTimer history_timer(L"GetHistoryTimer"); + static StatsCounterTimer history_timer("GetHistoryTimer"); StatsScope<StatsCounterTimer> history_scope(history_timer); webkit_glue::HistoryItemToString(item, history_state); @@ -1474,7 +1475,7 @@ void WebFrameImpl::Layout() { } void WebFrameImpl::Paint(gfx::PlatformCanvas* canvas, const gfx::Rect& rect) { - static StatsRate rendering(L"WebFramePaintTime"); + static StatsRate rendering("WebFramePaintTime"); StatsScope<StatsRate> rendering_scope(rendering); if (!rect.IsEmpty()) { diff --git a/webkit/port/bindings/scripts/CodeGeneratorV8.pm b/webkit/port/bindings/scripts/CodeGeneratorV8.pm index 1738afa..c80358b 100644 --- a/webkit/port/bindings/scripts/CodeGeneratorV8.pm +++ b/webkit/port/bindings/scripts/CodeGeneratorV8.pm @@ -378,7 +378,7 @@ sub GenerateDomainSafeFunctionGetter push(@implContentDecls, <<END); static v8::Handle<v8::Value> ${funcName}AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { - INC_STATS(L\"DOM.$implClassName.$funcName._get\"); + INC_STATS(\"DOM.$implClassName.$funcName._get\"); static v8::Persistent<v8::FunctionTemplate> private_template = v8::Persistent<v8::FunctionTemplate>::New($newTemplateString); v8::Handle<v8::Object> holder = V8Proxy::LookupDOMWrapper(V8ClassIndex::$classIndex, info.This()); @@ -412,7 +412,7 @@ sub GenerateConstructorGetter push(@implContentDecls, <<END); static v8::Handle<v8::Value> ${implClassName}ConstructorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { - INC_STATS(L\"DOM.$implClassName.constructors._get\"); + INC_STATS(\"DOM.$implClassName.constructors._get\"); v8::Handle<v8::Value> data = info.Data(); ASSERT(data->IsNumber()); @@ -473,7 +473,7 @@ sub GenerateNormalAttrGetter # Getter push(@implContentDecls, <<END); static v8::Handle<v8::Value> ${attrName}AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { - INC_STATS(L\"DOM.$implClassName.$attrName._get\"); + INC_STATS(\"DOM.$implClassName.$attrName._get\"); END if ($isPodType) { @@ -621,7 +621,7 @@ sub GenerateReplaceableAttrSetter " static void ${attrName}AttrSetter(v8::Local<v8::String> name," . " v8::Local<v8::Value> value, const v8::AccessorInfo& info)\n{\n"); - push(@implContentDecls, " INC_STATS(L\"DOM.$implClassName.$attrName._set\");\n"); + push(@implContentDecls, " INC_STATS(\"DOM.$implClassName.$attrName._set\");\n"); push(@implContentDecls, " v8::Local<v8::String> ${attrName}_string = v8::String::New(\"${attrName}\");\n"); push(@implContentDecls, " info.Holder()->Delete(${attrName}_string);\n"); @@ -645,7 +645,7 @@ sub GenerateNormalAttrSetter " static void ${attrName}AttrSetter(v8::Local<v8::String> name," . " v8::Local<v8::Value> value, const v8::AccessorInfo& info)\n{\n"); - push(@implContentDecls, " INC_STATS(L\"DOM.$implClassName.$attrName._set\");\n"); + push(@implContentDecls, " INC_STATS(\"DOM.$implClassName.$attrName._set\");\n"); my $isPodType = $codeGenerator->IsPodType($implClassName); @@ -758,7 +758,7 @@ sub GenerateFunctionCallback push(@implContentDecls, " static v8::Handle<v8::Value> ${name}Callback(const v8::Arguments& args)\n{\n" . -" INC_STATS(L\"DOM.$implClassName.$name\");\n"); +" INC_STATS(\"DOM.$implClassName.$name\");\n"); my $numParameters = @{$function->parameters}; diff --git a/webkit/port/bindings/v8/V8MessagePortCustom.cpp b/webkit/port/bindings/v8/V8MessagePortCustom.cpp index 4699f08..5f13f30 100644 --- a/webkit/port/bindings/v8/V8MessagePortCustom.cpp +++ b/webkit/port/bindings/v8/V8MessagePortCustom.cpp @@ -81,7 +81,7 @@ static void RemoveHiddenDependency(v8::Local<v8::Object> object, } ACCESSOR_GETTER(MessagePortOnmessage) { - INC_STATS(L"DOM.MessagePort.onmessage._get"); + INC_STATS("DOM.MessagePort.onmessage._get"); MessagePort* imp = V8Proxy::ToNativeObject<MessagePort>( V8ClassIndex::MESSAGEPORT, info.Holder()); if (imp->onmessage()) { @@ -94,7 +94,7 @@ ACCESSOR_GETTER(MessagePortOnmessage) { } ACCESSOR_SETTER(MessagePortOnmessage) { - INC_STATS(L"DOM.MessagePort.onmessage._set"); + INC_STATS("DOM.MessagePort.onmessage._set"); MessagePort* imp = V8Proxy::ToNativeObject<MessagePort>( V8ClassIndex::MESSAGEPORT, info.Holder()); if (value->IsNull()) { @@ -123,7 +123,7 @@ ACCESSOR_SETTER(MessagePortOnmessage) { } ACCESSOR_GETTER(MessagePortOnclose) { - INC_STATS(L"DOM.MessagePort.onclose._get"); + INC_STATS("DOM.MessagePort.onclose._get"); MessagePort* imp = V8Proxy::ToNativeObject<MessagePort>( V8ClassIndex::MESSAGEPORT, info.Holder()); if (imp->onclose()) { @@ -136,7 +136,7 @@ ACCESSOR_GETTER(MessagePortOnclose) { } ACCESSOR_SETTER(MessagePortOnclose) { - INC_STATS(L"DOM.MessagePort.onclose._set"); + INC_STATS("DOM.MessagePort.onclose._set"); MessagePort* imp = V8Proxy::ToNativeObject<MessagePort>( V8ClassIndex::MESSAGEPORT, info.Holder()); if (value->IsNull()) { @@ -164,7 +164,7 @@ ACCESSOR_SETTER(MessagePortOnclose) { } CALLBACK_FUNC_DECL(MessagePortStartConversation) { - INC_STATS(L"DOM.MessagePort.StartConversation()"); + INC_STATS("DOM.MessagePort.StartConversation()"); if (args.Length() < 1) { V8Proxy::ThrowError(V8Proxy::SYNTAX_ERROR, "Not enough arguments"); return v8::Undefined(); @@ -186,7 +186,7 @@ CALLBACK_FUNC_DECL(MessagePortStartConversation) { } CALLBACK_FUNC_DECL(MessagePortAddEventListener) { - INC_STATS(L"DOM.MessagePort.AddEventListener()"); + INC_STATS("DOM.MessagePort.AddEventListener()"); MessagePort* imp = V8Proxy::ToNativeObject<MessagePort>( V8ClassIndex::MESSAGEPORT, args.Holder()); @@ -207,7 +207,7 @@ CALLBACK_FUNC_DECL(MessagePortAddEventListener) { } CALLBACK_FUNC_DECL(MessagePortRemoveEventListener) { - INC_STATS(L"DOM.MessagePort.RemoveEventListener()"); + INC_STATS("DOM.MessagePort.RemoveEventListener()"); MessagePort* imp = V8Proxy::ToNativeObject<MessagePort>( V8ClassIndex::MESSAGEPORT, args.Holder()); diff --git a/webkit/port/bindings/v8/V8XMLHttpRequestCustom.cpp b/webkit/port/bindings/v8/V8XMLHttpRequestCustom.cpp index 3a9653c..b40d659 100644 --- a/webkit/port/bindings/v8/V8XMLHttpRequestCustom.cpp +++ b/webkit/port/bindings/v8/V8XMLHttpRequestCustom.cpp @@ -45,7 +45,7 @@ namespace WebCore { CALLBACK_FUNC_DECL(XMLHttpRequestConstructor) { - INC_STATS(L"DOM.XMLHttpRequest.Constructor"); + INC_STATS("DOM.XMLHttpRequest.Constructor"); if (!args.IsConstructCall()) { V8Proxy::ThrowError(V8Proxy::TYPE_ERROR, @@ -104,7 +104,7 @@ static void RemoveHiddenXHRDependency(v8::Local<v8::Object> xhr, } ACCESSOR_GETTER(XMLHttpRequestOnabort) { - INC_STATS(L"DOM.XMLHttpRequest.onabort._get"); + INC_STATS("DOM.XMLHttpRequest.onabort._get"); XMLHttpRequest* imp = V8Proxy::ToNativeObject<XMLHttpRequest>( V8ClassIndex::XMLHTTPREQUEST, info.Holder()); if (imp->onabort()) { @@ -117,7 +117,7 @@ ACCESSOR_GETTER(XMLHttpRequestOnabort) { } ACCESSOR_SETTER(XMLHttpRequestOnabort) { - INC_STATS(L"DOM.XMLHttpRequest.onabort._set"); + INC_STATS("DOM.XMLHttpRequest.onabort._set"); XMLHttpRequest* imp = V8Proxy::ToNativeObject<XMLHttpRequest>( V8ClassIndex::XMLHTTPREQUEST, info.Holder()); if (value->IsNull()) { @@ -145,7 +145,7 @@ ACCESSOR_SETTER(XMLHttpRequestOnabort) { } ACCESSOR_GETTER(XMLHttpRequestOnerror) { - INC_STATS(L"DOM.XMLHttpRequest.onerror._get"); + INC_STATS("DOM.XMLHttpRequest.onerror._get"); XMLHttpRequest* imp = V8Proxy::ToNativeObject<XMLHttpRequest>( V8ClassIndex::XMLHTTPREQUEST, info.Holder()); if (imp->onerror()) { @@ -158,7 +158,7 @@ ACCESSOR_GETTER(XMLHttpRequestOnerror) { } ACCESSOR_SETTER(XMLHttpRequestOnerror) { - INC_STATS(L"DOM.XMLHttpRequest.onerror._set"); + INC_STATS("DOM.XMLHttpRequest.onerror._set"); XMLHttpRequest* imp = V8Proxy::ToNativeObject<XMLHttpRequest>( V8ClassIndex::XMLHTTPREQUEST, info.Holder()); if (value->IsNull()) { @@ -186,7 +186,7 @@ ACCESSOR_SETTER(XMLHttpRequestOnerror) { } ACCESSOR_GETTER(XMLHttpRequestOnload) { - INC_STATS(L"DOM.XMLHttpRequest.onload._get"); + INC_STATS("DOM.XMLHttpRequest.onload._get"); XMLHttpRequest* imp = V8Proxy::ToNativeObject<XMLHttpRequest>( V8ClassIndex::XMLHTTPREQUEST, info.Holder()); if (imp->onload()) { @@ -200,7 +200,7 @@ ACCESSOR_GETTER(XMLHttpRequestOnload) { ACCESSOR_SETTER(XMLHttpRequestOnload) { - INC_STATS(L"DOM.XMLHttpRequest.onload._set"); + INC_STATS("DOM.XMLHttpRequest.onload._set"); XMLHttpRequest* imp = V8Proxy::ToNativeObject<XMLHttpRequest>( V8ClassIndex::XMLHTTPREQUEST, info.Holder()); if (value->IsNull()) { @@ -227,7 +227,7 @@ ACCESSOR_SETTER(XMLHttpRequestOnload) } ACCESSOR_GETTER(XMLHttpRequestOnloadstart) { - INC_STATS(L"DOM.XMLHttpRequest.onloadstart._get"); + INC_STATS("DOM.XMLHttpRequest.onloadstart._get"); XMLHttpRequest* imp = V8Proxy::ToNativeObject<XMLHttpRequest>( V8ClassIndex::XMLHTTPREQUEST, info.Holder()); if (imp->onloadstart()) { @@ -240,7 +240,7 @@ ACCESSOR_GETTER(XMLHttpRequestOnloadstart) { } ACCESSOR_SETTER(XMLHttpRequestOnloadstart) { - INC_STATS(L"DOM.XMLHttpRequest.onloadstart._set"); + INC_STATS("DOM.XMLHttpRequest.onloadstart._set"); XMLHttpRequest* imp = V8Proxy::ToNativeObject<XMLHttpRequest>( V8ClassIndex::XMLHTTPREQUEST, info.Holder()); if (value->IsNull()) { @@ -268,7 +268,7 @@ ACCESSOR_SETTER(XMLHttpRequestOnloadstart) { } ACCESSOR_GETTER(XMLHttpRequestOnprogress) { - INC_STATS(L"DOM.XMLHttpRequest.onprogress._get"); + INC_STATS("DOM.XMLHttpRequest.onprogress._get"); XMLHttpRequest* imp = V8Proxy::ToNativeObject<XMLHttpRequest>( V8ClassIndex::XMLHTTPREQUEST, info.Holder()); if (imp->onprogress()) { @@ -281,7 +281,7 @@ ACCESSOR_GETTER(XMLHttpRequestOnprogress) { } ACCESSOR_SETTER(XMLHttpRequestOnprogress) { - INC_STATS(L"DOM.XMLHttpRequest.onprogress._set"); + INC_STATS("DOM.XMLHttpRequest.onprogress._set"); XMLHttpRequest* imp = V8Proxy::ToNativeObject<XMLHttpRequest>( V8ClassIndex::XMLHTTPREQUEST, info.Holder()); if (value->IsNull()) { @@ -309,7 +309,7 @@ ACCESSOR_SETTER(XMLHttpRequestOnprogress) { } ACCESSOR_GETTER(XMLHttpRequestOnreadystatechange) { - INC_STATS(L"DOM.XMLHttpRequest.onreadystatechange._get"); + INC_STATS("DOM.XMLHttpRequest.onreadystatechange._get"); XMLHttpRequest* imp = V8Proxy::ToNativeObject<XMLHttpRequest>( V8ClassIndex::XMLHTTPREQUEST, info.Holder()); if (imp->onreadystatechange()) { @@ -323,7 +323,7 @@ ACCESSOR_GETTER(XMLHttpRequestOnreadystatechange) { ACCESSOR_SETTER(XMLHttpRequestOnreadystatechange) { - INC_STATS(L"DOM.XMLHttpRequest.onreadystatechange._set"); + INC_STATS("DOM.XMLHttpRequest.onreadystatechange._set"); XMLHttpRequest* imp = V8Proxy::ToNativeObject<XMLHttpRequest>( V8ClassIndex::XMLHTTPREQUEST, info.Holder()); if (value->IsNull()) { @@ -352,7 +352,7 @@ ACCESSOR_SETTER(XMLHttpRequestOnreadystatechange) CALLBACK_FUNC_DECL(XMLHttpRequestAddEventListener) { - INC_STATS(L"DOM.XMLHttpRequest.addEventListener()"); + INC_STATS("DOM.XMLHttpRequest.addEventListener()"); XMLHttpRequest* imp = V8Proxy::ToNativeObject<XMLHttpRequest>( V8ClassIndex::XMLHTTPREQUEST, args.Holder()); @@ -373,7 +373,7 @@ CALLBACK_FUNC_DECL(XMLHttpRequestAddEventListener) } CALLBACK_FUNC_DECL(XMLHttpRequestRemoveEventListener) { - INC_STATS(L"DOM.XMLHttpRequest.removeEventListener()"); + INC_STATS("DOM.XMLHttpRequest.removeEventListener()"); XMLHttpRequest* imp = V8Proxy::ToNativeObject<XMLHttpRequest>( V8ClassIndex::XMLHTTPREQUEST, args.Holder()); @@ -397,7 +397,7 @@ CALLBACK_FUNC_DECL(XMLHttpRequestRemoveEventListener) { CALLBACK_FUNC_DECL(XMLHttpRequestOpen) { - INC_STATS(L"DOM.XMLHttpRequest.open()"); + INC_STATS("DOM.XMLHttpRequest.open()"); // Four cases: // open(method, url) // open(method, url, async) @@ -450,7 +450,7 @@ static bool IsDocumentType(v8::Handle<v8::Value> value) CALLBACK_FUNC_DECL(XMLHttpRequestSend) { - INC_STATS(L"DOM.XMLHttpRequest.send()"); + INC_STATS("DOM.XMLHttpRequest.send()"); XMLHttpRequest* xhr = V8Proxy::ToNativeObject<XMLHttpRequest>( V8ClassIndex::XMLHTTPREQUEST, args.Holder()); @@ -478,7 +478,7 @@ CALLBACK_FUNC_DECL(XMLHttpRequestSend) } CALLBACK_FUNC_DECL(XMLHttpRequestSetRequestHeader) { - INC_STATS(L"DOM.XMLHttpRequest.setRequestHeader()"); + INC_STATS("DOM.XMLHttpRequest.setRequestHeader()"); if (args.Length() < 2) { V8Proxy::ThrowError(V8Proxy::SYNTAX_ERROR, "Not enough arguments"); return v8::Undefined(); @@ -498,7 +498,7 @@ CALLBACK_FUNC_DECL(XMLHttpRequestSetRequestHeader) { } CALLBACK_FUNC_DECL(XMLHttpRequestGetResponseHeader) { - INC_STATS(L"DOM.XMLHttpRequest.getResponseHeader()"); + INC_STATS("DOM.XMLHttpRequest.getResponseHeader()"); if (args.Length() < 1) { V8Proxy::ThrowError(V8Proxy::SYNTAX_ERROR, "Not enough arguments"); return v8::Undefined(); @@ -518,7 +518,7 @@ CALLBACK_FUNC_DECL(XMLHttpRequestGetResponseHeader) { CALLBACK_FUNC_DECL(XMLHttpRequestOverrideMimeType) { - INC_STATS(L"DOM.XMLHttpRequest.overrideMimeType()"); + INC_STATS("DOM.XMLHttpRequest.overrideMimeType()"); if (args.Length() < 1) { V8Proxy::ThrowError(V8Proxy::SYNTAX_ERROR, "Not enough arguments"); return v8::Undefined(); @@ -533,7 +533,7 @@ CALLBACK_FUNC_DECL(XMLHttpRequestOverrideMimeType) CALLBACK_FUNC_DECL(XMLHttpRequestDispatchEvent) { - INC_STATS(L"DOM.XMLHttpRequest.dispatchEvent()"); + INC_STATS("DOM.XMLHttpRequest.dispatchEvent()"); return v8::Undefined(); } @@ -541,7 +541,7 @@ CALLBACK_FUNC_DECL(XMLHttpRequestDispatchEvent) // XMLHttpRequestUpload -------------------------------------------------------- ACCESSOR_GETTER(XMLHttpRequestUploadOnabort) { - INC_STATS(L"DOM.XMLHttpRequestUpload.onabort._get"); + INC_STATS("DOM.XMLHttpRequestUpload.onabort._get"); XMLHttpRequestUpload* imp = V8Proxy::ToNativeObject<XMLHttpRequestUpload>( V8ClassIndex::XMLHTTPREQUESTUPLOAD, info.Holder()); if (imp->onabort()) { @@ -554,7 +554,7 @@ ACCESSOR_GETTER(XMLHttpRequestUploadOnabort) { } ACCESSOR_SETTER(XMLHttpRequestUploadOnabort) { - INC_STATS(L"DOM.XMLHttpRequestUpload.onabort._set"); + INC_STATS("DOM.XMLHttpRequestUpload.onabort._set"); XMLHttpRequestUpload* imp = V8Proxy::ToNativeObject<XMLHttpRequestUpload>( V8ClassIndex::XMLHTTPREQUESTUPLOAD, info.Holder()); if (value->IsNull()) { @@ -584,7 +584,7 @@ ACCESSOR_SETTER(XMLHttpRequestUploadOnabort) { } ACCESSOR_GETTER(XMLHttpRequestUploadOnerror) { - INC_STATS(L"DOM.XMLHttpRequestUpload.onerror._get"); + INC_STATS("DOM.XMLHttpRequestUpload.onerror._get"); XMLHttpRequestUpload* imp = V8Proxy::ToNativeObject<XMLHttpRequestUpload>( V8ClassIndex::XMLHTTPREQUESTUPLOAD, info.Holder()); if (imp->onerror()) { @@ -597,7 +597,7 @@ ACCESSOR_GETTER(XMLHttpRequestUploadOnerror) { } ACCESSOR_SETTER(XMLHttpRequestUploadOnerror) { - INC_STATS(L"DOM.XMLHttpRequestUpload.onerror._set"); + INC_STATS("DOM.XMLHttpRequestUpload.onerror._set"); XMLHttpRequestUpload* imp = V8Proxy::ToNativeObject<XMLHttpRequestUpload>( V8ClassIndex::XMLHTTPREQUESTUPLOAD, info.Holder()); if (value->IsNull()) { @@ -626,7 +626,7 @@ ACCESSOR_SETTER(XMLHttpRequestUploadOnerror) { } ACCESSOR_GETTER(XMLHttpRequestUploadOnload) { - INC_STATS(L"DOM.XMLHttpRequestUpload.onload._get"); + INC_STATS("DOM.XMLHttpRequestUpload.onload._get"); XMLHttpRequestUpload* imp = V8Proxy::ToNativeObject<XMLHttpRequestUpload>( V8ClassIndex::XMLHTTPREQUESTUPLOAD, info.Holder()); if (imp->onload()) { @@ -639,7 +639,7 @@ ACCESSOR_GETTER(XMLHttpRequestUploadOnload) { } ACCESSOR_SETTER(XMLHttpRequestUploadOnload) { - INC_STATS(L"DOM.XMLHttpRequestUpload.onload._set"); + INC_STATS("DOM.XMLHttpRequestUpload.onload._set"); XMLHttpRequestUpload* imp = V8Proxy::ToNativeObject<XMLHttpRequestUpload>( V8ClassIndex::XMLHTTPREQUESTUPLOAD, info.Holder()); if (value->IsNull()) { @@ -668,7 +668,7 @@ ACCESSOR_SETTER(XMLHttpRequestUploadOnload) { } ACCESSOR_GETTER(XMLHttpRequestUploadOnloadstart) { - INC_STATS(L"DOM.XMLHttpRequestUpload.onloadstart._get"); + INC_STATS("DOM.XMLHttpRequestUpload.onloadstart._get"); XMLHttpRequestUpload* imp = V8Proxy::ToNativeObject<XMLHttpRequestUpload>( V8ClassIndex::XMLHTTPREQUESTUPLOAD, info.Holder()); if (imp->onloadstart()) { @@ -681,7 +681,7 @@ ACCESSOR_GETTER(XMLHttpRequestUploadOnloadstart) { } ACCESSOR_SETTER(XMLHttpRequestUploadOnloadstart) { - INC_STATS(L"DOM.XMLHttpRequestUpload.onloadstart._set"); + INC_STATS("DOM.XMLHttpRequestUpload.onloadstart._set"); XMLHttpRequestUpload* imp = V8Proxy::ToNativeObject<XMLHttpRequestUpload>( V8ClassIndex::XMLHTTPREQUESTUPLOAD, info.Holder()); if (value->IsNull()) { @@ -710,7 +710,7 @@ ACCESSOR_SETTER(XMLHttpRequestUploadOnloadstart) { } ACCESSOR_GETTER(XMLHttpRequestUploadOnprogress) { - INC_STATS(L"DOM.XMLHttpRequestUpload.onprogress._get"); + INC_STATS("DOM.XMLHttpRequestUpload.onprogress._get"); XMLHttpRequestUpload* imp = V8Proxy::ToNativeObject<XMLHttpRequestUpload>( V8ClassIndex::XMLHTTPREQUESTUPLOAD, info.Holder()); if (imp->onprogress()) { @@ -723,7 +723,7 @@ ACCESSOR_GETTER(XMLHttpRequestUploadOnprogress) { } ACCESSOR_SETTER(XMLHttpRequestUploadOnprogress) { - INC_STATS(L"DOM.XMLHttpRequestUpload.onprogress._set"); + INC_STATS("DOM.XMLHttpRequestUpload.onprogress._set"); XMLHttpRequestUpload* imp = V8Proxy::ToNativeObject<XMLHttpRequestUpload>( V8ClassIndex::XMLHTTPREQUESTUPLOAD, info.Holder()); if (value->IsNull()) { @@ -752,7 +752,7 @@ ACCESSOR_SETTER(XMLHttpRequestUploadOnprogress) { } CALLBACK_FUNC_DECL(XMLHttpRequestUploadAddEventListener) { - INC_STATS(L"DOM.XMLHttpRequestUpload.addEventListener()"); + INC_STATS("DOM.XMLHttpRequestUpload.addEventListener()"); XMLHttpRequestUpload* imp = V8Proxy::ToNativeObject<XMLHttpRequestUpload>( V8ClassIndex::XMLHTTPREQUESTUPLOAD, args.Holder()); @@ -774,7 +774,7 @@ CALLBACK_FUNC_DECL(XMLHttpRequestUploadAddEventListener) { } CALLBACK_FUNC_DECL(XMLHttpRequestUploadRemoveEventListener) { - INC_STATS(L"DOM.XMLHttpRequestUpload.removeEventListener()"); + INC_STATS("DOM.XMLHttpRequestUpload.removeEventListener()"); XMLHttpRequestUpload* imp = V8Proxy::ToNativeObject<XMLHttpRequestUpload>( V8ClassIndex::XMLHTTPREQUESTUPLOAD, args.Holder()); @@ -798,7 +798,7 @@ CALLBACK_FUNC_DECL(XMLHttpRequestUploadRemoveEventListener) { } CALLBACK_FUNC_DECL(XMLHttpRequestUploadDispatchEvent) { - INC_STATS(L"DOM.XMLHttpRequestUpload.dispatchEvent()"); + INC_STATS("DOM.XMLHttpRequestUpload.dispatchEvent()"); V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); return v8::Undefined(); } diff --git a/webkit/port/bindings/v8/npruntime.cpp b/webkit/port/bindings/v8/npruntime.cpp index 1c1007b..ca0c45a 100644 --- a/webkit/port/bindings/v8/npruntime.cpp +++ b/webkit/port/bindings/v8/npruntime.cpp @@ -169,7 +169,7 @@ void NPN_ReleaseVariantValue(NPVariant* variant) { variant->type = NPVariantType_Void; } -static const wchar_t* kCounterNPObjects = L"NPObjects"; +static const char* kCounterNPObjects = "NPObjects"; NPObject *NPN_CreateObject(NPP npp, NPClass* aClass) { ASSERT(aClass); diff --git a/webkit/port/bindings/v8/v8_custom.cpp b/webkit/port/bindings/v8/v8_custom.cpp index bd5acf5..57036bf 100644 --- a/webkit/port/bindings/v8/v8_custom.cpp +++ b/webkit/port/bindings/v8/v8_custom.cpp @@ -258,13 +258,13 @@ void V8ScheduledAction::execute(DOMWindow* window) { CALLBACK_FUNC_DECL(DOMParserConstructor) { - INC_STATS(L"DOM.DOMParser.Contructor"); + INC_STATS("DOM.DOMParser.Contructor"); return V8Proxy::ConstructDOMObject<V8ClassIndex::DOMPARSER, DOMParser>(args); } CALLBACK_FUNC_DECL(MessageChannelConstructor) { - INC_STATS(L"DOM.MessageChannel.Constructor"); + INC_STATS("DOM.MessageChannel.Constructor"); if (!args.IsConstructCall()) { V8Proxy::ThrowError(V8Proxy::TYPE_ERROR, "DOM object constructor cannot be called as a function."); @@ -310,28 +310,28 @@ CALLBACK_FUNC_DECL(MessageChannelConstructor) { CALLBACK_FUNC_DECL(XMLSerializerConstructor) { - INC_STATS(L"DOM.XMLSerializer.Constructor"); + INC_STATS("DOM.XMLSerializer.Constructor"); return V8Proxy::ConstructDOMObject<V8ClassIndex::XMLSERIALIZER, XMLSerializer>(args); } CALLBACK_FUNC_DECL(XPathEvaluatorConstructor) { - INC_STATS(L"DOM.XPathEvaluator.Constructor"); + INC_STATS("DOM.XPathEvaluator.Constructor"); return V8Proxy::ConstructDOMObject<V8ClassIndex::XPATHEVALUATOR, XPathEvaluator>(args); } CALLBACK_FUNC_DECL(XSLTProcessorConstructor) { - INC_STATS(L"DOM.XSLTProcessor.Constructor"); + INC_STATS("DOM.XSLTProcessor.Constructor"); return V8Proxy::ConstructDOMObject<V8ClassIndex::XSLTPROCESSOR, XSLTProcessor>(args); } CALLBACK_FUNC_DECL(XSLTProcessorImportStylesheet) { - INC_STATS(L"DOM.XSLTProcessor.importStylesheet"); + INC_STATS("DOM.XSLTProcessor.importStylesheet"); // Return undefined if argument does not have the correct type. if (!V8Node::HasInstance(args[0])) return v8::Undefined(); @@ -346,7 +346,7 @@ CALLBACK_FUNC_DECL(XSLTProcessorImportStylesheet) { CALLBACK_FUNC_DECL(XSLTProcessorTransformToFragment) { - INC_STATS(L"DOM.XSLTProcessor.transformToFragment"); + INC_STATS("DOM.XSLTProcessor.transformToFragment"); // Return undefined if arguments do not have correct types. if (!V8Node::HasInstance(args[0]) || !V8Document::HasInstance(args[1])) return v8::Undefined(); @@ -363,7 +363,7 @@ CALLBACK_FUNC_DECL(XSLTProcessorTransformToFragment) { CALLBACK_FUNC_DECL(XSLTProcessorTransformToDocument) { - INC_STATS(L"DOM.XSLTProcessor.transformToDocument"); + INC_STATS("DOM.XSLTProcessor.transformToDocument"); // Return undefined if argument does not have the correct type. if (!V8Node::HasInstance(args[0])) return v8::Undefined(); @@ -383,7 +383,7 @@ CALLBACK_FUNC_DECL(XSLTProcessorTransformToDocument) { CALLBACK_FUNC_DECL(XSLTProcessorSetParameter) { - INC_STATS(L"DOM.XSLTProcessor.setParameter"); + INC_STATS("DOM.XSLTProcessor.setParameter"); // Bail out if localName or value is null or undefined. if (args[1]->IsNull() || args[1]->IsUndefined() || args[2]->IsNull() || args[2]->IsUndefined()) { @@ -402,7 +402,7 @@ CALLBACK_FUNC_DECL(XSLTProcessorSetParameter) { CALLBACK_FUNC_DECL(XSLTProcessorGetParameter) { - INC_STATS(L"DOM.XSLTProcessor.getParameter"); + INC_STATS("DOM.XSLTProcessor.getParameter"); // Bail out if localName is null or undefined. if (args[1]->IsNull() || args[1]->IsUndefined()) { return v8::Undefined(); @@ -421,7 +421,7 @@ CALLBACK_FUNC_DECL(XSLTProcessorGetParameter) { CALLBACK_FUNC_DECL(XSLTProcessorRemoveParameter) { - INC_STATS(L"DOM.XSLTProcessor.removeParameter"); + INC_STATS("DOM.XSLTProcessor.removeParameter"); // Bail out if localName is null or undefined. if (args[1]->IsNull() || args[1]->IsUndefined()) return v8::Undefined(); @@ -665,7 +665,7 @@ static v8::Handle<v8::Value> HTMLCollectionGetItem( NAMED_PROPERTY_GETTER(HTMLCollection) { - INC_STATS(L"DOM.HTMLCollection.NamedPropertyGetter"); + INC_STATS("DOM.HTMLCollection.NamedPropertyGetter"); // Search the prototype chain first. v8::Handle<v8::Value> value = info.Holder()->GetRealNamedPropertyInPrototypeChain(name); @@ -688,7 +688,7 @@ NAMED_PROPERTY_GETTER(HTMLCollection) { } INDEXED_PROPERTY_GETTER(CanvasPixelArray) { - INC_STATS(L"DOM.CanvasPixelArray.IndexedPropertyGetter"); + INC_STATS("DOM.CanvasPixelArray.IndexedPropertyGetter"); CanvasPixelArray* pixelArray = V8Proxy::ToNativeObject<CanvasPixelArray>(V8ClassIndex::CANVASPIXELARRAY, info.Holder()); @@ -703,7 +703,7 @@ INDEXED_PROPERTY_GETTER(CanvasPixelArray) { } INDEXED_PROPERTY_SETTER(CanvasPixelArray) { - INC_STATS(L"DOM.CanvasPixelArray.IndexedPropertySetter"); + INC_STATS("DOM.CanvasPixelArray.IndexedPropertySetter"); CanvasPixelArray* pixelArray = V8Proxy::ToNativeObject<CanvasPixelArray>(V8ClassIndex::CANVASPIXELARRAY, info.Holder()); @@ -716,7 +716,7 @@ INDEXED_PROPERTY_SETTER(CanvasPixelArray) { } CALLBACK_FUNC_DECL(HTMLCollectionItem) { - INC_STATS(L"DOM.HTMLCollection.item()"); + INC_STATS("DOM.HTMLCollection.item()"); HTMLCollection* imp = V8Proxy::ToNativeObject<HTMLCollection>( V8ClassIndex::HTMLCOLLECTION, args.Holder()); return HTMLCollectionGetItem(imp, args[0]); @@ -724,7 +724,7 @@ CALLBACK_FUNC_DECL(HTMLCollectionItem) { CALLBACK_FUNC_DECL(HTMLCollectionNamedItem) { - INC_STATS(L"DOM.HTMLCollection.namedItem()"); + INC_STATS("DOM.HTMLCollection.namedItem()"); HTMLCollection* imp = V8Proxy::ToNativeObject<HTMLCollection>( V8ClassIndex::HTMLCOLLECTION, args.Holder()); String name = ToWebCoreString(args[0]); @@ -738,7 +738,7 @@ CALLBACK_FUNC_DECL(HTMLCollectionNamedItem) { CALLBACK_FUNC_DECL(HTMLCollectionCallAsFunction) { - INC_STATS(L"DOM.HTMLCollection.callAsFunction()"); + INC_STATS("DOM.HTMLCollection.callAsFunction()"); if (args.Length() < 1) return v8::Undefined(); HTMLCollection* imp = V8Proxy::ToNativeObject<HTMLCollection>( @@ -779,14 +779,14 @@ static v8::Handle<v8::Value> V8HTMLSelectElementRemoveHelper( } CALLBACK_FUNC_DECL(HTMLSelectElementRemove) { - INC_STATS(L"DOM.HTMLSelectElement.remove"); + INC_STATS("DOM.HTMLSelectElement.remove"); HTMLSelectElement* imp = V8Proxy::DOMWrapperToNode<HTMLSelectElement>(args.Holder()); return V8HTMLSelectElementRemoveHelper(imp, args); } CALLBACK_FUNC_DECL(HTMLOptionsCollectionRemove) { - INC_STATS(L"DOM.HTMLOptionsCollection.remove()"); + INC_STATS("DOM.HTMLOptionsCollection.remove()"); HTMLOptionsCollection* imp = V8Proxy::ToNativeObject<HTMLOptionsCollection>( V8ClassIndex::HTMLOPTIONSCOLLECTION, args.Holder()); @@ -796,7 +796,7 @@ CALLBACK_FUNC_DECL(HTMLOptionsCollectionRemove) { CALLBACK_FUNC_DECL(HTMLOptionsCollectionAdd) { - INC_STATS(L"DOM.HTMLOptionsCollection.add()"); + INC_STATS("DOM.HTMLOptionsCollection.add()"); if (!V8HTMLOptionElement::HasInstance(args[0])) { V8Proxy::SetDOMException(TYPE_MISMATCH_ERR); return v8::Undefined(); @@ -831,7 +831,7 @@ CALLBACK_FUNC_DECL(HTMLOptionsCollectionAdd) { CALLBACK_FUNC_DECL(DOMWindowAddEventListener) { - INC_STATS(L"DOM.DOMWindow.addEventListener()"); + INC_STATS("DOM.DOMWindow.addEventListener()"); DOMWindow* imp = V8Proxy::ToNativeObject<DOMWindow>( V8ClassIndex::DOMWINDOW, args.Holder()); @@ -864,7 +864,7 @@ CALLBACK_FUNC_DECL(DOMWindowAddEventListener) { CALLBACK_FUNC_DECL(DOMWindowRemoveEventListener) { - INC_STATS(L"DOM.DOMWindow.removeEventListener()"); + INC_STATS("DOM.DOMWindow.removeEventListener()"); DOMWindow* imp = V8Proxy::ToNativeObject<DOMWindow>( V8ClassIndex::DOMWINDOW, args.Holder()); @@ -895,7 +895,7 @@ CALLBACK_FUNC_DECL(DOMWindowRemoveEventListener) { } CALLBACK_FUNC_DECL(DOMWindowPostMessage) { - INC_STATS(L"DOM.DOMWindow.postMessage()"); + INC_STATS("DOM.DOMWindow.postMessage()"); DOMWindow* window = V8Proxy::ToNativeObject<DOMWindow>( V8ClassIndex::DOMWINDOW, args.Holder()); @@ -1051,7 +1051,7 @@ static Frame* createWindow(Frame* opener_frame, CALLBACK_FUNC_DECL(DOMWindowShowModalDialog) { - INC_STATS(L"DOM.DOMWindow.showModalDialog()"); + INC_STATS("DOM.DOMWindow.showModalDialog()"); DOMWindow* window = V8Proxy::ToNativeObject<DOMWindow>( V8ClassIndex::DOMWINDOW, args.Holder()); Frame* frame = window->frame(); @@ -1141,7 +1141,7 @@ CALLBACK_FUNC_DECL(DOMWindowShowModalDialog) { CALLBACK_FUNC_DECL(DOMWindowOpen) { - INC_STATS(L"DOM.DOMWindow.open()"); + INC_STATS("DOM.DOMWindow.open()"); DOMWindow* parent = V8Proxy::ToNativeObject<DOMWindow>( V8ClassIndex::DOMWINDOW, args.Holder()); Frame* frame = parent->frame(); @@ -1269,7 +1269,7 @@ CALLBACK_FUNC_DECL(DOMWindowOpen) { INDEXED_PROPERTY_GETTER(DOMWindow) { - INC_STATS(L"DOM.DOMWindow.IndexedPropertyGetter"); + INC_STATS("DOM.DOMWindow.IndexedPropertyGetter"); v8::Handle<v8::Object> holder = V8Proxy::LookupDOMWrapper( V8ClassIndex::DOMWINDOW, info.This()); if (holder.IsEmpty()) @@ -1294,7 +1294,7 @@ INDEXED_PROPERTY_GETTER(DOMWindow) { NAMED_PROPERTY_GETTER(DOMWindow) { - INC_STATS(L"DOM.DOMWindow.NamedPropertyGetter"); + INC_STATS("DOM.DOMWindow.NamedPropertyGetter"); // The key must be a string. if (!name->IsString()) return v8::Handle<v8::Value>(); @@ -1424,7 +1424,7 @@ NAMED_PROPERTY_DELETER(HTMLDocument) { NAMED_PROPERTY_SETTER(HTMLDocument) { - INC_STATS(L"DOM.HTMLDocument.NamedPropertySetter"); + INC_STATS("DOM.HTMLDocument.NamedPropertySetter"); // Only handle document.all. We insert the value into the shadow // internal field from which the getter will retrieve it. String key = ToWebCoreString(name); @@ -1439,7 +1439,7 @@ NAMED_PROPERTY_SETTER(HTMLDocument) NAMED_PROPERTY_GETTER(HTMLDocument) { - INC_STATS(L"DOM.HTMLDocument.NamedPropertyGetter"); + INC_STATS("DOM.HTMLDocument.NamedPropertyGetter"); AtomicString key = ToWebCoreString(name); // Special case for document.all. If the value in the shadow @@ -1476,7 +1476,7 @@ NAMED_PROPERTY_GETTER(HTMLDocument) NAMED_PROPERTY_GETTER(HTMLFrameSetElement) { - INC_STATS(L"DOM.HTMLFrameSetElement.NamedPropertyGetter"); + INC_STATS("DOM.HTMLFrameSetElement.NamedPropertyGetter"); HTMLFrameSetElement* imp = V8Proxy::DOMWrapperToNode<HTMLFrameSetElement>(info.Holder()); String key = ToWebCoreString(name); @@ -1495,7 +1495,7 @@ NAMED_PROPERTY_GETTER(HTMLFrameSetElement) NAMED_PROPERTY_GETTER(HTMLFormElement) { - INC_STATS(L"DOM.HTMLFormElement.NamedPropertyGetter"); + INC_STATS("DOM.HTMLFormElement.NamedPropertyGetter"); HTMLFormElement* imp = V8Proxy::DOMWrapperToNode<HTMLFormElement>(info.Holder()); String v = ToWebCoreString(name); @@ -1525,7 +1525,7 @@ NAMED_PROPERTY_GETTER(HTMLFormElement) { INDEXED_PROPERTY_GETTER(NamedNodeMap) { - INC_STATS(L"DOM.NamedNodeMap.IndexedPropertyGetter"); + INC_STATS("DOM.NamedNodeMap.IndexedPropertyGetter"); NamedNodeMap* imp = V8Proxy::ToNativeObject<NamedNodeMap>( V8ClassIndex::NAMEDNODEMAP, info.Holder()); RefPtr<Node> result = imp->item(index); @@ -1535,7 +1535,7 @@ INDEXED_PROPERTY_GETTER(NamedNodeMap) { } NAMED_PROPERTY_GETTER(NamedNodeMap) { - INC_STATS(L"DOM.NamedNodeMap.NamedPropertyGetter"); + INC_STATS("DOM.NamedNodeMap.NamedPropertyGetter"); // Search the prototype chain first. v8::Handle<v8::Value> value = info.Holder()->GetRealNamedPropertyInPrototypeChain(name); @@ -1558,7 +1558,7 @@ NAMED_PROPERTY_GETTER(NamedNodeMap) { NAMED_PROPERTY_GETTER(NodeList) { - INC_STATS(L"DOM.NodeList.NamedPropertyGetter"); + INC_STATS("DOM.NodeList.NamedPropertyGetter"); NodeList* list = V8Proxy::ToNativeObject<NodeList>( V8ClassIndex::NODELIST, info.Holder()); String prop_name = ToWebCoreString(name); @@ -1576,7 +1576,7 @@ NAMED_PROPERTY_GETTER(NodeList) { INDEXED_PROPERTY_GETTER(HTMLFormElement) { - INC_STATS(L"DOM.HTMLFormElement.IndexedPropertyGetter"); + INC_STATS("DOM.HTMLFormElement.IndexedPropertyGetter"); HTMLFormElement* form = V8Proxy::DOMWrapperToNode<HTMLFormElement>(info.Holder()); @@ -1587,7 +1587,7 @@ INDEXED_PROPERTY_GETTER(HTMLFormElement) { INDEXED_PROPERTY_GETTER(HTMLOptionsCollection) { - INC_STATS(L"DOM.HTMLOptionsCollection.IndexedPropertyGetter"); + INC_STATS("DOM.HTMLOptionsCollection.IndexedPropertyGetter"); HTMLOptionsCollection* collection = V8Proxy::ToNativeObject<HTMLOptionsCollection>( V8ClassIndex::HTMLOPTIONSCOLLECTION, info.Holder()); @@ -1625,7 +1625,7 @@ static v8::Handle<v8::Value> OptionsCollectionSetter(uint32_t index, INDEXED_PROPERTY_SETTER(HTMLOptionsCollection) { - INC_STATS(L"DOM.HTMLOptionsCollection.IndexedPropertySetter"); + INC_STATS("DOM.HTMLOptionsCollection.IndexedPropertySetter"); HTMLOptionsCollection* collection = V8Proxy::ToNativeObject<HTMLOptionsCollection>( V8ClassIndex::HTMLOPTIONSCOLLECTION, info.Holder()); @@ -1635,7 +1635,7 @@ INDEXED_PROPERTY_SETTER(HTMLOptionsCollection) { INDEXED_PROPERTY_SETTER(HTMLSelectElementCollection) { - INC_STATS(L"DOM.HTMLSelectElementCollection.IndexedPropertySetter"); + INC_STATS("DOM.HTMLSelectElementCollection.IndexedPropertySetter"); HTMLSelectElement* select = V8Proxy::DOMWrapperToNode<HTMLSelectElement>(info.Holder()); return OptionsCollectionSetter(index, value, select); @@ -1728,7 +1728,7 @@ static String cssPropertyName(const String& propertyName, bool* hadPixelOrPosPre } NAMED_PROPERTY_GETTER(CSSStyleDeclaration) { - INC_STATS(L"DOM.CSSStyleDeclaration.NamedPropertyGetter"); + INC_STATS("DOM.CSSStyleDeclaration.NamedPropertyGetter"); // First look for API defined attributes on the style declaration // object. if (info.Holder()->HasRealNamedCallbackProperty(name)) @@ -1772,7 +1772,7 @@ NAMED_PROPERTY_GETTER(CSSStyleDeclaration) { NAMED_PROPERTY_SETTER(CSSStyleDeclaration) { - INC_STATS(L"DOM.CSSStyleDeclaration.NamedPropertySetter"); + INC_STATS("DOM.CSSStyleDeclaration.NamedPropertySetter"); CSSStyleDeclaration* imp = V8Proxy::ToNativeObject<CSSStyleDeclaration>( V8ClassIndex::CSSSTYLEDECLARATION, info.Holder()); String property_name = ToWebCoreString(name); @@ -1794,7 +1794,7 @@ NAMED_PROPERTY_SETTER(CSSStyleDeclaration) { NAMED_PROPERTY_GETTER(HTMLPlugInElement) { - INC_STATS(L"DOM.HTMLPlugInElement.NamedPropertyGetter"); + INC_STATS("DOM.HTMLPlugInElement.NamedPropertyGetter"); HTMLPlugInElement* imp = V8Proxy::DOMWrapperToNode<HTMLPlugInElement>(info.Holder()); v8::Local<v8::Object> instance = @@ -1805,7 +1805,7 @@ NAMED_PROPERTY_GETTER(HTMLPlugInElement) { NAMED_PROPERTY_SETTER(HTMLPlugInElement) { - INC_STATS(L"DOM.HTMLPlugInElement.NamedPropertySetter"); + INC_STATS("DOM.HTMLPlugInElement.NamedPropertySetter"); HTMLPlugInElement* imp = V8Proxy::DOMWrapperToNode<HTMLPlugInElement>(info.Holder()); v8::Local<v8::Object> instance = @@ -1819,13 +1819,13 @@ NAMED_PROPERTY_SETTER(HTMLPlugInElement) { CALLBACK_FUNC_DECL(HTMLPlugInElement) { - INC_STATS(L"DOM.HTMLPluginElement()"); + INC_STATS("DOM.HTMLPluginElement()"); return NPObjectInvokeDefaultHandler(args); } INDEXED_PROPERTY_GETTER(HTMLPlugInElement) { - INC_STATS(L"DOM.HTMLPlugInElement.IndexedPropertyGetter"); + INC_STATS("DOM.HTMLPlugInElement.IndexedPropertyGetter"); HTMLPlugInElement* imp = V8Proxy::DOMWrapperToNode<HTMLPlugInElement>(info.Holder()); v8::Local<v8::Object> instance = @@ -1836,7 +1836,7 @@ INDEXED_PROPERTY_GETTER(HTMLPlugInElement) { INDEXED_PROPERTY_SETTER(HTMLPlugInElement) { - INC_STATS(L"DOM.HTMLPlugInElement.IndexedPropertySetter"); + INC_STATS("DOM.HTMLPlugInElement.IndexedPropertySetter"); HTMLPlugInElement* imp = V8Proxy::DOMWrapperToNode<HTMLPlugInElement>(info.Holder()); v8::Local<v8::Object> instance = @@ -1849,7 +1849,7 @@ INDEXED_PROPERTY_SETTER(HTMLPlugInElement) { } NAMED_PROPERTY_GETTER(StyleSheetList) { - INC_STATS(L"DOM.StyleSheetList.NamedPropertyGetter"); + INC_STATS("DOM.StyleSheetList.NamedPropertyGetter"); // Look for local properties first. if (info.Holder()->HasRealNamedProperty(name)) { return v8::Handle<v8::Value>(); @@ -1876,7 +1876,7 @@ NAMED_PROPERTY_GETTER(StyleSheetList) { // TODO: SetStrokeColor and SetFillColor are similar except function names, // consolidate them into one. CALLBACK_FUNC_DECL(CanvasRenderingContext2DSetStrokeColor) { - INC_STATS(L"DOM.CanvasRenderingContext2D.setStrokeColor()"); + INC_STATS("DOM.CanvasRenderingContext2D.setStrokeColor()"); CanvasRenderingContext2D* context = V8Proxy::ToNativeObject<CanvasRenderingContext2D>( V8ClassIndex::CANVASRENDERINGCONTEXT2D, args.Holder()); @@ -1919,7 +1919,7 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DSetStrokeColor) { } CALLBACK_FUNC_DECL(CanvasRenderingContext2DSetFillColor) { - INC_STATS(L"DOM.CanvasRenderingContext2D.steFillColor()"); + INC_STATS("DOM.CanvasRenderingContext2D.steFillColor()"); CanvasRenderingContext2D* context = V8Proxy::ToNativeObject<CanvasRenderingContext2D>( V8ClassIndex::CANVASRENDERINGCONTEXT2D, args.Holder()); @@ -1960,7 +1960,7 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DSetFillColor) { } CALLBACK_FUNC_DECL(CanvasRenderingContext2DStrokeRect) { - INC_STATS(L"DOM.CanvasRenderingContext2D.strokeRect()"); + INC_STATS("DOM.CanvasRenderingContext2D.strokeRect()"); CanvasRenderingContext2D* context = V8Proxy::ToNativeObject<CanvasRenderingContext2D>( V8ClassIndex::CANVASRENDERINGCONTEXT2D, args.Holder()); @@ -1984,7 +1984,7 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DStrokeRect) { } CALLBACK_FUNC_DECL(CanvasRenderingContext2DSetShadow) { - INC_STATS(L"DOM.CanvasRenderingContext2D.setShadow()"); + INC_STATS("DOM.CanvasRenderingContext2D.setShadow()"); CanvasRenderingContext2D* context = V8Proxy::ToNativeObject<CanvasRenderingContext2D>( V8ClassIndex::CANVASRENDERINGCONTEXT2D, args.Holder()); @@ -2034,7 +2034,7 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DSetShadow) { } CALLBACK_FUNC_DECL(CanvasRenderingContext2DDrawImage) { - INC_STATS(L"DOM.CanvasRenderingContext2D.drawImage()"); + INC_STATS("DOM.CanvasRenderingContext2D.drawImage()"); CanvasRenderingContext2D* context = V8Proxy::ToNativeObject<CanvasRenderingContext2D>( V8ClassIndex::CANVASRENDERINGCONTEXT2D, args.Holder()); @@ -2119,7 +2119,7 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DDrawImage) { } CALLBACK_FUNC_DECL(CanvasRenderingContext2DDrawImageFromRect) { - INC_STATS(L"DOM.CanvasRenderingContext2D.drawImageFromRect()"); + INC_STATS("DOM.CanvasRenderingContext2D.drawImageFromRect()"); CanvasRenderingContext2D* context = V8Proxy::ToNativeObject<CanvasRenderingContext2D>( V8ClassIndex::CANVASRENDERINGCONTEXT2D, args.Holder()); @@ -2144,7 +2144,7 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DDrawImageFromRect) { } CALLBACK_FUNC_DECL(CanvasRenderingContext2DCreatePattern) { - INC_STATS(L"DOM.CanvasRenderingContext2D.createPattern()"); + INC_STATS("DOM.CanvasRenderingContext2D.createPattern()"); CanvasRenderingContext2D* context = V8Proxy::ToNativeObject<CanvasRenderingContext2D>( V8ClassIndex::CANVASRENDERINGCONTEXT2D, args.Holder()); @@ -2184,7 +2184,7 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DCreatePattern) { } CALLBACK_FUNC_DECL(CanvasRenderingContext2DFillText) { - INC_STATS(L"DOM.CanvasRenderingContext2D.fillText()"); + INC_STATS("DOM.CanvasRenderingContext2D.fillText()"); CanvasRenderingContext2D* context = V8Proxy::ToNativeObject<CanvasRenderingContext2D>( @@ -2213,7 +2213,7 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DFillText) { } CALLBACK_FUNC_DECL(CanvasRenderingContext2DStrokeText) { - INC_STATS(L"DOM.CanvasRenderingContext2D.strokeText()"); + INC_STATS("DOM.CanvasRenderingContext2D.strokeText()"); CanvasRenderingContext2D* context = V8Proxy::ToNativeObject<CanvasRenderingContext2D>( @@ -2242,7 +2242,7 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DStrokeText) { } CALLBACK_FUNC_DECL(CanvasRenderingContext2DPutImageData) { - INC_STATS(L"DOM.CanvasRenderingContext2D.putImageData()"); + INC_STATS("DOM.CanvasRenderingContext2D.putImageData()"); // Two froms: // * putImageData(ImageData, x, y) @@ -2289,31 +2289,31 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DPutImageData) { // Console --------------------------------------------------------------------- CALLBACK_FUNC_DECL(ConsoleAssert) { - INC_STATS(L"DOM.Console.assert()"); + INC_STATS("DOM.Console.assert()"); V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); return v8::Undefined(); } CALLBACK_FUNC_DECL(ConsoleCount) { - INC_STATS(L"DOM.Console.count()"); + INC_STATS("DOM.Console.count()"); V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); return v8::Undefined(); } CALLBACK_FUNC_DECL(ConsoleDebug) { - INC_STATS(L"DOM.Console.debug()"); + INC_STATS("DOM.Console.debug()"); V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); return v8::Undefined(); } CALLBACK_FUNC_DECL(ConsoleDir) { - INC_STATS(L"DOM.Console.dir()"); + INC_STATS("DOM.Console.dir()"); V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); return v8::Undefined(); } CALLBACK_FUNC_DECL(ConsoleError) { - INC_STATS(L"DOM.Console.error()"); + INC_STATS("DOM.Console.error()"); v8::Handle<v8::Value> holder = args.Holder(); Console* imp = V8Proxy::ToNativeObject<Console>(V8ClassIndex::CONSOLE, holder); ScriptCallContext context(args); @@ -2322,7 +2322,7 @@ CALLBACK_FUNC_DECL(ConsoleError) { } CALLBACK_FUNC_DECL(ConsoleGroup) { - INC_STATS(L"DOM.Console.group()"); + INC_STATS("DOM.Console.group()"); v8::Handle<v8::Value> holder = args.Holder(); Console* imp = V8Proxy::ToNativeObject<Console>(V8ClassIndex::CONSOLE, holder); ScriptCallContext context(args); @@ -2331,7 +2331,7 @@ CALLBACK_FUNC_DECL(ConsoleGroup) { } CALLBACK_FUNC_DECL(ConsoleInfo) { - INC_STATS(L"DOM.Console.info()"); + INC_STATS("DOM.Console.info()"); v8::Handle<v8::Value> holder = args.Holder(); Console* imp = V8Proxy::ToNativeObject<Console>(V8ClassIndex::CONSOLE, holder); ScriptCallContext context(args); @@ -2340,7 +2340,7 @@ CALLBACK_FUNC_DECL(ConsoleInfo) { } CALLBACK_FUNC_DECL(ConsoleLog) { - INC_STATS(L"DOM.Console.log()"); + INC_STATS("DOM.Console.log()"); v8::Handle<v8::Value> holder = args.Holder(); Console* imp = V8Proxy::ToNativeObject<Console>(V8ClassIndex::CONSOLE, holder); ScriptCallContext context(args); @@ -2349,25 +2349,25 @@ CALLBACK_FUNC_DECL(ConsoleLog) { } CALLBACK_FUNC_DECL(ConsoleProfile) { - INC_STATS(L"DOM.Console.profile()"); + INC_STATS("DOM.Console.profile()"); V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); return v8::Undefined(); } CALLBACK_FUNC_DECL(ConsoleProfileEnd) { - INC_STATS(L"DOM.Console.profileEnd()"); + INC_STATS("DOM.Console.profileEnd()"); V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); return v8::Undefined(); } CALLBACK_FUNC_DECL(ConsoleTimeEnd) { - INC_STATS(L"DOM.Console.timeEnd()"); + INC_STATS("DOM.Console.timeEnd()"); V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); return v8::Undefined(); } CALLBACK_FUNC_DECL(ConsoleWarn) { - INC_STATS(L"DOM.Console.warn()"); + INC_STATS("DOM.Console.warn()"); v8::Handle<v8::Value> holder = args.Holder(); Console* imp = V8Proxy::ToNativeObject<Console>(V8ClassIndex::CONSOLE, holder); ScriptCallContext context(args); @@ -2376,13 +2376,13 @@ CALLBACK_FUNC_DECL(ConsoleWarn) { } CALLBACK_FUNC_DECL(ConsoleDirxml) { - INC_STATS(L"DOM.Console.dirxml()"); + INC_STATS("DOM.Console.dirxml()"); V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); return v8::Undefined(); } CALLBACK_FUNC_DECL(ConsoleTrace) { - INC_STATS(L"DOM.Console.trace()"); + INC_STATS("DOM.Console.trace()"); V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); return v8::Undefined(); } @@ -2392,7 +2392,7 @@ CALLBACK_FUNC_DECL(ConsoleTrace) { ACCESSOR_GETTER(ClipboardTypes) { - INC_STATS(L"DOM.Clipboard.types()"); + INC_STATS("DOM.Clipboard.types()"); Clipboard* imp = V8Proxy::ToNativeObject<Clipboard>(V8ClassIndex::CLIPBOARD, info.Holder()); @@ -2414,7 +2414,7 @@ ACCESSOR_GETTER(ClipboardTypes) { CALLBACK_FUNC_DECL(ClipboardClearData) { - INC_STATS(L"DOM.Clipboard.clearData()"); + INC_STATS("DOM.Clipboard.clearData()"); Clipboard* imp = V8Proxy::ToNativeObject<Clipboard>( V8ClassIndex::CLIPBOARD, args.Holder()); @@ -2436,7 +2436,7 @@ CALLBACK_FUNC_DECL(ClipboardClearData) { CALLBACK_FUNC_DECL(ClipboardGetData) { - INC_STATS(L"DOM.Clipboard.getData()"); + INC_STATS("DOM.Clipboard.getData()"); Clipboard* imp = V8Proxy::ToNativeObject<Clipboard>( V8ClassIndex::CLIPBOARD, args.Holder()); @@ -2454,7 +2454,7 @@ CALLBACK_FUNC_DECL(ClipboardGetData) { } CALLBACK_FUNC_DECL(ClipboardSetData) { - INC_STATS(L"DOM.Clipboard.setData()"); + INC_STATS("DOM.Clipboard.setData()"); Clipboard* imp = V8Proxy::ToNativeObject<Clipboard>( V8ClassIndex::CLIPBOARD, args.Holder()); @@ -2472,7 +2472,7 @@ CALLBACK_FUNC_DECL(ClipboardSetData) { CALLBACK_FUNC_DECL(ClipboardSetDragImage) { - INC_STATS(L"DOM.Clipboard.setDragImage()"); + INC_STATS("DOM.Clipboard.setDragImage()"); Clipboard* imp = V8Proxy::ToNativeObject<Clipboard>( V8ClassIndex::CLIPBOARD, args.Holder()); @@ -2552,7 +2552,7 @@ static bool AllowSettingFrameSrcToJavascriptUrl(HTMLFrameElementBase* frame, // Element --------------------------------------------------------------------- CALLBACK_FUNC_DECL(ElementSetAttribute) { - INC_STATS(L"DOM.Element.setAttribute()"); + INC_STATS("DOM.Element.setAttribute()"); Element* imp = V8Proxy::DOMWrapperToNode<Element>(args.Holder()); ExceptionCode ec = 0; String name = ToWebCoreString(args[0]); @@ -2571,7 +2571,7 @@ CALLBACK_FUNC_DECL(ElementSetAttribute) { } CALLBACK_FUNC_DECL(ElementSetAttributeNode) { - INC_STATS(L"DOM.Element.setAttributeNode()"); + INC_STATS("DOM.Element.setAttributeNode()"); if (!V8Attr::HasInstance(args[0])) { V8Proxy::SetDOMException(TYPE_MISMATCH_ERR); return v8::Handle<v8::Value>(); @@ -2594,7 +2594,7 @@ CALLBACK_FUNC_DECL(ElementSetAttributeNode) { } CALLBACK_FUNC_DECL(ElementSetAttributeNS) { - INC_STATS(L"DOM.Element.setAttributeNS()"); + INC_STATS("DOM.Element.setAttributeNS()"); Element* imp = V8Proxy::DOMWrapperToNode<Element>(args.Holder()); ExceptionCode ec = 0; String namespaceURI = valueToStringWithNullCheck(args[0]); @@ -2614,7 +2614,7 @@ CALLBACK_FUNC_DECL(ElementSetAttributeNS) { } CALLBACK_FUNC_DECL(ElementSetAttributeNodeNS) { - INC_STATS(L"DOM.Element.setAttributeNodeNS()"); + INC_STATS("DOM.Element.setAttributeNodeNS()"); if (!V8Attr::HasInstance(args[0])) { V8Proxy::SetDOMException(TYPE_MISMATCH_ERR); return v8::Handle<v8::Value>(); @@ -2754,13 +2754,13 @@ v8::Handle<v8::Value> V8Custom::WindowSetTimeoutImpl(const v8::Arguments& args, CALLBACK_FUNC_DECL(DOMWindowSetTimeout) { - INC_STATS(L"DOM.DOMWindow.setTimeout()"); + INC_STATS("DOM.DOMWindow.setTimeout()"); return WindowSetTimeoutImpl(args, true); } CALLBACK_FUNC_DECL(DOMWindowSetInterval) { - INC_STATS(L"DOM.DOMWindow.setInterval()"); + INC_STATS("DOM.DOMWindow.setInterval()"); return WindowSetTimeoutImpl(args, false); } @@ -2780,7 +2780,7 @@ static String WriteHelper_GetString(const v8::Arguments& args) { } CALLBACK_FUNC_DECL(HTMLDocumentWrite) { - INC_STATS(L"DOM.HTMLDocument.write()"); + INC_STATS("DOM.HTMLDocument.write()"); HTMLDocument* imp = V8Proxy::DOMWrapperToNode<HTMLDocument>(args.Holder()); Frame* frame = V8Proxy::retrieveActiveFrame(); ASSERT(frame); @@ -2789,7 +2789,7 @@ CALLBACK_FUNC_DECL(HTMLDocumentWrite) { } CALLBACK_FUNC_DECL(HTMLDocumentWriteln) { - INC_STATS(L"DOM.HTMLDocument.writeln()"); + INC_STATS("DOM.HTMLDocument.writeln()"); HTMLDocument* imp = V8Proxy::DOMWrapperToNode<HTMLDocument>(args.Holder()); Frame* frame = V8Proxy::retrieveActiveFrame(); ASSERT(frame); @@ -2798,7 +2798,7 @@ CALLBACK_FUNC_DECL(HTMLDocumentWriteln) { } CALLBACK_FUNC_DECL(HTMLDocumentOpen) { - INC_STATS(L"DOM.HTMLDocument.open()"); + INC_STATS("DOM.HTMLDocument.open()"); HTMLDocument* imp = V8Proxy::DOMWrapperToNode<HTMLDocument>(args.Holder()); if (args.Length() > 2) { @@ -2840,7 +2840,7 @@ CALLBACK_FUNC_DECL(HTMLDocumentOpen) { // Document -------------------------------------------------------------------- CALLBACK_FUNC_DECL(DocumentEvaluate) { - INC_STATS(L"DOM.Document.evaluate()"); + INC_STATS("DOM.Document.evaluate()"); Document* imp = V8Proxy::DOMWrapperToNode<Document>(args.Holder()); ExceptionCode ec = 0; @@ -2915,7 +2915,7 @@ static v8::Handle<v8::Value> Base64Convert(const String& str, bool encode) { } CALLBACK_FUNC_DECL(DOMWindowAtob) { - INC_STATS(L"DOM.DOMWindow.atob()"); + INC_STATS("DOM.DOMWindow.atob()"); DOMWindow* imp = V8Proxy::ToNativeObject<DOMWindow>( V8ClassIndex::DOMWINDOW, args.Holder()); @@ -2934,7 +2934,7 @@ CALLBACK_FUNC_DECL(DOMWindowAtob) { } CALLBACK_FUNC_DECL(DOMWindowBtoa) { - INC_STATS(L"DOM.DOMWindow.btoa()"); + INC_STATS("DOM.DOMWindow.btoa()"); DOMWindow* imp = V8Proxy::ToNativeObject<DOMWindow>( V8ClassIndex::DOMWINDOW, args.Holder()); @@ -2958,13 +2958,13 @@ CALLBACK_FUNC_DECL(DOMWindowBtoa) { // switching context of receiver. I consider it is dangerous. CALLBACK_FUNC_DECL(DOMWindowToString) { - INC_STATS(L"DOM.DOMWindow.toString()"); + INC_STATS("DOM.DOMWindow.toString()"); return args.This()->ObjectProtoToString(); } CALLBACK_FUNC_DECL(DOMWindowNOP) { - INC_STATS(L"DOM.DOMWindow.nop()"); + INC_STATS("DOM.DOMWindow.nop()"); return v8::Undefined(); } @@ -2972,7 +2972,7 @@ CALLBACK_FUNC_DECL(DOMWindowNOP) // EventTargetNode ------------------------------------------------------------- CALLBACK_FUNC_DECL(EventTargetNodeAddEventListener) { - INC_STATS(L"DOM.EventTargetNode.addEventListener()"); + INC_STATS("DOM.EventTargetNode.addEventListener()"); EventTargetNode* node = V8Proxy::DOMWrapperToNode<EventTargetNode>(args.Holder()); @@ -2991,7 +2991,7 @@ CALLBACK_FUNC_DECL(EventTargetNodeAddEventListener) { } CALLBACK_FUNC_DECL(EventTargetNodeRemoveEventListener) { - INC_STATS(L"DOM.EventTargetNode.removeEventListener()"); + INC_STATS("DOM.EventTargetNode.removeEventListener()"); EventTargetNode* node = V8Proxy::DOMWrapperToNode<EventTargetNode>(args.Holder()); @@ -3016,7 +3016,7 @@ CALLBACK_FUNC_DECL(EventTargetNodeRemoveEventListener) { // Navigator ------------------------------------------------------------------ ACCESSOR_GETTER(NavigatorAppVersion) { - INC_STATS(L"DOM.Navigator.appVersion"); + INC_STATS("DOM.Navigator.appVersion"); v8::Handle<v8::Object> holder = info.Holder(); Navigator* imp = V8Proxy::ToNativeObject<Navigator>(V8ClassIndex::NAVIGATOR, holder); @@ -3028,7 +3028,7 @@ ACCESSOR_GETTER(NavigatorAppVersion) { // TreeWalker ------------------------------------------------------------------ CALLBACK_FUNC_DECL(TreeWalkerParentNode) { - INC_STATS(L"DOM.TreeWalker.parentNode()"); + INC_STATS("DOM.TreeWalker.parentNode()"); TreeWalker* treeWalker = V8Proxy::ToNativeObject<TreeWalker>( V8ClassIndex::TREEWALKER, args.Holder()); @@ -3043,7 +3043,7 @@ CALLBACK_FUNC_DECL(TreeWalkerParentNode) { } CALLBACK_FUNC_DECL(TreeWalkerFirstChild) { - INC_STATS(L"DOM.TreeWalker.firstChild()"); + INC_STATS("DOM.TreeWalker.firstChild()"); TreeWalker* treeWalker = V8Proxy::ToNativeObject<TreeWalker>( V8ClassIndex::TREEWALKER, args.Holder()); @@ -3058,7 +3058,7 @@ CALLBACK_FUNC_DECL(TreeWalkerFirstChild) { } CALLBACK_FUNC_DECL(TreeWalkerLastChild) { - INC_STATS(L"DOM.TreeWalker.lastChild()"); + INC_STATS("DOM.TreeWalker.lastChild()"); TreeWalker* treeWalker = V8Proxy::ToNativeObject<TreeWalker>( V8ClassIndex::TREEWALKER, args.Holder()); @@ -3073,7 +3073,7 @@ CALLBACK_FUNC_DECL(TreeWalkerLastChild) { } CALLBACK_FUNC_DECL(TreeWalkerNextNode) { - INC_STATS(L"DOM.TreeWalker.nextNode()"); + INC_STATS("DOM.TreeWalker.nextNode()"); TreeWalker* treeWalker = V8Proxy::ToNativeObject<TreeWalker>( V8ClassIndex::TREEWALKER, args.Holder()); @@ -3088,7 +3088,7 @@ CALLBACK_FUNC_DECL(TreeWalkerNextNode) { } CALLBACK_FUNC_DECL(TreeWalkerPreviousNode) { - INC_STATS(L"DOM.TreeWalker.previousNode()"); + INC_STATS("DOM.TreeWalker.previousNode()"); TreeWalker* treeWalker = V8Proxy::ToNativeObject<TreeWalker>( V8ClassIndex::TREEWALKER, args.Holder()); @@ -3103,7 +3103,7 @@ CALLBACK_FUNC_DECL(TreeWalkerPreviousNode) { } CALLBACK_FUNC_DECL(TreeWalkerNextSibling) { - INC_STATS(L"DOM.TreeWalker.nextSibling()"); + INC_STATS("DOM.TreeWalker.nextSibling()"); TreeWalker* treeWalker = V8Proxy::ToNativeObject<TreeWalker>( V8ClassIndex::TREEWALKER, args.Holder()); @@ -3118,7 +3118,7 @@ CALLBACK_FUNC_DECL(TreeWalkerNextSibling) { } CALLBACK_FUNC_DECL(TreeWalkerPreviousSibling) { - INC_STATS(L"DOM.TreeWalker.previousSibling()"); + INC_STATS("DOM.TreeWalker.previousSibling()"); TreeWalker* treeWalker = V8Proxy::ToNativeObject<TreeWalker>( V8ClassIndex::TREEWALKER, args.Holder()); @@ -3133,7 +3133,7 @@ CALLBACK_FUNC_DECL(TreeWalkerPreviousSibling) { } CALLBACK_FUNC_DECL(NodeIteratorNextNode) { - INC_STATS(L"DOM.NodeIterator.nextNode()"); + INC_STATS("DOM.NodeIterator.nextNode()"); NodeIterator* nodeIterator = V8Proxy::ToNativeObject<NodeIterator>( V8ClassIndex::NODEITERATOR, args.Holder()); @@ -3153,7 +3153,7 @@ CALLBACK_FUNC_DECL(NodeIteratorNextNode) { } CALLBACK_FUNC_DECL(NodeIteratorPreviousNode) { - INC_STATS(L"DOM.NodeIterator.previousNode()"); + INC_STATS("DOM.NodeIterator.previousNode()"); NodeIterator* nodeIterator = V8Proxy::ToNativeObject<NodeIterator>( V8ClassIndex::NODEITERATOR, args.Holder()); @@ -3173,7 +3173,7 @@ CALLBACK_FUNC_DECL(NodeIteratorPreviousNode) { } CALLBACK_FUNC_DECL(NodeFilterAcceptNode) { - INC_STATS(L"DOM.NodeFilter.acceptNode()"); + INC_STATS("DOM.NodeFilter.acceptNode()"); V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); return v8::Undefined(); } @@ -3328,7 +3328,7 @@ ACCESSOR_SETTER(HTMLOptionsCollectionLength) { } ACCESSOR_GETTER(HTMLInputElementSelectionStart) { - INC_STATS(L"DOM.HTMLInputElement.selectionStart._get"); + INC_STATS("DOM.HTMLInputElement.selectionStart._get"); v8::Handle<v8::Object> holder = info.Holder(); HTMLInputElement* imp = V8Proxy::DOMWrapperToNode<HTMLInputElement>(holder); @@ -3340,7 +3340,7 @@ ACCESSOR_GETTER(HTMLInputElementSelectionStart) { } ACCESSOR_GETTER(HTMLInputElementSelectionEnd) { - INC_STATS(L"DOM.HTMLInputElement.selectionEnd._get"); + INC_STATS("DOM.HTMLInputElement.selectionEnd._get"); v8::Handle<v8::Object> holder = info.Holder(); HTMLInputElement* imp = V8Proxy::DOMWrapperToNode<HTMLInputElement>(holder); @@ -3354,14 +3354,14 @@ ACCESSOR_GETTER(HTMLInputElementSelectionEnd) { #if ENABLE(SVG) ACCESSOR_GETTER(SVGLengthValue) { - INC_STATS(L"DOM.SVGLength.value"); + INC_STATS("DOM.SVGLength.value"); V8SVGPODTypeWrapper<SVGLength>* wrapper = V8Proxy::ToNativeObject<V8SVGPODTypeWrapper<SVGLength> >(V8ClassIndex::SVGLENGTH, info.Holder()); SVGLength imp = *wrapper; return v8::Number::New(imp.value(V8Proxy::GetSVGContext(wrapper))); } CALLBACK_FUNC_DECL(SVGLengthConvertToSpecifiedUnits) { - INC_STATS(L"DOM.SVGLength.convertToSpecifiedUnits"); + INC_STATS("DOM.SVGLength.convertToSpecifiedUnits"); V8SVGPODTypeWrapper<SVGLength>* wrapper = V8Proxy::ToNativeObject<V8SVGPODTypeWrapper<SVGLength> >(V8ClassIndex::SVGLENGTH, args.Holder()); SVGLength imp = *wrapper; SVGElement* context = V8Proxy::GetSVGContext(wrapper); @@ -3371,7 +3371,7 @@ CALLBACK_FUNC_DECL(SVGLengthConvertToSpecifiedUnits) { } CALLBACK_FUNC_DECL(SVGMatrixInverse) { - INC_STATS(L"DOM.SVGMatrix.inverse()"); + INC_STATS("DOM.SVGMatrix.inverse()"); AffineTransform imp = *V8Proxy::ToNativeObject<V8SVGPODTypeWrapper<AffineTransform> >( V8ClassIndex::SVGMATRIX, args.Holder()); @@ -3391,7 +3391,7 @@ CALLBACK_FUNC_DECL(SVGMatrixInverse) { } CALLBACK_FUNC_DECL(SVGMatrixRotateFromVector) { - INC_STATS(L"DOM.SVGMatrix.rotateFromVector()"); + INC_STATS("DOM.SVGMatrix.rotateFromVector()"); AffineTransform imp = *V8Proxy::ToNativeObject<V8SVGPODTypeWrapper<AffineTransform> >( V8ClassIndex::SVGMATRIX, args.Holder()); @@ -3414,7 +3414,7 @@ CALLBACK_FUNC_DECL(SVGMatrixRotateFromVector) { } CALLBACK_FUNC_DECL(SVGElementInstanceAddEventListener) { - INC_STATS(L"DOM.SVGElementInstance.AddEventListener()"); + INC_STATS("DOM.SVGElementInstance.AddEventListener()"); SVGElementInstance* instance = V8Proxy::DOMWrapperToNative<SVGElementInstance>(args.Holder()); @@ -3433,7 +3433,7 @@ CALLBACK_FUNC_DECL(SVGElementInstanceAddEventListener) { } CALLBACK_FUNC_DECL(SVGElementInstanceRemoveEventListener) { - INC_STATS(L"DOM.SVGElementInstance.RemoveEventListener()"); + INC_STATS("DOM.SVGElementInstance.RemoveEventListener()"); SVGElementInstance* instance = V8Proxy::DOMWrapperToNative<SVGElementInstance>(args.Holder()); diff --git a/webkit/port/platform/chromium/ChromiumBridge.h b/webkit/port/platform/chromium/ChromiumBridge.h index 69c3b33..cde6508 100644 --- a/webkit/port/platform/chromium/ChromiumBridge.h +++ b/webkit/port/platform/chromium/ChromiumBridge.h @@ -122,9 +122,8 @@ namespace WebCore { static void stopSharedTimer(); // StatsCounters ------------------------------------------------------ - // TODO(erikkay): WebKit doesn't use wchar_t - change to use UTF8 - static void decrementStatsCounter(const wchar_t* name); - static void incrementStatsCounter(const wchar_t* name); + static void decrementStatsCounter(const char* name); + static void incrementStatsCounter(const char* name); static void initV8CounterFunction(); // SystemTime ---------------------------------------------------------- diff --git a/webkit/tools/test_shell/mac/main.mm b/webkit/tools/test_shell/mac/main.mm index a3dbeb8..9dd39be 100644 --- a/webkit/tools/test_shell/mac/main.mm +++ b/webkit/tools/test_shell/mac/main.mm @@ -27,7 +27,7 @@ static char g_currentTestName[PATH_MAX]; -static const wchar_t* kStatsFile = L"testshell"; +static const char* kStatsFile = "testshell"; static int kStatsFileThreads = 20; static int kStatsFileCounters = 100; @@ -164,8 +164,8 @@ int main(const int argc, const char *argv[]) { // Load and initialize the stats table (one per process, so that multiple // instances don't interfere with each other) - wchar_t statsfile[64]; - swprintf(statsfile, 64, L"%ls-%d", kStatsFile, getpid()); + char statsfile[64]; + snprintf(statsfile, 64, "%s-%d", kStatsFile, getpid()); StatsTable *table = new StatsTable(statsfile, kStatsFileThreads, kStatsFileCounters); StatsTable::set_current(table); diff --git a/webkit/tools/test_shell/test_shell.cc b/webkit/tools/test_shell/test_shell.cc index ed88267..523bd83 100644 --- a/webkit/tools/test_shell/test_shell.cc +++ b/webkit/tools/test_shell/test_shell.cc @@ -138,10 +138,10 @@ TestShell::~TestShell() { if (table != NULL) { int counter_max = table->GetMaxCounters(); for (int index=0; index < counter_max; index++) { - std::wstring name(table->GetRowName(index)); + std::string name(table->GetRowName(index)); if (name.length() > 0) { int value = table->GetRowValue(index); - printf("%s:\t%d\n", WideToUTF8(name).c_str(), value); + printf("%s:\t%d\n", name.c_str(), value); } } } diff --git a/webkit/tools/test_shell/test_shell_main.cc b/webkit/tools/test_shell/test_shell_main.cc index 91a9567..9d619ef 100644 --- a/webkit/tools/test_shell/test_shell_main.cc +++ b/webkit/tools/test_shell/test_shell_main.cc @@ -54,7 +54,7 @@ static const size_t kPathBufSize = 2048; namespace { // StatsTable initialization parameters. -static const wchar_t* kStatsFilePrefix = L"testshell_"; +static const char* kStatsFilePrefix = "testshell_"; static int kStatsFileThreads = 20; static int kStatsFileCounters = 200; @@ -233,7 +233,7 @@ int main(int argc, char* argv[]) { // Load and initialize the stats table. Attempt to construct a somewhat // unique name to isolate separate instances from each other. StatsTable *table = new StatsTable( - kStatsFilePrefix + Uint64ToWString(base::RandUint64()), + kStatsFilePrefix + Uint64ToString(base::RandUint64()), kStatsFileThreads, kStatsFileCounters); StatsTable::set_current(table); |