Gnash
0.8.10
|
00001 // 00002 // Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 00003 // Free Software Foundation, Inc. 00004 // 00005 // This program is free software; you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation; either version 3 of the License, or 00008 // (at your option) any later version. 00009 // 00010 // This program is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with this program; if not, write to the Free Software 00017 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00018 00019 #ifndef GNASH_SWF_SCRIPTLIMITSTAG_H 00020 #define GNASH_SWF_SCRIPTLIMITSTAG_H 00021 00022 #include "SWF.h" // for TagType definition 00023 #include "SWFStream.h" // for inlines 00024 #include "movie_root.h" 00025 #include "movie_definition.h" 00026 #include "ControlTag.h" 00027 00028 namespace gnash { 00029 namespace SWF { 00030 00032 // 00036 class ScriptLimitsTag : public ControlTag 00037 { 00038 public: 00039 00040 virtual ~ScriptLimitsTag() {} 00041 00042 virtual void executeState(MovieClip* m, DisplayList& /*dl*/) const { 00043 00044 LOG_ONCE( // movie_root will always log on change 00045 log_debug("Setting script limits: recursion %s, timeout %s", 00046 _recursionLimit, _timeoutLimit); 00047 ); 00048 getRoot(*getObject(m)).setScriptLimits(_recursionLimit, _timeoutLimit); 00049 } 00050 00051 static void loader(SWFStream& in, TagType tag, movie_definition& m, 00052 const RunResources& /*r*/) 00053 { 00054 assert(tag == SWF::SCRIPTLIMITS); 00055 boost::intrusive_ptr<ControlTag> s(new ScriptLimitsTag(in)); 00056 m.addControlTag(s); 00057 } 00058 00059 private: 00060 00061 ScriptLimitsTag(SWFStream& in) 00062 : 00063 _recursionLimit(0), 00064 _timeoutLimit(0) 00065 { 00066 in.ensureBytes(4); 00067 _recursionLimit = in.read_u16(); 00068 _timeoutLimit = in.read_u16(); 00069 00070 IF_VERBOSE_PARSE ( 00071 log_parse(_(" ScriptLimits tag: recursion: %d, timeout: %d"), 00072 _recursionLimit, _timeoutLimit); 00073 ); 00074 00075 } 00076 00077 boost::uint16_t _recursionLimit; 00078 boost::uint16_t _timeoutLimit; 00079 }; 00080 00081 } // namespace gnash::SWF 00082 } // namespace gnash 00083 00084 00085 #endif // GNASH_SWF_SCRIPTLIMITSTAG_H 00086 00087 00088 // Local Variables: 00089 // mode: C++ 00090 // indent-tabs-mode: t 00091 // End: