tor-browser

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

SeekJob.cpp (855B)


      1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #include "SeekJob.h"
      8 
      9 namespace mozilla {
     10 
     11 SeekJob::~SeekJob() {
     12  MOZ_DIAGNOSTIC_ASSERT(mTarget.isNothing());
     13  MOZ_DIAGNOSTIC_ASSERT(mPromise.IsEmpty());
     14 }
     15 
     16 bool SeekJob::Exists() const {
     17  MOZ_ASSERT(mTarget.isSome() == !mPromise.IsEmpty());
     18  return mTarget.isSome();
     19 }
     20 
     21 void SeekJob::Resolve(StaticString aCallSite) {
     22  mPromise.Resolve(true, aCallSite);
     23  mTarget.reset();
     24 }
     25 
     26 void SeekJob::RejectIfExists(StaticString aCallSite) {
     27  mTarget.reset();
     28  mPromise.RejectIfExists(true, aCallSite);
     29 }
     30 
     31 }  // namespace mozilla