Rename SkTArray::reserve to reserve_back.

The semantics of `vector::reserve` and `SkTArray::reserve` were not the
same. SkTArray::reserve takes a delta over the current array size,
whereas vector takes a total array size. This could lead to subtle
errors with over- or under-reservation, hurting performance.

This CL renames `SkTArray::reserve` to `SkTArray::reserve_back` to give
the SkTArray behavior a distinct (hopefully easily understandable) name,
leaving its functionality as-is.

Change-Id: Icbd3114bb317fd5f307f393c02ae6fb6f83764e9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/326956
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
diff --git a/bench/CreateBackendTextureBench.cpp b/bench/CreateBackendTextureBench.cpp
index 089f94f..0f26d4b 100644
--- a/bench/CreateBackendTextureBench.cpp
+++ b/bench/CreateBackendTextureBench.cpp
@@ -28,7 +28,7 @@
     void onDraw(int loops, SkCanvas* canvas) override {
         auto context = canvas->recordingContext()->asDirectContext();
 
-        fBackendTextures.reserve(loops);
+        fBackendTextures.reserve_back(loops);
 
         static const int kSize = 16;
         for (int i = 0; i < loops; ++i) {
diff --git a/bench/SKPBench.cpp b/bench/SKPBench.cpp
index bcf2bbf..9ed18e2 100644
--- a/bench/SKPBench.cpp
+++ b/bench/SKPBench.cpp
@@ -57,7 +57,7 @@
     int xTiles = SkScalarCeilToInt(bounds.width()  / SkIntToScalar(tileW));
     int yTiles = SkScalarCeilToInt(bounds.height() / SkIntToScalar(tileH));
 
-    fSurfaces.reserve(xTiles * yTiles);
+    fSurfaces.reserve_back(xTiles * yTiles);
     fTileRects.setReserve(xTiles * yTiles);
 
     SkImageInfo ii = canvas->imageInfo().makeWH(tileW, tileH);
diff --git a/include/private/SkTArray.h b/include/private/SkTArray.h
index 04bec8d..d8e43cb 100644
--- a/include/private/SkTArray.h
+++ b/include/private/SkTArray.h
@@ -162,9 +162,9 @@
     /**
      * Ensures there is enough reserved space for n additional elements. The is guaranteed at least
      * until the array size grows above n and subsequently shrinks below n, any version of reset()
-     * is called, or reserve() is called again.
+     * is called, or reserve_back() is called again.
      */
-    void reserve(int n) {
+    void reserve_back(int n) {
         SkASSERT(n >= 0);
         if (n > 0) {
             this->checkRealloc(n);
diff --git a/modules/skparagraph/src/ParagraphImpl.cpp b/modules/skparagraph/src/ParagraphImpl.cpp
index 8aab519..4f4b784 100644
--- a/modules/skparagraph/src/ParagraphImpl.cpp
+++ b/modules/skparagraph/src/ParagraphImpl.cpp
@@ -308,7 +308,7 @@
             fCodeUnitProperties[run.textRange().start] |= CodeUnitFlags::kSoftLineBreakBefore;
             fCodeUnitProperties[run.textRange().end] |= CodeUnitFlags::kSoftLineBreakBefore;
         } else {
-            fClusters.reserve(fClusters.size() + run.size());
+            fClusters.reserve_back(fClusters.size() + run.size());
             // Walk through the glyph in the direction of input text
             run.iterateThroughClustersInTextOrder([runIndex, this](size_t glyphStart,
                                                                    size_t glyphEnd,
diff --git a/samplecode/SampleImageFilterDAG.cpp b/samplecode/SampleImageFilterDAG.cpp
index 764b28b..6e68232 100644
--- a/samplecode/SampleImageFilterDAG.cpp
+++ b/samplecode/SampleImageFilterDAG.cpp
@@ -70,7 +70,7 @@
         this->computeInputBounds();
         this->computeOutputBounds();
         if (fFilter) {
-            fInputNodes.reserve(fFilter->countInputs());
+            fInputNodes.reserve_back(fFilter->countInputs());
             for (int i = 0; i < fFilter->countInputs(); ++i) {
                 fInputNodes.emplace_back(fFilter->getInput(i), mapping, content, depth + 1);
             }
diff --git a/src/core/SkPictureData.cpp b/src/core/SkPictureData.cpp
index a9eb082..2b57ba4 100644
--- a/src/core/SkPictureData.cpp
+++ b/src/core/SkPictureData.cpp
@@ -327,7 +327,7 @@
         } break;
         case SK_PICT_PICTURE_TAG: {
             SkASSERT(fPictures.empty());
-            fPictures.reserve(SkToInt(size));
+            fPictures.reserve_back(SkToInt(size));
 
             for (uint32_t i = 0; i < size; i++) {
                 auto pic = SkPicture::MakeFromStream(stream, &procs, topLevelTFPlayback);
diff --git a/src/core/SkTTopoSort.h b/src/core/SkTTopoSort.h
index bc1b07e..1b3fb1e 100644
--- a/src/core/SkTTopoSort.h
+++ b/src/core/SkTTopoSort.h
@@ -86,7 +86,7 @@
     SkTTopoSort_CheckAllUnmarked<T, Traits>(*graph);
 #endif
 
-    result.reserve(graph->count());
+    result.reserve_back(graph->count());
 
     for (int i = 0; i < graph->count(); ++i) {
         if (Traits::WasOutput((*graph)[i].get())) {
diff --git a/src/gpu/ccpr/GrCCStrokeGeometry.cpp b/src/gpu/ccpr/GrCCStrokeGeometry.cpp
index 2fbd595..2953799 100644
--- a/src/gpu/ccpr/GrCCStrokeGeometry.cpp
+++ b/src/gpu/ccpr/GrCCStrokeGeometry.cpp
@@ -572,12 +572,12 @@
 
     // Reserve the space first, since push_back() takes the point by reference and might
     // invalidate the reference if the array grows.
-    fPoints.reserve(fPoints.count() + 1);
+    fPoints.reserve_back(fPoints.count() + 1);
     fPoints.push_back(fPoints[fCurrContourFirstPtIdx]);
 
     // Reserve the space first, since push_back() takes the normal by reference and might
     // invalidate the reference if the array grows. (Although in this case we should be fine
     // since there is a negate operator.)
-    fNormals.reserve(fNormals.count() + 1);
+    fNormals.reserve_back(fNormals.count() + 1);
     fNormals.push_back(-fNormals[fCurrContourFirstNormalIdx]);
 }
diff --git a/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp b/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp
index e72ffdd..159230a 100644
--- a/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp
+++ b/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp
@@ -246,7 +246,7 @@
 
     // Move the per-opsTask paths that are about to be flushed from fPendingPaths to fFlushingPaths,
     // and count them up so we can preallocate buffers.
-    fFlushingPaths.reserve(numOpsTaskIDs);
+    fFlushingPaths.reserve_back(numOpsTaskIDs);
     for (int i = 0; i < numOpsTaskIDs; ++i) {
         auto iter = fPendingPaths.find(opsTaskIDs[i]);
         if (fPendingPaths.end() == iter) {
diff --git a/src/gpu/gradients/GrGradientShader.cpp b/src/gpu/gradients/GrGradientShader.cpp
index 7f3695e..228e735 100644
--- a/src/gpu/gradients/GrGradientShader.cpp
+++ b/src/gpu/gradients/GrGradientShader.cpp
@@ -185,7 +185,7 @@
     if (shader.fOrigPos) {
         positions = shader.fOrigPos;
     } else {
-        implicitPos.reserve(shader.fColorCount);
+        implicitPos.reserve_back(shader.fColorCount);
         SkScalar posScale = SK_Scalar1 / (shader.fColorCount - 1);
         for (int i = 0 ; i < shader.fColorCount; i++) {
             implicitPos.push_back(SkIntToScalar(i) * posScale);
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp
index 2d8b271..e1409d6 100644
--- a/src/gpu/vk/GrVkGpu.cpp
+++ b/src/gpu/vk/GrVkGpu.cpp
@@ -738,8 +738,8 @@
         numMipLevels = SkMipmap::ComputeLevelCount(dimensions.width(), dimensions.height()) + 1;
     }
 
-    regions->reserve(numMipLevels);
-    individualMipOffsets->reserve(numMipLevels);
+    regions->reserve_back(numMipLevels);
+    individualMipOffsets->reserve_back(numMipLevels);
 
     size_t bytesPerBlock = GrVkFormatBytesPerBlock(vkFormat);
 
diff --git a/src/pdf/SkPDFMakeCIDGlyphWidthsArray.cpp b/src/pdf/SkPDFMakeCIDGlyphWidthsArray.cpp
index 8d0e745..84d47de 100644
--- a/src/pdf/SkPDFMakeCIDGlyphWidthsArray.cpp
+++ b/src/pdf/SkPDFMakeCIDGlyphWidthsArray.cpp
@@ -115,7 +115,7 @@
 
 #if defined(SK_PDF_CAN_USE_DW)
     std::vector<int16_t> advances;
-    advances.reserve(glyphs.size());
+    advances.reserve_back(glyphs.size());
     for (const SkGlyph* glyph : glyphs) {
         advances.push_back((int16_t)glyph->advanceX());
     }
diff --git a/src/sksl/SkSLCompiler.cpp b/src/sksl/SkSLCompiler.cpp
index 528ce07..9784f83 100644
--- a/src/sksl/SkSLCompiler.cpp
+++ b/src/sksl/SkSLCompiler.cpp
@@ -1180,7 +1180,7 @@
             Block& block = static_cast<Block&>(*stmt);
 
             StatementArray blockStmts;
-            blockStmts.reserve(block.children().size());
+            blockStmts.reserve_back(block.children().size());
             for (std::unique_ptr<Statement>& stmt : block.children()) {
                 move_all_but_break(stmt, &blockStmts);
             }
diff --git a/src/sksl/SkSLIRGenerator.cpp b/src/sksl/SkSLIRGenerator.cpp
index 239f32b..8a5d42d 100644
--- a/src/sksl/SkSLIRGenerator.cpp
+++ b/src/sksl/SkSLIRGenerator.cpp
@@ -209,7 +209,7 @@
                     FunctionCall& fc = expr.as<FunctionCall>();
                     if (fc.function().isBuiltin() && fc.function().name() == "EmitVertex") {
                         StatementArray statements;
-                        statements.reserve(2);
+                        statements.reserve_back(2);
                         statements.push_back(getNormalizeSkPositionCode());
                         statements.push_back(std::move(result));
                         return std::make_unique<Block>(statement.fOffset, std::move(statements),
@@ -378,7 +378,7 @@
         const ASTNode::VarData& varData = varDecl.getVarData();
         const Type* type = baseType;
         ExpressionArray sizes;
-        sizes.reserve(varData.fSizeCount);
+        sizes.reserve_back(varData.fSizeCount);
         auto iter = varDecl.begin();
         for (size_t i = 0; i < varData.fSizeCount; ++i, ++iter) {
             const ASTNode& rawSize = *iter;
@@ -746,7 +746,7 @@
     SkASSERT(endPrimitive);
 
     StatementArray loopBody;
-    loopBody.reserve(2);
+    loopBody.reserve_back(2);
     loopBody.push_back(std::make_unique<ExpressionStatement>(this->call(
                                                     /*offset=*/-1, *invokeDecl,
                                                     ExpressionArray{})));
@@ -798,7 +798,7 @@
                                    new BinaryExpression(-1, left, op, right, \
                                                         fContext.fFloat2_Type.get()))
     ExpressionArray children;
-    children.reserve(3);
+    children.reserve_back(3);
     children.push_back(OP(OP(SWIZZLE(POS, 0, 1), Token::Kind::TK_STAR, SWIZZLE(ADJUST, 0, 2)),
                           Token::Kind::TK_PLUS,
                           OP(SWIZZLE(POS, 3, 3), Token::Kind::TK_STAR, SWIZZLE(ADJUST, 1, 3))));
@@ -1120,7 +1120,7 @@
     const Type* type =
             old->takeOwnershipOfSymbol(std::make_unique<Type>(intf.fOffset, id.fTypeName, fields));
     ExpressionArray sizes;
-    sizes.reserve(id.fSizeCount);
+    sizes.reserve_back(id.fSizeCount);
     for (size_t i = 0; i < id.fSizeCount; ++i) {
         const ASTNode& size = *(iter++);
         if (size) {
@@ -2558,7 +2558,7 @@
     // contiguously. The benefits are minor, so skip the optimization to keep the algorithm simple.
     // The constructor will have at most three arguments: { base value, constant 0, constant 1 }
     ExpressionArray constructorArgs;
-    constructorArgs.reserve(3);
+    constructorArgs.reserve_back(3);
     constructorArgs.push_back(std::move(expr));
 
     // Apply another swizzle to shuffle the constants into the correct place. Any constant values we
diff --git a/src/sksl/SkSLInliner.cpp b/src/sksl/SkSLInliner.cpp
index bbb6ee0..f0ef4d5 100644
--- a/src/sksl/SkSLInliner.cpp
+++ b/src/sksl/SkSLInliner.cpp
@@ -344,7 +344,7 @@
     };
     auto argList = [&](const ExpressionArray& originalArgs) -> ExpressionArray {
         ExpressionArray args;
-        args.reserve(originalArgs.size());
+        args.reserve_back(originalArgs.size());
         for (const std::unique_ptr<Expression>& arg : originalArgs) {
             args.push_back(expr(arg));
         }
@@ -444,7 +444,7 @@
     };
     auto blockStmts = [&](const Block& block) {
         StatementArray result;
-        result.reserve(block.children().size());
+        result.reserve_back(block.children().size());
         for (const std::unique_ptr<Statement>& child : block.children()) {
             result.push_back(stmt(child));
         }
@@ -452,7 +452,7 @@
     };
     auto stmts = [&](const StatementArray& ss) {
         StatementArray result;
-        result.reserve(ss.size());
+        result.reserve_back(ss.size());
         for (const auto& s : ss) {
             result.push_back(stmt(s));
         }
@@ -513,7 +513,7 @@
                                 &resultExpr->type()));
                 if (haveEarlyReturns) {
                     StatementArray block;
-                    block.reserve(2);
+                    block.reserve_back(2);
                     block.push_back(std::move(assignment));
                     block.push_back(std::make_unique<BreakStatement>(offset));
                     return std::make_unique<Block>(offset, std::move(block), /*symbols=*/nullptr,
@@ -543,7 +543,7 @@
         case Statement::Kind::kVarDeclaration: {
             const VarDeclaration& decl = statement.as<VarDeclaration>();
             ExpressionArray sizes;
-            sizes.reserve(decl.sizeCount());
+            sizes.reserve_back(decl.sizeCount());
             for (int i = 0; i < decl.sizeCount(); ++i) {
                 sizes.push_back(expr(decl.size(i)));
             }
@@ -607,7 +607,7 @@
                                                        /*isScope=*/false);
 
     Block& inlinedBody = *inlinedCall.fInlinedBody;
-    inlinedBody.children().reserve(1 +                // Inline marker
+    inlinedBody.children().reserve_back(1 +                // Inline marker
                                    1 +                // Result variable
                                    arguments.size() + // Function arguments (passing in)
                                    arguments.size() + // Function arguments (copy out-params back)
@@ -695,7 +695,7 @@
 
     const Block& body = function.body()->as<Block>();
     auto inlineBlock = std::make_unique<Block>(offset, StatementArray{});
-    inlineBlock->children().reserve(body.children().size());
+    inlineBlock->children().reserve_back(body.children().size());
     for (const std::unique_ptr<Statement>& stmt : body.children()) {
         inlineBlock->children().push_back(this->inlineStatement(offset, &varMap, symbolTableForCall,
                                                                 resultExpr.get(), hasEarlyReturn,
diff --git a/src/sksl/SkSLRehydrator.cpp b/src/sksl/SkSLRehydrator.cpp
index fd5453f..d296dee 100644
--- a/src/sksl/SkSLRehydrator.cpp
+++ b/src/sksl/SkSLRehydrator.cpp
@@ -312,7 +312,7 @@
             StringFragment instanceName = this->readString();
             uint8_t sizeCount = this->readU8();
             ExpressionArray sizes;
-            sizes.reserve(sizeCount);
+            sizes.reserve_back(sizeCount);
             for (int i = 0; i < sizeCount; ++i) {
                 sizes.push_back(this->expression());
             }
@@ -338,7 +338,7 @@
             AutoRehydratorSymbolTable symbols(this);
             int count = this->readU8();
             StatementArray statements;
-            statements.reserve(count);
+            statements.reserve_back(count);
             for (int i = 0; i < count; ++i) {
                 statements.push_back(this->statement());
             }
@@ -406,7 +406,7 @@
                 std::unique_ptr<Expression> value = this->expression();
                 int statementCount = this->readU8();
                 StatementArray statements;
-                statements.reserve(statementCount);
+                statements.reserve_back(statementCount);
                 for (int j = 0; j < statementCount; ++j) {
                     statements.push_back(this->statement());
                 }
@@ -421,7 +421,7 @@
             const Type* baseType = this->type();
             uint8_t sizeCount = this->readU8();
             ExpressionArray sizes;
-            sizes.reserve(sizeCount);
+            sizes.reserve_back(sizeCount);
             for (int i = 0; i < sizeCount; ++i) {
                 sizes.push_back(this->expression());
             }
@@ -466,7 +466,7 @@
             const Type* type = this->type();
             uint8_t argCount = this->readU8();
             ExpressionArray args;
-            args.reserve(argCount);
+            args.reserve_back(argCount);
             for (int i = 0; i < argCount; ++i) {
                 args.push_back(this->expression());
             }
@@ -489,7 +489,7 @@
                                                                 Symbol::Kind::kFunctionDeclaration);
             uint8_t argCount = this->readU8();
             ExpressionArray args;
-            args.reserve(argCount);
+            args.reserve_back(argCount);
             for (int i = 0; i < argCount; ++i) {
                 args.push_back(this->expression());
             }
diff --git a/src/sksl/SkSLSPIRVCodeGenerator.cpp b/src/sksl/SkSLSPIRVCodeGenerator.cpp
index 27b2833..8a0f2e8 100644
--- a/src/sksl/SkSLSPIRVCodeGenerator.cpp
+++ b/src/sksl/SkSLSPIRVCodeGenerator.cpp
@@ -856,7 +856,7 @@
         case kSubpassLoad_SpecialIntrinsic: {
             SpvId img = this->writeExpression(*arguments[0], out);
             ExpressionArray args;
-            args.reserve(2);
+            args.reserve_back(2);
             args.push_back(std::make_unique<IntLiteral>(fContext, /*offset=*/-1, /*value=*/0));
             args.push_back(std::make_unique<IntLiteral>(fContext, /*offset=*/-1, /*value=*/0));
             Constructor ctor(-1, fContext.fInt2_Type.get(), std::move(args));
@@ -1005,7 +1005,7 @@
         case kSaturate_SpecialIntrinsic: {
             SkASSERT(arguments.size() == 1);
             ExpressionArray finalArgs;
-            finalArgs.reserve(3);
+            finalArgs.reserve_back(3);
             finalArgs.push_back(arguments[0]->clone());
             finalArgs.push_back(std::make_unique<FloatLiteral>(fContext, /*offset=*/-1,
                                                                /*value=*/0));
diff --git a/src/sksl/ir/SkSLBinaryExpression.h b/src/sksl/ir/SkSLBinaryExpression.h
index 8eedeca..f5dfa06 100644
--- a/src/sksl/ir/SkSLBinaryExpression.h
+++ b/src/sksl/ir/SkSLBinaryExpression.h
@@ -53,7 +53,7 @@
     BinaryExpression(int offset, std::unique_ptr<Expression> left, Token::Kind op,
                      std::unique_ptr<Expression> right, const Type* type)
     : INHERITED(offset, kExpressionKind, TypeTokenData{type, op}) {
-        fExpressionChildren.reserve(2);
+        fExpressionChildren.reserve_back(2);
         fExpressionChildren.push_back(std::move(left));
         fExpressionChildren.push_back(std::move(right));
         // If we are assigning to a VariableReference, ensure that it is set to Write or ReadWrite
diff --git a/src/sksl/ir/SkSLBlock.h b/src/sksl/ir/SkSLBlock.h
index a8b745a..9312396 100644
--- a/src/sksl/ir/SkSLBlock.h
+++ b/src/sksl/ir/SkSLBlock.h
@@ -56,7 +56,7 @@
 
     std::unique_ptr<Statement> clone() const override {
         StatementArray cloned;
-        cloned.reserve(this->children().size());
+        cloned.reserve_back(this->children().size());
         for (const std::unique_ptr<Statement>& stmt : this->children()) {
             cloned.push_back(stmt->clone());
         }
diff --git a/src/sksl/ir/SkSLConstructor.h b/src/sksl/ir/SkSLConstructor.h
index 6ec4e1f..818d4f0 100644
--- a/src/sksl/ir/SkSLConstructor.h
+++ b/src/sksl/ir/SkSLConstructor.h
@@ -57,7 +57,7 @@
 
     std::unique_ptr<Expression> clone() const override {
         ExpressionArray cloned;
-        cloned.reserve(this->arguments().size());
+        cloned.reserve_back(this->arguments().size());
         for (const std::unique_ptr<Expression>& arg: this->arguments()) {
             cloned.push_back(arg->clone());
         }
diff --git a/src/sksl/ir/SkSLExternalFunctionCall.h b/src/sksl/ir/SkSLExternalFunctionCall.h
index ab2161b..b38389d 100644
--- a/src/sksl/ir/SkSLExternalFunctionCall.h
+++ b/src/sksl/ir/SkSLExternalFunctionCall.h
@@ -57,7 +57,7 @@
 
     std::unique_ptr<Expression> clone() const override {
         ExpressionArray cloned;
-        cloned.reserve(this->arguments().size());
+        cloned.reserve_back(this->arguments().size());
         for (const auto& arg : this->arguments()) {
             cloned.push_back(arg->clone());
         }
diff --git a/src/sksl/ir/SkSLForStatement.h b/src/sksl/ir/SkSLForStatement.h
index 805c196..d12a9f5 100644
--- a/src/sksl/ir/SkSLForStatement.h
+++ b/src/sksl/ir/SkSLForStatement.h
@@ -25,10 +25,10 @@
                  std::unique_ptr<Expression> test, std::unique_ptr<Expression> next,
                  std::unique_ptr<Statement> statement, std::shared_ptr<SymbolTable> symbols)
     : INHERITED(offset, ForStatementData{std::move(symbols)}) {
-        fStatementChildren.reserve(2);
+        fStatementChildren.reserve_back(2);
         fStatementChildren.push_back(std::move(initializer));
         fStatementChildren.push_back(std::move(statement));
-        fExpressionChildren.reserve(2);
+        fExpressionChildren.reserve_back(2);
         fExpressionChildren.push_back(std::move(test));
         fExpressionChildren.push_back(std::move(next));
     }
diff --git a/src/sksl/ir/SkSLFunctionCall.h b/src/sksl/ir/SkSLFunctionCall.h
index 004182a..bf1237d 100644
--- a/src/sksl/ir/SkSLFunctionCall.h
+++ b/src/sksl/ir/SkSLFunctionCall.h
@@ -63,7 +63,7 @@
 
     std::unique_ptr<Expression> clone() const override {
         ExpressionArray cloned;
-        cloned.reserve(this->arguments().size());
+        cloned.reserve_back(this->arguments().size());
         for (const auto& arg : this->arguments()) {
             cloned.push_back(arg->clone());
         }
diff --git a/src/sksl/ir/SkSLFunctionDeclaration.h b/src/sksl/ir/SkSLFunctionDeclaration.h
index 6739fd1..a9b57c5 100644
--- a/src/sksl/ir/SkSLFunctionDeclaration.h
+++ b/src/sksl/ir/SkSLFunctionDeclaration.h
@@ -118,7 +118,7 @@
         const std::vector<const Variable*>& parameters = this->parameters();
         SkASSERT(arguments.size() == parameters.size());
 
-        outParameterTypes->reserve(arguments.size());
+        outParameterTypes->reserve_back(arguments.size());
         int genericIndex = -1;
         for (size_t i = 0; i < arguments.size(); i++) {
             const Type& parameterType = parameters[i]->type();
diff --git a/src/sksl/ir/SkSLIfStatement.h b/src/sksl/ir/SkSLIfStatement.h
index 3c0258e..1bc03c1 100644
--- a/src/sksl/ir/SkSLIfStatement.h
+++ b/src/sksl/ir/SkSLIfStatement.h
@@ -23,7 +23,7 @@
                 std::unique_ptr<Statement> ifTrue, std::unique_ptr<Statement> ifFalse)
     : INHERITED(offset, IfStatementData{isStatic}) {
         fExpressionChildren.push_back(std::move(test));
-        fStatementChildren.reserve(2);
+        fStatementChildren.reserve_back(2);
         fStatementChildren.push_back(std::move(ifTrue));
         fStatementChildren.push_back(std::move(ifFalse));
     }
diff --git a/src/sksl/ir/SkSLIndexExpression.h b/src/sksl/ir/SkSLIndexExpression.h
index b19e11c..2268b4f 100644
--- a/src/sksl/ir/SkSLIndexExpression.h
+++ b/src/sksl/ir/SkSLIndexExpression.h
@@ -48,7 +48,7 @@
                     std::unique_ptr<Expression> index)
     : INHERITED(base->fOffset, kExpressionKind, &index_type(context, base->type())) {
         SkASSERT(index->type() == *context.fInt_Type || index->type() == *context.fUInt_Type);
-        fExpressionChildren.reserve(2);
+        fExpressionChildren.reserve_back(2);
         fExpressionChildren.push_back(std::move(base));
         fExpressionChildren.push_back(std::move(index));
     }
@@ -89,7 +89,7 @@
     IndexExpression(std::unique_ptr<Expression> base, std::unique_ptr<Expression> index,
                     const Type* type)
     : INHERITED(base->fOffset, Kind::kIndex, type) {
-        fExpressionChildren.reserve(2);
+        fExpressionChildren.reserve_back(2);
         fExpressionChildren.push_back(std::move(base));
         fExpressionChildren.push_back(std::move(index));
     }
diff --git a/src/sksl/ir/SkSLInterfaceBlock.h b/src/sksl/ir/SkSLInterfaceBlock.h
index fd7b0de..425057a 100644
--- a/src/sksl/ir/SkSLInterfaceBlock.h
+++ b/src/sksl/ir/SkSLInterfaceBlock.h
@@ -38,7 +38,7 @@
 
     std::unique_ptr<ProgramElement> clone() const override {
         ExpressionArray sizesClone;
-        sizesClone.reserve(fSizes.size());
+        sizesClone.reserve_back(fSizes.size());
         for (const auto& s : fSizes) {
             sizesClone.push_back(s ? s->clone() : nullptr);
         }
diff --git a/src/sksl/ir/SkSLSwitchCase.h b/src/sksl/ir/SkSLSwitchCase.h
index 8b63b17..7a1022e 100644
--- a/src/sksl/ir/SkSLSwitchCase.h
+++ b/src/sksl/ir/SkSLSwitchCase.h
@@ -26,7 +26,7 @@
 
     std::unique_ptr<Statement> clone() const override {
         StatementArray cloned;
-        cloned.reserve(fStatements.size());
+        cloned.reserve_back(fStatements.size());
         for (const auto& s : fStatements) {
             cloned.push_back(s->clone());
         }
diff --git a/src/sksl/ir/SkSLTernaryExpression.h b/src/sksl/ir/SkSLTernaryExpression.h
index c5aef10..258b29a 100644
--- a/src/sksl/ir/SkSLTernaryExpression.h
+++ b/src/sksl/ir/SkSLTernaryExpression.h
@@ -24,7 +24,7 @@
                       std::unique_ptr<Expression> ifTrue, std::unique_ptr<Expression> ifFalse)
     : INHERITED(offset, kExpressionKind, &ifTrue->type()) {
         SkASSERT(ifTrue->type() == ifFalse->type());
-        fExpressionChildren.reserve(3);
+        fExpressionChildren.reserve_back(3);
         fExpressionChildren.push_back(std::move(test));
         fExpressionChildren.push_back(std::move(ifTrue));
         fExpressionChildren.push_back(std::move(ifFalse));
diff --git a/src/sksl/ir/SkSLVarDeclarations.h b/src/sksl/ir/SkSLVarDeclarations.h
index 67f53f9..8cb709f 100644
--- a/src/sksl/ir/SkSLVarDeclarations.h
+++ b/src/sksl/ir/SkSLVarDeclarations.h
@@ -29,7 +29,7 @@
                    ExpressionArray sizes,
                    std::unique_ptr<Expression> value)
             : INHERITED(var->fOffset, VarDeclarationData{baseType, var}) {
-        fExpressionChildren.reserve(sizes.size() + 1);
+        fExpressionChildren.reserve_back(sizes.size() + 1);
         fExpressionChildren.move_back_n(sizes.size(), sizes.data());
         fExpressionChildren.push_back(std::move(value));
     }
@@ -65,7 +65,7 @@
 
     std::unique_ptr<Statement> clone() const override {
         ExpressionArray sizesClone;
-        sizesClone.reserve(this->sizeCount());
+        sizesClone.reserve_back(this->sizeCount());
         for (int i = 0; i < this->sizeCount(); ++i) {
             if (this->size(i)) {
                 sizesClone.push_back(this->size(i)->clone());
diff --git a/tests/TArrayTest.cpp b/tests/TArrayTest.cpp
index cc93b20..30f5446 100644
--- a/tests/TArrayTest.cpp
+++ b/tests/TArrayTest.cpp
@@ -219,18 +219,18 @@
 
         // Test setting reserve after constructor.
         Array array2;
-        array2.reserve(reserveCount);
+        array2.reserve_back(reserveCount);
         test_array_reserve(reporter, &array2, reserveCount);
 
         // Test increasing reserve after constructor.
         Array array3(reserveCount/2);
-        array3.reserve(reserveCount);
+        array3.reserve_back(reserveCount);
         test_array_reserve(reporter, &array3, reserveCount);
 
         // Test setting reserve on non-empty array.
         Array array4;
         array4.push_back_n(reserveCount);
-        array4.reserve(reserveCount);
+        array4.reserve_back(reserveCount);
         array4.pop_back_n(reserveCount);
         test_array_reserve(reporter, &array4, 2 * reserveCount);
     }
diff --git a/tools/ToolUtils.h b/tools/ToolUtils.h
index 0a5ecc6..dcb2bdd 100644
--- a/tools/ToolUtils.h
+++ b/tools/ToolUtils.h
@@ -194,7 +194,7 @@
 
     // Helper functions for TopoSortBench & TopoSortTest
     static void AllocNodes(SkTArray<sk_sp<ToolUtils::TopoTestNode>>* graph, int num) {
-        graph->reserve(num);
+        graph->reserve_back(num);
 
         for (int i = 0; i < num; ++i) {
             graph->push_back(sk_sp<TopoTestNode>(new TopoTestNode(i)));