| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "gpu/command_buffer/service/program_cache.h" | 5 #include "gpu/command_buffer/service/program_cache.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "gpu/command_buffer/service/shader_manager.h" | 9 #include "gpu/command_buffer/service/shader_manager.h" |
| 10 | 10 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 67 |
| 68 void ProgramCache::LinkedProgramCacheSuccess(const std::string& program_hash) { | 68 void ProgramCache::LinkedProgramCacheSuccess(const std::string& program_hash) { |
| 69 link_status_[program_hash] = LINK_SUCCEEDED; | 69 link_status_[program_hash] = LINK_SUCCEEDED; |
| 70 } | 70 } |
| 71 | 71 |
| 72 void ProgramCache::ComputeShaderHash( | 72 void ProgramCache::ComputeShaderHash( |
| 73 const std::string& str, | 73 const std::string& str, |
| 74 const ShaderTranslatorInterface* translator, | 74 const ShaderTranslatorInterface* translator, |
| 75 char* result) const { | 75 char* result) const { |
| 76 std::string s(( | 76 std::string s(( |
| 77 translator ? translator->GetStringForOptionsThatWouldEffectCompilation() : | 77 translator ? translator->GetStringForOptionsThatWouldAffectCompilation() : |
| 78 std::string()) + str); | 78 std::string()) + str); |
| 79 base::SHA1HashBytes(reinterpret_cast<const unsigned char*>(s.c_str()), | 79 base::SHA1HashBytes(reinterpret_cast<const unsigned char*>(s.c_str()), |
| 80 s.length(), reinterpret_cast<unsigned char*>(result)); | 80 s.length(), reinterpret_cast<unsigned char*>(result)); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void ProgramCache::Evict(const std::string& program_hash) { | 83 void ProgramCache::Evict(const std::string& program_hash) { |
| 84 link_status_.erase(program_hash); | 84 link_status_.erase(program_hash); |
| 85 } | 85 } |
| 86 | 86 |
| 87 namespace { | 87 namespace { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 buffer[current_pos++] = value >> 8; | 127 buffer[current_pos++] = value >> 8; |
| 128 buffer[current_pos++] = value; | 128 buffer[current_pos++] = value; |
| 129 } | 129 } |
| 130 } | 130 } |
| 131 base::SHA1HashBytes(buffer.get(), | 131 base::SHA1HashBytes(buffer.get(), |
| 132 total_size, reinterpret_cast<unsigned char*>(result)); | 132 total_size, reinterpret_cast<unsigned char*>(result)); |
| 133 } | 133 } |
| 134 | 134 |
| 135 } // namespace gles2 | 135 } // namespace gles2 |
| 136 } // namespace gpu | 136 } // namespace gpu |
| OLD | NEW |