Bug 1507180 - Add explanatory comment r=dom-workers-and-storage-reviewers,sg
authorYaron Tausky <ytausky@mozilla.com>
Thu, 05 Mar 2020 09:36:39 +0000
changeset 517475 25beb671c14a2cf8f3e4f7e7d74755353b268acf
parent 517474 615bbb98f5bad4a4ecd6a22d671e727ee7a9bf13
child 517476 b3ad5d93c16edf253577df49111cce4e5125401b
push id37193
push usershindli@mozilla.com
push dateSun, 08 Mar 2020 21:41:29 +0000
treeherdermozilla-central@7aa696aefc46 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdom-workers-and-storage-reviewers, sg
bugs1507180
milestone75.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1507180 - Add explanatory comment r=dom-workers-and-storage-reviewers,sg Hopefully this comment would prevent a future contributor from removing the copy operation. Differential Revision: https://phabricator.services.mozilla.com/D55424
dom/cache/StreamControl.cpp
--- a/dom/cache/StreamControl.cpp
+++ b/dom/cache/StreamControl.cpp
@@ -52,16 +52,21 @@ void StreamControl::CloseReadStreams(con
   }
 
   MOZ_DIAGNOSTIC_ASSERT(closedCount > 0);
 }
 
 void StreamControl::CloseAllReadStreams() {
   AssertOwningThread();
 
+  // A copy of mReadStreamList is necessary here for two reasons:
+  // 1. mReadStreamList is modified in StreamControl::ForgetReadStream (called
+  //    transitively)
+  // 2. the this pointer is deleted by CacheStreamControlParent::Shutdown
+  //    (called transitively)
   auto readStreamList = mReadStreamList;
   ReadStreamList::ForwardIterator iter(readStreamList);
   while (iter.HasMore()) {
     iter.GetNext()->CloseStream();
   }
 }
 
 void StreamControl::CloseAllReadStreamsWithoutReporting() {