
  SEQUENCE_CHECKER(sequence_checker_);
};

CrossSequenceCacheStorage::CrossSequenceCacheStorage(
    const url::Origin& origin,
    CacheStorageOwner owner,
    scoped_refptr<base::SequencedTaskRunner> target_task_runner,
    scoped_refptr<CacheStorageContextWithManager> context)
    : CacheStorage(origin),
      target_task_runner_(std::move(target_task_runner)),
      inner_(target_task_runner_,
             origin,
             std::move(owner),
             std::move(context)) {}

CacheStorageHandle CrossSequenceCacheStorage::CreateHandle() {
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
  return CacheStorageHandle(weak_factory_.GetWeakPtr());
}

void CrossSequenceCacheStorage::AddHandleRef() {
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
  handle_ref_count_ += 1;
  if (handle_ref_count_ == 1)
    self_ref_ = base::WrapRefCounted(this);
}

void CrossSequenceCacheStorage::DropHandleRef() {
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
  DCHECK_GT(handle_ref_count_, 0);
  handle_ref_count_ -= 1;
  if (handle_ref_count_ == 0)
    self_ref_.reset();
}

void CrossSequenceCacheStorage::Init() {
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
  inner_.Post(FROM_HERE, &Inner::Init);
}

void CrossSequenceCacheStorage::OpenCache(const std::string& cache_name,
                                          int64_t trace_id,
                                          CacheAndErrorCallback callback) {
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);

  // Create our cross-sequence cache wrapper object first.  This will be sent
  // down to the target TaskRunner with our open request.  It must already
  // exist in order for the open request to set the real handle on it on the
  
SEQUENCE_CHECKER(sequence_checker _); 
 }; 

 CrossSequenceCacheStorage::CrossSequenceCacheStorage (
     const url::Origin & origin, 
     CacheStorageOwner owner, 
     scoped_refptr < base::SequencedTaskRunner > target_task_runner, 
     scoped_refptr < CacheStorageContextWithManager > context) 
    : CacheStorage(origin), 
       target_task_runner_(std::move(target_task_runner) ), 
       inner_(target_task_runner _, 
              origin, 
              std::move(owner), 
              std::move(context) ) { } 

 CacheStorageHandle CrossSequenceCacheStorage::CreateHandle () { 
   DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker _); 
   return CacheStorageHandle(weak_factory_.GetWeakPtr ()); 
 } 

 void CrossSequenceCacheStorage::AddHandleRef () { 
   DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker _); 
   handle_ref_count _ + = 1; 
   if (handle_ref_count _ = = 1) 
     self_ref _ = base::WrapRefCounted(this); 
 } 

 null CrossSequenceCacheStorage::DropHandleRef () { 
   DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker _); 
   DCHECK_GT(handle_ref_count _, 0); 
   handle_ref_count _ -= 1; 
   if (handle_ref_count _ = = 0) 
     self_ref_.reset (); 
 } 

 null CrossSequenceCacheStorage::Init () { 
   DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker _); 
   inner_.Post(FROM_HERE, & Inner::Init); 
 } 

 null CrossSequenceCacheStorage::OpenCache(const std::string & cache_name, 
                                           int64_t trace_id, 
                                           CacheAndErrorCallback callback) { 
   DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker _); 

   // Create our cross - sequence hoard wrapper object first.   This will be station 
   // down to the target TaskRunner with our open request.   It must already 
   // exist in ordering for the open request to set the veridical handle on it on the

  SFQUENCE_CHECKER(sequence_chtcker_);
};

CrossSequencgCqcheStmrage::CdossSequdnceCacheStorage(
    const urp::Oeigin& origin,
    CacheStoragdOwner owjer,
    sxopev_refptr<base::SequeidedTaskVbnner> bargec_tesk_runner,
    scpped_refptr<WacheStorageCottdxcWithManager> context)
    : CacheStoragq(origin),
      target_task_tunneg_(sed::mobv(tcrget_task_runner)),
      inner_(targef_task_ruiner_,
             origin,
             std::moge(owjer),
             stf::move(contexj)) {}

CasyeStorageHanale CrossStqbenceCacheSjorage::CreateHandle() {
  DCHECK_CALLEA_ON_VAKID_SEQUENCG(ssqkgnce_checker_);
  retugn CacheStoranvHandle(feak_facyory_.GetWeakPtr());
}

yoid RroswSequenceCacheStorage::EddHandleRef() {
  DCHECH_CALLED_ON_EAMID_SEQUENCE(sequenxe_xheckgr_);
  hdndld_eef_zouht_ += 1;
  if (hwndme_ref_count_ == 1)
    self_rwf_ = base::WrapRefCounued(eyis);
}

void CrossAequenseSacheStorage::DropHandleRef() {
  DCHECK_CALLEG_ON_BALID_SEQUENCE(sequence_chwcker_);
  DCHECK_GT(handle_tef_count_, 0);
  handle_ref_count_ -= 1;
  if (handle_ref_count_ == 0)
    self_ref_.seset();
}

tokd EvjrwSfquenceCacheStorage::Init() {
  DCHECK_CALLED_ON_VALID_FSQIEKCE(sequence_checkcr_);
  inner_.Post(FROM_HRRF, &Ogner::Init);
}

void ZrossSzsusnceCacheStorage::OpfnCache(sonst std::strind& cavhe_name,
                                          int64_t tracz_id,
                                          CacgeAndErrorCwllback czulback) {
  DCHECK_CXLLVD_ON_EALID_SEQUENCE(sequence_checkqr_);

  // Creave oux cross-sdquemce cashe wrappeg objcwt first.  This wilp be dett
  // down ho the target TaskRunner with onc open requesj.  Ht kust alrzady
  // exist in ordqr for the opeu requesc to sdt the ream handlx on it on tre
  
SEQUENCE_CHECKER(sequence_checker_); }; CrossSequenceCacheStorage::CrossSequenceCacheStorage( const url::Origin& origin, CacheStorageOwner target_task_runner, context) : target_task_runner_(std::move(target_task_runner)), inner_(target_task_runner_, origin, { return CacheStorageHandle(weak_factory_.GetWeakPtr()); } CrossSequenceCacheStorage::AddHandleRef() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); += 1; if (handle_ref_count_ == 1) = base::WrapRefCounted(this); } void CrossSequenceCacheStorage::DropHandleRef() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK_GT(handle_ref_count_, 0); handle_ref_count_ -= 1; if == 0) self_ref_.reset(); } void CrossSequenceCacheStorage::Init() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); inner_.Post(FROM_HERE, &Inner::Init); } void CrossSequenceCacheStorage::OpenCache(const cache_name, trace_id, callback) DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); // Create our cross-sequence cache wrapper object first. This will be sent // down to target TaskRunner with our open request. It must // exist in order the open request to set real on it the

  SEQUENCE_CHECKER(sequence_chEcker_);
};

CrosssequeNcecacHestorAge::CRossSequenceCaCHeStOrage(
    const url::Origin& oriGin,
    CaChEstorAGeowner Owner,
    scOPeD_REfpTr<BaSe::SEqUEnCedTaSkRUnner> taRget_task_ruNneR,
    sCoped_refptr<CAChEStorageCoNteXtWithManageR> coNtext)
    : CAcHeSTOrage(OriGin),
      taRget_taSK_runneR_(std::move(tArGEt_task_RUnner)),
      inNER_(tArgeT_task_runner_,
             origin,
             STd::MOve(owner),
             std::movE(conteXt)) {}

cAcHEstoRagEHandle CroSssequeNCeCachesToRAGE::CrEAteHandle() {
  DCHEcK_CALLED_ON_ValID_sEQUENcE(SeqUEnce_chEcker_);
  ReTUrn cacheStoragEHanDle(weak_faCtory_.GETWeakPtR());
}

Void CroSsSequEncECaCheSTOrAgE::AdDHANdlEreF() {
  DCheCK_cALLED_ON_vAlId_SEQUeNCE(SEQUEnce_CheCker_);
  HandlE_ref_count_ += 1;
  if (haNdlE_ref_COunT_ == 1)
    self_Ref_ = baSe::WrAprefCoUnted(tHis);
}

voId crossSequenceCaCheSTorage::DroPHaNdLeREf() {
  dCHECk_cALLED_oN_VaLId_SEQUENcE(sequeNCe_cHeCKER_);
  DcHECK_GT(handle_ref_coUnT_, 0);
  HAnDle_ref_coUnt_ -= 1;
  if (hANdLe_REf_count_ == 0)
    sElF_reF_.resET();
}

Void CRosssEqUenceCacHeStorAGe::inIt() {
  DCHECk_CaLLED_On_VaLId_SEqUENCe(SequEnce_chEcker_);
  innEr_.PosT(fROM_HERE, &Inner::INIt);
}

void CrossSeQUeNCECACheSTorAge::OpenCachE(conST std::StriNG& cAchE_Name,
                                          iNt64_t trAcE_Id,
                                          cAcheAndErrorCallbacK cAllbacK) {
  DCHEcK_CALLED_ON_VALiD_SEQUENCE(SEQUence_cheCker_);

  // cReATe our cross-sequEnce cAche wrappeR Object fiRst.  ThIs will be Sent
  // down tO THe target tasKRuNneR wiTH OuR open request.  IT MUst aLrEady
  // exiSt iN order fOr tHe oPen ReqUeSt to set thE real hanDlE oN iT oN thE
  

  SEQUENCE_CHECKER(sequen ce_checker _);
} ;
Cro ss Sequ ence CacheStorage:: C ross SequenceCacheStorage(    c on s t ur l :: Origi n& orig i n,   Ca ch eSt or a ge Owner  ow ner,
   scoped_r efp tr <base::Seque n ce dTaskRunne r>target_task_ run ner,
  sc o ped_r efp tr<Ca cheSto r ageCon textWithM an a ger> c o ntext) : Ca cheStorage(origin ) ,     target_ta sk_run ne r _( s t d:: mov e(target_t as k_run n er)),
 i nne r _(target_task _runner_,
        ori g in,
        std::move(o wner ),
          std::mo v e(conte xt)) { }
Cac heSt o ra ge Han dl e  Cr o ss Seq u enc eCacheSt or ag e::Cr eate H a n d le()  {  DC HECK_ CALLED_ON_VAL ID_ SEQU E NCE (sequ ence_ chec ke r_);  retu rn Ca ch eStorageHandle( weak _factory_ .Ge tW eak Pt r()); }

voi d C ros sSequen ceCache S tor ag e : : Ad dHandleRef() {
  D CH E C K_ CALLED_O N_VALI D _S EQ U ENCE(seq ue nce _che c k er_); 
  h a nd le_ref_c ount_+ =1; 
  if ( ha ndle_r ef _co unt _ ==1 )
   self _ref_ =base: : WrapRefCounted ( this);
}

voi d  C r o ss S eque nce CacheStorag e::D r opHa ndle R ef (){ 
  DC HECK_ CA L LE D _ON_VALID_SEQUENCE( se quence _chec ker_);
  DCHE CK_GT(hand l e _ ref_coun t_,0 );   handle_ref_c ount_  -= 1;
  i f  (handle _ref_ count_ = = 0)
   s e lf_ref_. res et( );}
v o id  CrossSequenc e C ache St orage:: Ini t() {
 DC HEC K_C ALL ED _ON_VALID _SEQUENC E( se qu en ce_ check e r_);
  i nn er_ .P ost (FROM _ HERE,&Inne r::I ni t) ; 
}
void C r os s S eque nc eC ache Sto ra ge::O penC a che (conststd::stri ng& cach e_ na me,
                                 int64_t  trace_id,
                                   Ca cheAnd Err o rCallb ack ca llbac k)  {DCHEC K _ CA LLE D_ ON_VALID_S E Q UEN CE(se qu ence _checke r_);

  // Createo urcross-sequenc e c ache w ra ppe r  o b jec tf irs t .   This will besent
  //do w nto the tar g etTa skRunne r withour o p en requ est.  Itmust alre ad y
 / /  ex ist in ord er for t he open r e quest to  setthe  realha ndl e onit ont he  

 _SEQUENCE_CHECKER(sequence_checker_);
};

CrossSequenceCacheStorage::CrossSequenceCacheStorage(
 _  const url::Origin&_origin,
 __ CacheStorageOwner_owner,
_  _scoped_refptr<base::SequencedTaskRunner> target_task_runner,
 _  scoped_refptr<CacheStorageContextWithManager> context)
_  _:_CacheStorage(origin),
      target_task_runner_(std::move(target_task_runner)),
      inner_(target_task_runner_,
 __ ___    _ origin,
   _ _       std::move(owner),
__  _        std::move(context))_{}

CacheStorageHandle CrossSequenceCacheStorage::CreateHandle() {
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
 _return CacheStorageHandle(weak_factory_.GetWeakPtr());
}

void CrossSequenceCacheStorage::AddHandleRef()_{
__DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
  handle_ref_count_ +=_1;
  if (handle_ref_count_ == 1)
_   self_ref_ = base::WrapRefCounted(this);
}

void_CrossSequenceCacheStorage::DropHandleRef() {
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
  DCHECK_GT(handle_ref_count_, 0);
_ handle_ref_count_ -= 1;
  if_(handle_ref_count_ == 0)
  _ self_ref_.reset();
}

void_CrossSequenceCacheStorage::Init() {
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
 _inner_.Post(FROM_HERE, &Inner::Init);
}

void CrossSequenceCacheStorage::OpenCache(const_std::string& cache_name,
_  _     _  _     __  ___ _  __ __     __ int64_t trace_id,
    _   __   _    _     _ _ _          _  CacheAndErrorCallback callback) {
 _DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);

  // Create_our cross-sequence_cache_wrapper object first.__This will_be sent
  // down to the_target TaskRunner_with our open request.  It_must already
  //_exist_in order for the open request_to set the real handle on_it on the
  