2 // Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 3 of the License, or
7 // (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 #ifndef GNASH_SWF_SCRIPTLIMITSTAG_H
19 #define GNASH_SWF_SCRIPTLIMITSTAG_H
21 #include "SWF.h" // for TagType definition
22 #include "SWFStream.h" // for inlines
23 #include "movie_root.h"
24 #include "movie_definition.h"
25 #include "ControlTag.h"
30 /// \brief Sets the desired limits for recursion and timeout for AS scripts
32 /// A loaded movie containing a ScriptLimits tag should change the *global*
33 /// scriptlimits setting, so this is kept in movie_root rather than the
34 /// immutable movie_definition.
35 class ScriptLimitsTag
: public ControlTag
39 virtual ~ScriptLimitsTag() {}
41 virtual void executeState(MovieClip
* m
, DisplayList
& /*dl*/) const {
43 log_debug("Setting script limits: recursion %s, timeout %s",
44 _recursionLimit
, _timeoutLimit
);
45 getRoot(*getObject(m
)).setScriptLimits(_recursionLimit
, _timeoutLimit
);
48 static void loader(SWFStream
& in
, TagType tag
, movie_definition
& m
,
49 const RunResources
& /*r*/)
51 assert(tag
= SWF::SCRIPTLIMITS
);
52 boost::intrusive_ptr
<ControlTag
> s(new ScriptLimitsTag(in
));
58 ScriptLimitsTag(SWFStream
& in
)
64 _recursionLimit
= in
.read_u16();
65 _timeoutLimit
= in
.read_u16();
68 log_parse(_(" ScriptLimits tag: recursion: %d, timeout: %d"),
69 _recursionLimit
, _timeoutLimit
);
74 boost::uint16_t _recursionLimit
;
75 boost::uint16_t _timeoutLimit
;
78 } // namespace gnash::SWF
82 #endif // GNASH_SWF_SCRIPTLIMITSTAG_H
87 // indent-tabs-mode: t