diff options
author | zmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-26 01:56:04 +0000 |
---|---|---|
committer | zmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-26 01:56:04 +0000 |
commit | 829a75c436716131df39ccd901733b31235e0bf7 (patch) | |
tree | 87e76d3aa1c760708e4680d805a47031c2547545 /gpu | |
parent | a3c6a4d9734df728998cc9613838b3db307548de (diff) | |
download | chromium_src-829a75c436716131df39ccd901733b31235e0bf7.zip chromium_src-829a75c436716131df39ccd901733b31235e0bf7.tar.gz chromium_src-829a75c436716131df39ccd901733b31235e0bf7.tar.bz2 |
Use a more flexible methord to search for hashed names in webgl program log.
Before we hardwired the method to look for "webgl_" and next 16 characters. Now we look for "webgl_" and the end of next hex digits. This is less dependent on the ANGLE implementation than before.
However, to be on the safe size, still DCHECK if we found 16 hex digits.
BUG=160369
TEST=
TBR=gman
Review URL: https://codereview.chromium.org/12038103
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@178986 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r-- | gpu/command_buffer/service/program_manager.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/gpu/command_buffer/service/program_manager.cc b/gpu/command_buffer/service/program_manager.cc index 5f5d2f5..4bbc933 100644 --- a/gpu/command_buffer/service/program_manager.cc +++ b/gpu/command_buffer/service/program_manager.cc @@ -152,7 +152,6 @@ void ProgramManager::ProgramInfo::Reset() { std::string ProgramManager::ProgramInfo::ProcessLogInfo( const std::string& log) { const char kHashedNamePrefix[] = "webgl_"; - const size_t kHashedNameLength = 22; // "webgl_" plus sixteen digits. std::string output; size_t current = 0; @@ -160,12 +159,17 @@ std::string ProgramManager::ProgramInfo::ProcessLogInfo( while (next != std::string::npos) { output += log.substr(current, next - current); - std::string hashed_name = log.substr(next, kHashedNameLength); + size_t end_of_name = log.find_first_not_of( + "0123456789abcdefABCDEF", next + sizeof(kHashedNamePrefix)); + size_t name_length = end_of_name - next; + // Currently we use 64bit hashing, which converts to 16 hex digits. + DCHECK(name_length == sizeof(kHashedNamePrefix) + 16); + std::string hashed_name = log.substr(next, name_length); const std::string* original_name = GetOriginalNameFromHashedName(hashed_name); if (original_name) { output += *original_name; - current = next + kHashedNameLength; + current = next + name_length; } else { // This shouldn't happen, but still handle it, to be on the safer side. output += std::string(kHashedNamePrefix); |