Shaka Player Embedded
eme_promise_impl.h
Go to the documentation of this file.
1 // Copyright 2018 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef SHAKA_EMBEDDED_EME_PROMISE_IMPL_H_
16 #define SHAKA_EMBEDDED_EME_PROMISE_IMPL_H_
17 
18 #include <atomic>
19 #include <string>
20 
21 #include "shaka/eme/eme_promise.h"
22 
23 #include "src/core/ref_ptr.h"
24 #include "src/mapping/promise.h"
25 #include "src/util/macros.h"
26 
27 namespace shaka {
28 namespace eme {
29 
31  public:
32  Impl(const Promise& promise, bool has_value);
33  virtual ~Impl();
34 
36 
37  virtual void Resolve();
38  virtual void ResolveWith(bool value);
39  virtual void Reject(ExceptionType except_type, const std::string& message);
40 
41  protected:
42  Impl();
43 
44  private:
45  RefPtr<Promise> promise_;
46  std::atomic<bool> is_pending_;
47  const bool has_value_;
48 };
49 
50 } // namespace eme
51 } // namespace shaka
52 
53 #endif // SHAKA_EMBEDDED_EME_PROMISE_IMPL_H_
virtual void ResolveWith(bool value)
Definition: eme_promise.cc:60
const char * message
virtual void Reject(ExceptionType except_type, const std::string &message)
Definition: eme_promise.cc:82