Go to the documentation of this file.
19 #ifndef GNASH_MOVIE_LOADER_H
20 #define GNASH_MOVIE_LOADER_H
23 #include <condition_variable>
27 #include <boost/intrusive_ptr.hpp>
28 #include <boost/noncopyable.hpp>
29 #include <boost/ptr_container/ptr_list.hpp>
37 class movie_definition;
75 void loadMovie(
const std::string&
url,
const std::string& target,
83 void processCompletedRequests();
85 void setReachable()
const;
90 class Request : boost::noncopyable {
95 Request(
URL u, std::string
t,
96 const std::string* postdata,
as_object* handler)
98 _target(std::move(
t)),
107 _postData = *postdata;
112 const std::string& getTarget()
const {
return _target; }
113 const URL& getURL()
const {
return _url; }
114 const std::string& getPostData()
const {
return _postData; }
115 bool usePost()
const {
return _usePost; }
116 as_object* getHandler()
const {
return _handler; }
117 void setReachable()
const {
118 if (_handler) _handler->setReachable();
134 bool getCompleted(boost::intrusive_ptr<movie_definition>& md)
const
136 std::lock_guard<std::mutex> lock(_mutex);
144 std::lock_guard<std::mutex> lock(_mutex);
149 bool completed()
const
151 std::lock_guard<std::mutex> lock(_mutex);
162 void setCompleted(boost::intrusive_ptr<movie_definition> md)
164 std::lock_guard<std::mutex> lock(_mutex);
173 std::string _postData;
174 boost::intrusive_ptr<movie_definition> _mdef;
175 mutable std::mutex _mutex;
181 typedef boost::ptr_list<Request> Requests;
184 mutable std::mutex _requestsMutex;
186 void processRequests();
187 void processRequest(Request&
r);
188 void clearRequests();
194 bool processCompletedRequest(
const Request&
r);
197 std::atomic<bool> _killed;
199 std::condition_variable _wakeup;
209 #endif // GNASH_MOVIE_LOADER_H
bool isLevelTarget(int version, const std::string &name, unsigned int &levelno)
Return true if the given string can be interpreted as a _level name.
Definition: movie_root.cpp:2387
static DSOEXPORT boost::intrusive_ptr< movie_definition > makeMovie(const URL &url, const RunResources &runResources, const char *real_url=nullptr, bool startLoaderThread=true, const std::string *postdata=nullptr)
Create a gnash::movie_definition from the given URL.
Definition: MovieFactory.cpp:109
void loadMovie(const std::string &url, const std::string &target, const std::string &data, MovieClip::VariablesMethod method, as_object *handler=nullptr)
Queue a request for loading a movie.
Definition: MovieLoader.cpp:397
The base class for all ActionScript objects.
Definition: as_object.h:162
@ METHOD_POST
Definition: MovieClip.h:422
static const int staticDepthOffset
Definition: DisplayObject.h:205
DisplayObject * findCharacterByTarget(const std::string &tgtstr) const
Definition: movie_root.cpp:2142
@ PROP_BROADCAST_MESSAGE
Definition: namedStrings.h:139
void log_debug(StringType msg, Args... args)
Definition: log.h:301
#define _(String)
Definition: log.h:44
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:41
Global_as * getGlobal() const
Get a pointer to this VM's _global Object.
Definition: VM.cpp:149
@ PRIORITY_DOACTION
Frame actions, load handlers, unload handlers.
Definition: movie_root.h:539
void setReachable() const
Definition: MovieLoader.cpp:461
~MovieLoader()
Definition: MovieLoader.cpp:453
void clear()
Drop all requests and kill the thread.
Definition: MovieLoader.cpp:152
void pushAction(std::unique_ptr< ExecutableCode > code, size_t lvl)
Push an executable code to the ActionQueue.
Definition: movie_root.cpp:1496
void log_error(StringType msg, Args... args)
Definition: log.h:283
void setLevel(unsigned int num, Movie *movie)
Put the given movie at the given level.
Definition: movie_root.cpp:316
MovieLoader(movie_root &mr)
Definition: MovieLoader.cpp:47
@ t
Definition: GnashKey.h:166
as_value callMethod(fn_call::Args &args, as_object *obj, const ObjectURI &uri)
Call a member function of this object in an AS-compatible way.
Definition: Global_as.h:219
@ r
Definition: GnashKey.h:164
void for_each(C &container, R(T::*pmf)(const A &), const A &arg)
Definition: Renderer_ogl.cpp:690
code
Definition: GnashKey.h:44
VM & getVM()
Return the VM used by this movie_root.
Definition: movie_root.h:356
void processCompletedRequests()
Process all completed movie load requests.
Definition: MovieLoader.cpp:329
int getSWFVersion() const
Get SWF version context for the currently running actions.
Definition: VM.h:106
Movie loader.
Definition: MovieLoader.h:50
@ _1
Definition: GnashKey.h:95
VariablesMethod
The various methods for sending data in requests.
Definition: MovieClip.h:419
movie_root & getRoot(const as_environment &env)
Definition: as_environment.cpp:645
std::string url
Definition: gnash.cpp:59
as_object * getObject(const DisplayObject *d)
Return the as_object associated with a DisplayObject if it exists.
Definition: DisplayObject.h:1160
This class represents the 'Stage' and top-level movie.
Definition: movie_root.h:151
#define DSOEXPORT
Definition: dsodefs.h:55
const URL & baseURL() const
The base URL that should be used to resolve all relative URLs.
Definition: StreamProvider.h:117
@ METHOD_GET
Definition: MovieClip.h:421
Uniform Resource Locator.
Definition: URL.h:35
@ u
Definition: GnashKey.h:167
const RunResources & runResources() const
Definition: movie_root.h:788
std::map< std::string, std::string > MovieVariables
Definition: MovieClip.h:93
SimpleBuffer data
Definition: LocalConnection_as.cpp:151
void clear()
Clean up the font library.
Definition: fontlib.cpp:36
const StreamProvider & streamProvider() const
Get a StreamProvider instance.
Definition: RunResources.h:76