Skip to content

Commit ca7ced3

Browse files
committed
Cleanup GraphicsEnv::setAngleInfo()
Cleanup some minor nits and performance issues in GraphicsEnv::setAngleInfo(): 1. Make the paramater `eglFeatures` a reference. * This avoids the copy of the std::vector that's currently done every function call. 2. Remove `std::move()` calls on `const` values. * std::move() has no effect on const values, resulting in a copy anyway. Bug: 372694741 Test: CQ Change-Id: Id774e8c5aa06b966d04213251c195055e271687b
1 parent 38a4ab9 commit ca7ced3

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

libs/graphicsenv/GraphicsEnv.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ bool GraphicsEnv::shouldUseAngle() {
596596
// If path is set to nonempty and shouldUseNativeDriver is true, ANGLE will be used regardless.
597597
void GraphicsEnv::setAngleInfo(const std::string& path, const bool shouldUseNativeDriver,
598598
const std::string& packageName,
599-
const std::vector<std::string> eglFeatures) {
599+
const std::vector<std::string>& eglFeatures) {
600600
if (mShouldUseAngle) {
601601
// ANGLE is already set up for this application process, even if the application
602602
// needs to switch from apk to system or vice versa, the application process must
@@ -606,11 +606,11 @@ void GraphicsEnv::setAngleInfo(const std::string& path, const bool shouldUseNati
606606
return;
607607
}
608608

609-
mAngleEglFeatures = std::move(eglFeatures);
609+
mAngleEglFeatures = eglFeatures;
610610
ALOGV("setting ANGLE path to '%s'", path.c_str());
611-
mAnglePath = std::move(path);
611+
mAnglePath = path;
612612
ALOGV("setting app package name to '%s'", packageName.c_str());
613-
mPackageName = std::move(packageName);
613+
mPackageName = packageName;
614614
if (mAnglePath == "system") {
615615
mShouldUseSystemAngle = true;
616616
}

libs/graphicsenv/include/graphicsenv/GraphicsEnv.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class GraphicsEnv {
114114
// If shouldUseNativeDriver is true, it means native GLES drivers must be used for the process.
115115
// If path is set to nonempty and shouldUseNativeDriver is true, ANGLE will be used regardless.
116116
void setAngleInfo(const std::string& path, const bool shouldUseNativeDriver,
117-
const std::string& packageName, const std::vector<std::string> eglFeatures);
117+
const std::string& packageName, const std::vector<std::string>& eglFeatures);
118118
// Get the ANGLE driver namespace.
119119
android_namespace_t* getAngleNamespace();
120120
// Get the app package name.

0 commit comments

Comments
 (0)