summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorki.stfu <ki.stfu@gmail.com>2015-09-21 16:40:04 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-21 23:41:10 +0000
commit8100dae5e20fc6d8ca2fec9258277f189c434164 (patch)
treecf87e1cd460b83e29f835393ca3f5acaa565ca38 /gpu
parentdbc8c1869a4fd0493150c008106be720eba86205 (diff)
downloadchromium_src-8100dae5e20fc6d8ca2fec9258277f189c434164.zip
chromium_src-8100dae5e20fc6d8ca2fec9258277f189c434164.tar.gz
chromium_src-8100dae5e20fc6d8ca2fec9258277f189c434164.tar.bz2
Cleanup: Pass std::string as const reference from gpu/
Passing std::string by reference can prevent extra copying of object. BUG=367418 TEST= R=piman@chromium.org,sievers@chromium.org Review URL: https://codereview.chromium.org/1360513002 Cr-Commit-Position: refs/heads/master@{#350063}
Diffstat (limited to 'gpu')
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc18
-rw-r--r--gpu/command_buffer/service/texture_manager_unittest.cc2
-rw-r--r--gpu/config/gpu_blacklist_unittest.cc4
-rw-r--r--gpu/tools/compositor_model_bench/render_tree.cc2
-rw-r--r--gpu/tools/compositor_model_bench/render_tree.h2
-rw-r--r--gpu/tools/compositor_model_bench/shaders.cc2
-rw-r--r--gpu/tools/compositor_model_bench/shaders.h2
7 files changed, 18 insertions, 14 deletions
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 410f1cc..5310f38 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -1054,8 +1054,10 @@ class GLES2DecoderImpl : public GLES2Decoder,
void DoProduceTextureCHROMIUM(GLenum target, const GLbyte* key);
void DoProduceTextureDirectCHROMIUM(GLuint texture, GLenum target,
const GLbyte* key);
- void ProduceTextureRef(std::string func_name, TextureRef* texture_ref,
- GLenum target, const GLbyte* data);
+ void ProduceTextureRef(const char* func_name,
+ TextureRef* texture_ref,
+ GLenum target,
+ const GLbyte* data);
void EnsureTextureForClientId(GLenum target, GLuint client_id);
void DoConsumeTextureCHROMIUM(GLenum target, const GLbyte* key);
@@ -13836,8 +13838,10 @@ void GLES2DecoderImpl::DoProduceTextureDirectCHROMIUM(GLuint client_id,
target, data);
}
-void GLES2DecoderImpl::ProduceTextureRef(std::string func_name,
- TextureRef* texture_ref, GLenum target, const GLbyte* data) {
+void GLES2DecoderImpl::ProduceTextureRef(const char* func_name,
+ TextureRef* texture_ref,
+ GLenum target,
+ const GLbyte* data) {
const Mailbox& mailbox = *reinterpret_cast<const Mailbox*>(data);
DLOG_IF(ERROR, !mailbox.Verify()) << func_name << " was passed a "
"mailbox that was not generated by "
@@ -13845,20 +13849,20 @@ void GLES2DecoderImpl::ProduceTextureRef(std::string func_name,
if (!texture_ref) {
LOCAL_SET_GL_ERROR(
- GL_INVALID_OPERATION, func_name.c_str(), "unknown texture for target");
+ GL_INVALID_OPERATION, func_name, "unknown texture for target");
return;
}
Texture* produced = texture_manager()->Produce(texture_ref);
if (!produced) {
LOCAL_SET_GL_ERROR(
- GL_INVALID_OPERATION, func_name.c_str(), "invalid texture");
+ GL_INVALID_OPERATION, func_name, "invalid texture");
return;
}
if (produced->target() != target) {
LOCAL_SET_GL_ERROR(
- GL_INVALID_OPERATION, func_name.c_str(), "invalid target");
+ GL_INVALID_OPERATION, func_name, "invalid target");
return;
}
diff --git a/gpu/command_buffer/service/texture_manager_unittest.cc b/gpu/command_buffer/service/texture_manager_unittest.cc
index fc527c0..838fa52 100644
--- a/gpu/command_buffer/service/texture_manager_unittest.cc
+++ b/gpu/command_buffer/service/texture_manager_unittest.cc
@@ -481,7 +481,7 @@ class TextureTestBase : public GpuServiceTest {
~TextureTestBase() override { texture_ref_ = NULL; }
protected:
- void SetUpBase(MemoryTracker* memory_tracker, std::string extensions) {
+ void SetUpBase(MemoryTracker* memory_tracker, const std::string& extensions) {
GpuServiceTest::SetUp();
if (!extensions.empty()) {
TestHelper::SetupFeatureInfoInitExpectations(gl_.get(),
diff --git a/gpu/config/gpu_blacklist_unittest.cc b/gpu/config/gpu_blacklist_unittest.cc
index 1a3deb6..1c7211e 100644
--- a/gpu/config/gpu_blacklist_unittest.cc
+++ b/gpu/config/gpu_blacklist_unittest.cc
@@ -23,8 +23,8 @@ class GpuBlacklistTest : public testing::Test {
return gpu_info_;
}
- void RunFeatureTest(
- const std::string feature_name, GpuFeatureType feature_type) {
+ void RunFeatureTest(const std::string& feature_name,
+ GpuFeatureType feature_type) {
const std::string json =
"{\n"
" \"name\": \"gpu blacklist\",\n"
diff --git a/gpu/tools/compositor_model_bench/render_tree.cc b/gpu/tools/compositor_model_bench/render_tree.cc
index f2369df..e1a3804 100644
--- a/gpu/tools/compositor_model_bench/render_tree.cc
+++ b/gpu/tools/compositor_model_bench/render_tree.cc
@@ -23,7 +23,7 @@ using base::ReadFileToString;
using std::string;
using std::vector;
-GLenum TextureFormatFromString(std::string format) {
+GLenum TextureFormatFromString(const std::string& format) {
if (format == "RGBA")
return GL_RGBA;
if (format == "RGB")
diff --git a/gpu/tools/compositor_model_bench/render_tree.h b/gpu/tools/compositor_model_bench/render_tree.h
index 6b43fbe..5a460bc 100644
--- a/gpu/tools/compositor_model_bench/render_tree.h
+++ b/gpu/tools/compositor_model_bench/render_tree.h
@@ -35,7 +35,7 @@ struct Texture {
GLenum format;
};
-GLenum TextureFormatFromString(std::string format);
+GLenum TextureFormatFromString(const std::string& format);
const char* TextureFormatName(GLenum format);
int FormatBytesPerPixel(GLenum format);
diff --git a/gpu/tools/compositor_model_bench/shaders.cc b/gpu/tools/compositor_model_bench/shaders.cc
index 5559e73..66f5aac 100644
--- a/gpu/tools/compositor_model_bench/shaders.cc
+++ b/gpu/tools/compositor_model_bench/shaders.cc
@@ -81,7 +81,7 @@ static void TranslateInPlace(float* m, float tx, float ty, float tz) {
///////////////////////////////////////////////////////////////////////////////
-ShaderID ShaderIDFromString(std::string name) {
+ShaderID ShaderIDFromString(const std::string& name) {
if (name == "VertexShaderPosTexYUVStretch")
return VERTEX_SHADER_POS_TEX_YUV_STRETCH;
if (name == "VertexShaderPosTex")
diff --git a/gpu/tools/compositor_model_bench/shaders.h b/gpu/tools/compositor_model_bench/shaders.h
index 4594035..5aece20 100644
--- a/gpu/tools/compositor_model_bench/shaders.h
+++ b/gpu/tools/compositor_model_bench/shaders.h
@@ -26,7 +26,7 @@ enum ShaderID {
SHADER_ID_MAX
};
-ShaderID ShaderIDFromString(std::string name);
+ShaderID ShaderIDFromString(const std::string& name);
std::string ShaderNameFromID(ShaderID id);
void ConfigAndActivateShaderForNode(CCNode* n);