Commit 0dd2da94 authored by Yulia Startsev's avatar Yulia Startsev
Browse files

Bug 1796460 - Use nsMainthreadPtrHolder instead of RefPtr for CacheCreator r=asuth

parent 7f3cba09
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "WorkerLoadContext.h"
#include "CacheLoadHandler.h"  // CacheCreator refptr
#include "CacheLoadHandler.h"  // CacheCreator

namespace mozilla {
namespace dom {
@@ -19,7 +19,7 @@ WorkerLoadContext::WorkerLoadContext(Kind aKind,
void WorkerLoadContext::SetCacheCreator(
    RefPtr<workerinternals::loader::CacheCreator> aCacheCreator) {
  AssertIsOnMainThread();
  mCacheCreator = aCacheCreator;
  mCacheCreator = new nsMainThreadPtrHolder<workerinternals::loader::CacheCreator>("WorkerLoadContext::mCacheCreator", aCacheCreator);
}

void WorkerLoadContext::ClearCacheCreator() {
@@ -29,7 +29,8 @@ void WorkerLoadContext::ClearCacheCreator() {

RefPtr<workerinternals::loader::CacheCreator>
WorkerLoadContext::GetCacheCreator() {
  return mCacheCreator;
  AssertIsOnMainThread();
  return mCacheCreator.get();
}

}  // namespace dom
+1 −1
Original line number Diff line number Diff line
@@ -120,7 +120,7 @@ class WorkerLoadContext : public JS::loader::LoadContextBase {
  // when we're going to have an mCachePromise.
  nsCOMPtr<nsIInputStream> mCacheReadStream;

  RefPtr<workerinternals::loader::CacheCreator> mCacheCreator;
  nsMainThreadPtrHandle<workerinternals::loader::CacheCreator> mCacheCreator;

  void ClearCacheCreator();