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

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doers.cc

Issue 2693553002: Only initialize a std::string with data when the data has len > 0. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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/gles2_cmd_decoder_passthrough.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h"
6 6
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 8
9 namespace gpu { 9 namespace gpu {
10 namespace gles2 { 10 namespace gles2 {
(...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 error::Error GLES2DecoderPassthroughImpl::DoGetProgramInfoLog( 1082 error::Error GLES2DecoderPassthroughImpl::DoGetProgramInfoLog(
1083 GLuint program, 1083 GLuint program,
1084 std::string* infolog) { 1084 std::string* infolog) {
1085 GLint info_log_len = 0; 1085 GLint info_log_len = 0;
1086 glGetProgramiv(GetProgramServiceID(program, resources_), GL_INFO_LOG_LENGTH, 1086 glGetProgramiv(GetProgramServiceID(program, resources_), GL_INFO_LOG_LENGTH,
1087 &info_log_len); 1087 &info_log_len);
1088 1088
1089 std::vector<char> buffer(info_log_len, 0); 1089 std::vector<char> buffer(info_log_len, 0);
1090 glGetProgramInfoLog(GetProgramServiceID(program, resources_), info_log_len, 1090 glGetProgramInfoLog(GetProgramServiceID(program, resources_), info_log_len,
1091 nullptr, buffer.data()); 1091 nullptr, buffer.data());
1092 *infolog = std::string(buffer.data()); 1092 *infolog = info_log_len > 0 ? std::string(buffer.data()) : std::string();
1093 return error::kNoError; 1093 return error::kNoError;
1094 } 1094 }
1095 1095
1096 error::Error GLES2DecoderPassthroughImpl::DoGetRenderbufferParameteriv( 1096 error::Error GLES2DecoderPassthroughImpl::DoGetRenderbufferParameteriv(
1097 GLenum target, 1097 GLenum target,
1098 GLenum pname, 1098 GLenum pname,
1099 GLsizei bufsize, 1099 GLsizei bufsize,
1100 GLsizei* length, 1100 GLsizei* length,
1101 GLint* params) { 1101 GLint* params) {
1102 glGetRenderbufferParameterivRobustANGLE(target, pname, bufsize, length, 1102 glGetRenderbufferParameterivRobustANGLE(target, pname, bufsize, length,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 } 1136 }
1137 1137
1138 error::Error GLES2DecoderPassthroughImpl::DoGetShaderInfoLog( 1138 error::Error GLES2DecoderPassthroughImpl::DoGetShaderInfoLog(
1139 GLuint shader, 1139 GLuint shader,
1140 std::string* infolog) { 1140 std::string* infolog) {
1141 GLuint service_id = GetShaderServiceID(shader, resources_); 1141 GLuint service_id = GetShaderServiceID(shader, resources_);
1142 GLint info_log_len = 0; 1142 GLint info_log_len = 0;
1143 glGetShaderiv(service_id, GL_INFO_LOG_LENGTH, &info_log_len); 1143 glGetShaderiv(service_id, GL_INFO_LOG_LENGTH, &info_log_len);
1144 std::vector<char> buffer(info_log_len, 0); 1144 std::vector<char> buffer(info_log_len, 0);
1145 glGetShaderInfoLog(service_id, info_log_len, nullptr, buffer.data()); 1145 glGetShaderInfoLog(service_id, info_log_len, nullptr, buffer.data());
1146 *infolog = std::string(buffer.data()); 1146 *infolog = info_log_len > 0 ? std::string(buffer.data()) : std::string();
1147 return error::kNoError; 1147 return error::kNoError;
1148 } 1148 }
1149 1149
1150 error::Error GLES2DecoderPassthroughImpl::DoGetShaderPrecisionFormat( 1150 error::Error GLES2DecoderPassthroughImpl::DoGetShaderPrecisionFormat(
1151 GLenum shadertype, 1151 GLenum shadertype,
1152 GLenum precisiontype, 1152 GLenum precisiontype,
1153 GLint* range, 1153 GLint* range,
1154 GLint* precision, 1154 GLint* precision,
1155 int32_t* success) { 1155 int32_t* success) {
1156 FlushErrors(); 1156 FlushErrors();
(...skipping 2165 matching lines...) Expand 10 before | Expand all | Expand 10 after
3322 GLuint texture, 3322 GLuint texture,
3323 GLboolean promotion_hint, 3323 GLboolean promotion_hint,
3324 GLint display_x, 3324 GLint display_x,
3325 GLint display_y) { 3325 GLint display_y) {
3326 NOTIMPLEMENTED(); 3326 NOTIMPLEMENTED();
3327 return error::kNoError; 3327 return error::kNoError;
3328 } 3328 }
3329 3329
3330 } // namespace gles2 3330 } // namespace gles2
3331 } // namespace gpu 3331 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698