Bug 1128044 - Use nsTArray since android doesn't support std::vector::data(). - r=bustage
authorJeff Gilbert <jgilbert@mozilla.com>
Wed, 11 Mar 2015 21:02:39 -0700
changeset 251596 acf73f2ea7d905fba22d3be06338757e3fd76dda
parent 251595 4ff9ef3f8f04b335197cf986fca67e820e65933b
child 251597 d4cfb9e9de85aa0cc99a9cc5ac7bc18833bd1cbf
push id7860
push userjlund@mozilla.com
push dateMon, 30 Mar 2015 18:46:02 +0000
treeherdermozilla-aurora@8ac636cd51f3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbustage
bugs1128044
milestone39.0a1
Bug 1128044 - Use nsTArray since android doesn't support std::vector::data(). - r=bustage
dom/canvas/WebGLShaderValidator.cpp
--- a/dom/canvas/WebGLShaderValidator.cpp
+++ b/dom/canvas/WebGLShaderValidator.cpp
@@ -4,16 +4,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "WebGLShaderValidator.h"
 
 #include "angle/ShaderLang.h"
 #include "GLContext.h"
 #include "MurmurHash3.h"
 #include "nsPrintfCString.h"
+#include "nsTArray.h"
 #include <string>
 #include <vector>
 #include "WebGLContext.h"
 
 namespace mozilla {
 namespace webgl {
 
 uint64_t
@@ -215,24 +216,24 @@ ShaderValidator::CanLinkTo(const ShaderV
                 break;
             }
         }
     }
     {
         const std::vector<sh::Varying>& vertList = *ShGetVaryings(prev->mHandle);
         const std::vector<sh::Varying>& fragList = *ShGetVaryings(mHandle);
 
-        std::vector<ShVariableInfo> staticUseVaryingList;
+        nsTArray<ShVariableInfo> staticUseVaryingList;
 
         for (auto itrFrag = fragList.begin(); itrFrag != fragList.end(); ++itrFrag) {
             static const char prefix[] = "gl_";
             if (StartsWith(itrFrag->name, prefix)) {
                 if (itrFrag->staticUse) {
-                    staticUseVaryingList.push_back({itrFrag->type,
-                                                    (int)itrFrag->elementCount()});
+                    staticUseVaryingList.AppendElement({itrFrag->type,
+                                                        (int)itrFrag->elementCount()});
                 }
 
                 continue;
             }
 
             bool definedInVertShader = false;
             bool staticVertUse = false;
 
@@ -257,24 +258,24 @@ ShaderValidator::CanLinkTo(const ShaderV
                 nsPrintfCString error("Varying `%s` has static-use in the frag"
                                       " shader, but is undeclared in the vert"
                                       " shader.", itrFrag->name.c_str());
                 *out_log = error;
                 return false;
             }
 
             if (staticVertUse && itrFrag->staticUse) {
-                staticUseVaryingList.push_back({itrFrag->type,
-                                                (int)itrFrag->elementCount()});
+                staticUseVaryingList.AppendElement({itrFrag->type,
+                                                    (int)itrFrag->elementCount()});
             }
         }
 
         if (!ShCheckVariablesWithinPackingLimits(mMaxVaryingVectors,
-                                                 staticUseVaryingList.data(),
-                                                 staticUseVaryingList.size()))
+                                                 staticUseVaryingList.Elements(),
+                                                 staticUseVaryingList.Length()))
         {
             *out_log = "Statically used varyings do not fit within packing limits. (see"
                        " GLSL ES Specification 1.0.17, p111)";
             return false;
         }
     }
 
     return true;