Shaka Player Embedded
rejected_promise_handler.h
Go to the documentation of this file.
1 // Copyright 2017 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_CORE_REJECTED_PROMISE_HANDLER_H_
16 #define SHAKA_EMBEDDED_CORE_REJECTED_PROMISE_HANDLER_H_
17 
18 #include <list>
19 
22 #include "src/util/macros.h"
23 
24 namespace shaka {
25 
34  public:
37 
43  void AddPromise(Handle<JsPromise> promise, Handle<JsValue> value);
45  void RemovePromise(Handle<JsPromise> promise);
46 
48  void LogUnhandledRejection();
49 
50  private:
51  struct PromiseInfo {
52  PromiseInfo(Handle<JsPromise> promise, Handle<JsValue> value);
53  ~PromiseInfo();
54 
56 
57  Global<JsPromise> promise;
58  Global<JsValue> value;
59  };
60 
61  std::list<PromiseInfo> promises_;
62  bool has_callback_;
63 };
64 
65 } // namespace shaka
66 
67 #endif // SHAKA_EMBEDDED_CORE_REJECTED_PROMISE_HANDLER_H_
void AddPromise(Handle< JsPromise > promise, Handle< JsValue > value)
#define SHAKA_NON_COPYABLE_OR_MOVABLE_TYPE(Type)
Definition: macros.h:51
void RemovePromise(Handle< JsPromise > promise)