tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

ScriptCacheActors.h (1462B)


      1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
      2 /* This Source Code Form is subject to the terms of the Mozilla Public
      3 * License, v. 2.0. If a copy of the MPL was not distributed with this
      4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      5 
      6 #ifndef ScriptCache_h
      7 #define ScriptCache_h
      8 
      9 #include "mozilla/ScriptPreloader.h"
     10 #include "mozilla/loader/PScriptCacheChild.h"
     11 #include "mozilla/loader/PScriptCacheParent.h"
     12 
     13 namespace mozilla {
     14 namespace ipc {
     15 class FileDescriptor;
     16 }
     17 
     18 namespace loader {
     19 
     20 using mozilla::ipc::FileDescriptor;
     21 using mozilla::ipc::IPCResult;
     22 
     23 class ScriptCacheParent final : public PScriptCacheParent {
     24  friend class PScriptCacheParent;
     25 
     26 public:
     27  explicit ScriptCacheParent(bool wantCacheData)
     28      : mWantCacheData(wantCacheData) {}
     29 
     30 protected:
     31  IPCResult Recv__delete__(nsTArray<ScriptData>&& scripts);
     32 
     33  virtual void ActorDestroy(ActorDestroyReason aWhy) override;
     34 
     35 private:
     36  bool mWantCacheData;
     37 };
     38 
     39 class ScriptCacheChild final : public PScriptCacheChild {
     40  friend class mozilla::ScriptPreloader;
     41 
     42 public:
     43  ScriptCacheChild() = default;
     44 
     45  void Init(const Maybe<FileDescriptor>& cacheFile, bool wantCacheData);
     46 
     47 protected:
     48  virtual void ActorDestroy(ActorDestroyReason aWhy) override;
     49 
     50  void SendScriptsAndFinalize(ScriptPreloader::ScriptHash& scripts);
     51 
     52 private:
     53  bool mWantCacheData = false;
     54 };
     55 
     56 }  // namespace loader
     57 }  // namespace mozilla
     58 
     59 #endif  // ScriptCache_h