Bug 1557791 - Rename initializeUncompressedSource so that it's clear it's only used for unretrievable source. r=arai
authorJeff Walden <jwalden@mit.edu>
Thu, 06 Jun 2019 18:33:47 -0700
changeset 478272 313c2c5ec162acb3a1a3d9f4a79a6a9b84ed46ac
parent 478271 20b8bd4bcb727de80bac55efeeadbcbfa12b9de2
child 478273 b8ab088338aa3d323403213b5f5bfe4eaaaf83bd
push id5
push uservporof@mozilla.com
push dateWed, 12 Jun 2019 10:24:37 +0000
reviewersarai
bugs1557791
milestone69.0a1
Bug 1557791 - Rename initializeUncompressedSource so that it's clear it's only used for unretrievable source. r=arai Differential Revision: https://phabricator.services.mozilla.com/D34204
js/src/vm/JSScript.cpp
js/src/vm/JSScript.h
--- a/js/src/vm/JSScript.cpp
+++ b/js/src/vm/JSScript.cpp
@@ -2534,17 +2534,17 @@ bool ScriptSource::xdrFinalizeEncoder(JS
 
   auto cleanup = mozilla::MakeScopeExit([&] { xdrEncoder_.reset(nullptr); });
 
   XDRResult res = xdrEncoder_->linearize(buffer);
   return res.isOk();
 }
 
 template <typename Unit>
-MOZ_MUST_USE bool ScriptSource::initializeUncompressedSource(
+MOZ_MUST_USE bool ScriptSource::initializeUnretrievableUncompressedSource(
     JSContext* cx, EntryUnits<Unit>&& source, size_t length) {
   MOZ_ASSERT(data.is<Missing>(), "must be initializing a fresh ScriptSource");
   return setUncompressedSourceHelper(cx, std::move(source), length);
 }
 
 template <typename Unit>
 struct UnretrievableSourceDecoder {
   XDRState<XDR_DECODE>* const xdr_;
@@ -2563,17 +2563,17 @@ struct UnretrievableSourceDecoder {
     auto sourceUnits =
         xdr_->cx()->make_pod_array<Unit>(Max<size_t>(uncompressedLength_, 1));
     if (!sourceUnits) {
       return xdr_->fail(JS::TranscodeResult_Throw);
     }
 
     MOZ_TRY(xdr_->codeChars(sourceUnits.get(), uncompressedLength_));
 
-    if (!scriptSource_->initializeUncompressedSource(
+    if (!scriptSource_->initializeUnretrievableUncompressedSource(
             xdr_->cx(), std::move(sourceUnits), uncompressedLength_)) {
       return xdr_->fail(JS::TranscodeResult_Throw);
     }
 
     return Ok();
   }
 };
 
--- a/js/src/vm/JSScript.h
+++ b/js/src/vm/JSScript.h
@@ -980,21 +980,20 @@ class ScriptSource {
   // double-check their own understandings of the |data| state transition being
   // performed.
   template <typename Unit>
   MOZ_MUST_USE bool setUncompressedSourceHelper(JSContext* cx,
                                                 EntryUnits<Unit>&& source,
                                                 size_t length);
 
  public:
-  // Initialize a fresh |ScriptSource| with uncompressed source.
+  // Initialize a fresh |ScriptSource| with unretrievable, uncompressed source.
   template <typename Unit>
-  MOZ_MUST_USE bool initializeUncompressedSource(JSContext* cx,
-                                                 EntryUnits<Unit>&& source,
-                                                 size_t length);
+  MOZ_MUST_USE bool initializeUnretrievableUncompressedSource(
+      JSContext* cx, EntryUnits<Unit>&& source, size_t length);
 
   // Set the retrieved source for a |ScriptSource| whose source was recorded as
   // missing but retrievable.
   template <typename Unit>
   MOZ_MUST_USE bool setRetrievedSource(JSContext* cx, EntryUnits<Unit>&& source,
                                        size_t length);
 
   MOZ_MUST_USE bool tryCompressOffThread(JSContext* cx);