Line data Source code
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 0 : SeekJob::~SeekJob()
12 : {
13 0 : MOZ_DIAGNOSTIC_ASSERT(mTarget.isNothing());
14 0 : MOZ_DIAGNOSTIC_ASSERT(mPromise.IsEmpty());
15 0 : }
16 :
17 0 : bool SeekJob::Exists() const
18 : {
19 0 : MOZ_ASSERT(mTarget.isSome() == !mPromise.IsEmpty());
20 0 : return mTarget.isSome();
21 : }
22 :
23 0 : void SeekJob::Resolve(const char* aCallSite)
24 : {
25 0 : mPromise.Resolve(true, aCallSite);
26 0 : mTarget.reset();
27 0 : }
28 :
29 0 : void SeekJob::RejectIfExists(const char* aCallSite)
30 : {
31 0 : mTarget.reset();
32 0 : mPromise.RejectIfExists(true, aCallSite);
33 0 : }
34 :
35 : } // namespace mozilla
|