Drop the bool operator for ObjectURI, to avoid getting the kind of side-effect that...
[gnash.git] / libcore / impl.cpp
blobd6e6cc19cf1078a2a8d08014ae635d5f465651a3
1 // impl.cpp: Implement ActionScript tags, movie loading, library, for Gnash.
2 //
3 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
4 // Foundation, Inc
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #include "MovieFactory.h"
22 #include "smart_ptr.h" // GNASH_USE_GC
23 #include "IOChannel.h"
24 #include "utility.h"
25 #include "fontlib.h"
26 #include "log.h"
27 #include "GnashImage.h"
28 #include "sprite_definition.h"
29 #include "SWFMovieDefinition.h"
30 #include "BitmapMovieDefinition.h"
31 #include "RunResources.h"
32 #include "URL.h"
33 #include "StreamProvider.h"
34 #include "MovieClip.h"
35 #include "VM.h"
36 #include "MovieLibrary.h"
37 #include "gnash.h" // DSOEXPORTS
39 #ifdef GNASH_USE_GC
40 #include "GC.h"
41 #endif
43 #include <string>
44 #include <map>
45 #include <memory> // for auto_ptr
46 #include <algorithm>
48 namespace gnash
52 // global gnash management
55 // Maximum release of resources.
56 void clear()
58 // Ideally, we should make sure that function properly signals all threads
59 // about exiting and giving them a chance to cleanly exit.
61 // If we clear shared memory here we're going to leave threads possibly
62 // accessing deleted memory, which would trigger a segfault.
64 // My experience is that calling exit(), altought it has the same problem,
65 // reduces the chances of segfaulting ...
67 // We want this fixed anyway as exit()
68 // itselt can also trigger segfaults.
70 // See task task #6959 and depending items
72 log_debug("Any segfault past this message is likely due to improper "
73 "threads cleanup.");
75 VM::get().clear();
77 MovieFactory::movieLibrary.clear();
78 fontlib::clear();
80 #ifdef GNASH_USE_GC
81 GC::get().fuzzyCollect(); // why would this be needed ?
83 GC::cleanup();
84 #endif
88 #ifdef GNASH_USE_GC
89 /// A GC root used to mark all reachable collectable pointers
90 class GnashGcRoot : public GcRoot
93 public:
95 GnashGcRoot()
99 void markReachableResources() const
101 VM::get().markReachableResources();
104 #endif
106 void gnashInit()
108 #ifdef GNASH_USE_GC
109 static GnashGcRoot gcRoot;
110 GC::init(gcRoot);
111 #endif
114 } // namespace gnash
116 // Local Variables:
117 // mode: C++
118 // indent-tabs-mode: t
119 // End: