Shaka Player Embedded
js_manager.h
Go to the documentation of this file.
1 // Copyright 2016 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_JS_MANAGER_H_
16 #define SHAKA_EMBEDDED_JS_MANAGER_H_
17 
18 #include <memory>
19 #include <string>
20 
21 #include "async_results.h"
22 #include "macros.h"
23 #include "net.h"
24 
25 namespace shaka {
26 
27 class JsManagerImpl;
28 
53 class SHAKA_EXPORT JsManager final {
54  public:
55  struct StartupOptions final {
56  // This type is stack allocated, so the size is part of the public ABI;
57  // fields can't be added without breaking compatibility.
58 
67  std::string dynamic_data_dir;
68 
76  std::string static_data_dir;
77 
84  bool is_static_relative_to_bundle = false;
85  };
86 
87  JsManager();
88  JsManager(const StartupOptions& options);
90  ~JsManager();
91 
92  JsManager& operator=(JsManager&&);
93 
95 
100  void Stop();
101 
108  void WaitUntilFinished();
109 
115  AsyncResults<void> RunScript(const std::string& path);
116 
124  AsyncResults<void> RegisterNetworkScheme(const std::string& scheme,
125  SchemePlugin* plugin);
126 
131  AsyncResults<void> UnregisterNetworkScheme(const std::string& scheme);
132 
133  private:
134  std::unique_ptr<JsManagerImpl> impl_;
135 };
136 
137 } // namespace shaka
138 
139 #endif // SHAKA_EMBEDDED_JS_MANAGER_H_
#define SHAKA_EXPORT
Definition: macros.h:30
bool RunScript(const std::string &path)
Definition: js_wrappers.cc:239
#define SHAKA_NON_COPYABLE_TYPE(Type)
Definition: macros.h:43