diff options
author | Diva Canto | 2012-11-11 19:39:21 -0800 |
---|---|---|
committer | Diva Canto | 2012-11-11 19:39:21 -0800 |
commit | db418bff2bb6b2676c996e77b260b0977e886f5d (patch) | |
tree | 22efac35f69b9ac51bc784ffb8352339bc0f04f8 /OpenSim/Region | |
parent | One more module converted: WebStatsModule. (diff) | |
download | opensim-SC_OLD-db418bff2bb6b2676c996e77b260b0977e886f5d.zip opensim-SC_OLD-db418bff2bb6b2676c996e77b260b0977e886f5d.tar.gz opensim-SC_OLD-db418bff2bb6b2676c996e77b260b0977e886f5d.tar.bz2 opensim-SC_OLD-db418bff2bb6b2676c996e77b260b0977e886f5d.tar.xz |
Fix issues with the DynamicTextureModule and corresponding unit tests.
Diffstat (limited to 'OpenSim/Region')
3 files changed, 39 insertions, 32 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs index 9d90517..9d77b19 100644 --- a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs | |||
@@ -83,6 +83,16 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture | |||
83 | /// </remarks> | 83 | /// </remarks> |
84 | private Cache m_reuseableDynamicTextures; | 84 | private Cache m_reuseableDynamicTextures; |
85 | 85 | ||
86 | /// <summary> | ||
87 | /// This constructor is only here because of the Unit Tests... | ||
88 | /// Don't use it. | ||
89 | /// </summary> | ||
90 | public DynamicTextureModule() | ||
91 | { | ||
92 | m_reuseableDynamicTextures = new Cache(CacheMedium.Memory, CacheStrategy.Conservative); | ||
93 | m_reuseableDynamicTextures.DefaultTTL = new TimeSpan(24, 0, 0); | ||
94 | } | ||
95 | |||
86 | #region IDynamicTextureManager Members | 96 | #region IDynamicTextureManager Members |
87 | 97 | ||
88 | public void RegisterRender(string handleType, IDynamicTextureRender render) | 98 | public void RegisterRender(string handleType, IDynamicTextureRender render) |
diff --git a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs index a08a183..65737fa 100644 --- a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs | |||
@@ -49,21 +49,6 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL | |||
49 | private string m_name = "LoadImageURL"; | 49 | private string m_name = "LoadImageURL"; |
50 | private Scene m_scene; | 50 | private Scene m_scene; |
51 | private IDynamicTextureManager m_textureManager; | 51 | private IDynamicTextureManager m_textureManager; |
52 | private IDynamicTextureManager TextureManager | ||
53 | { | ||
54 | get | ||
55 | { | ||
56 | if (m_textureManager == null && m_scene != null) | ||
57 | { | ||
58 | m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>(); | ||
59 | if (m_textureManager != null) | ||
60 | { | ||
61 | m_textureManager.RegisterRender(GetContentType(), this); | ||
62 | } | ||
63 | } | ||
64 | return m_textureManager; | ||
65 | } | ||
66 | } | ||
67 | 52 | ||
68 | private string m_proxyurl = ""; | 53 | private string m_proxyurl = ""; |
69 | private string m_proxyexcepts = ""; | 54 | private string m_proxyexcepts = ""; |
@@ -146,6 +131,14 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL | |||
146 | 131 | ||
147 | public void RegionLoaded(Scene scene) | 132 | public void RegionLoaded(Scene scene) |
148 | { | 133 | { |
134 | if (m_textureManager == null && m_scene == scene) | ||
135 | { | ||
136 | m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>(); | ||
137 | if (m_textureManager != null) | ||
138 | { | ||
139 | m_textureManager.RegisterRender(GetContentType(), this); | ||
140 | } | ||
141 | } | ||
149 | } | 142 | } |
150 | 143 | ||
151 | public void Close() | 144 | public void Close() |
@@ -191,6 +184,12 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL | |||
191 | 184 | ||
192 | private void HttpRequestReturn(IAsyncResult result) | 185 | private void HttpRequestReturn(IAsyncResult result) |
193 | { | 186 | { |
187 | if (m_textureManager == null) | ||
188 | { | ||
189 | m_log.WarnFormat("[LOADIMAGEURLMODULE]: No texture manager. Can't function."); | ||
190 | return; | ||
191 | } | ||
192 | |||
194 | RequestState state = (RequestState) result.AsyncState; | 193 | RequestState state = (RequestState) result.AsyncState; |
195 | WebRequest request = (WebRequest) state.Request; | 194 | WebRequest request = (WebRequest) state.Request; |
196 | Stream stream = null; | 195 | Stream stream = null; |
@@ -271,7 +270,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL | |||
271 | m_log.DebugFormat("[LOADIMAGEURLMODULE]: Returning {0} bytes of image data for request {1}", | 270 | m_log.DebugFormat("[LOADIMAGEURLMODULE]: Returning {0} bytes of image data for request {1}", |
272 | imageJ2000.Length, state.RequestID); | 271 | imageJ2000.Length, state.RequestID); |
273 | 272 | ||
274 | TextureManager.ReturnData( | 273 | m_textureManager.ReturnData( |
275 | state.RequestID, | 274 | state.RequestID, |
276 | new OpenSim.Region.CoreModules.Scripting.DynamicTexture.DynamicTexture( | 275 | new OpenSim.Region.CoreModules.Scripting.DynamicTexture.DynamicTexture( |
277 | request.RequestUri, null, imageJ2000, newSize, false)); | 276 | request.RequestUri, null, imageJ2000, newSize, false)); |
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs index efa99e9..689e8a7 100644 --- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs | |||
@@ -58,21 +58,6 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
58 | 58 | ||
59 | private Scene m_scene; | 59 | private Scene m_scene; |
60 | private IDynamicTextureManager m_textureManager; | 60 | private IDynamicTextureManager m_textureManager; |
61 | private IDynamicTextureManager TextureManager | ||
62 | { | ||
63 | get | ||
64 | { | ||
65 | if (m_textureManager == null && m_scene != null) | ||
66 | { | ||
67 | m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>(); | ||
68 | if (m_textureManager != null) | ||
69 | { | ||
70 | m_textureManager.RegisterRender(GetContentType(), this); | ||
71 | } | ||
72 | } | ||
73 | return m_textureManager; | ||
74 | } | ||
75 | } | ||
76 | 61 | ||
77 | private Graphics m_graph; | 62 | private Graphics m_graph; |
78 | private string m_fontName = "Arial"; | 63 | private string m_fontName = "Arial"; |
@@ -121,8 +106,13 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
121 | 106 | ||
122 | public bool AsyncConvertData(UUID id, string bodyData, string extraParams) | 107 | public bool AsyncConvertData(UUID id, string bodyData, string extraParams) |
123 | { | 108 | { |
109 | if (m_textureManager == null) | ||
110 | { | ||
111 | m_log.Warn("[VECTORRENDERMODULE]: No texture manager. Can't function"); | ||
112 | return false; | ||
113 | } | ||
124 | // XXX: This isn't actually being done asynchronously! | 114 | // XXX: This isn't actually being done asynchronously! |
125 | TextureManager.ReturnData(id, ConvertData(bodyData, extraParams)); | 115 | m_textureManager.ReturnData(id, ConvertData(bodyData, extraParams)); |
126 | 116 | ||
127 | return true; | 117 | return true; |
128 | } | 118 | } |
@@ -180,6 +170,14 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
180 | 170 | ||
181 | public void RegionLoaded(Scene scene) | 171 | public void RegionLoaded(Scene scene) |
182 | { | 172 | { |
173 | if (m_textureManager == null && m_scene == scene) | ||
174 | { | ||
175 | m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>(); | ||
176 | if (m_textureManager != null) | ||
177 | { | ||
178 | m_textureManager.RegisterRender(GetContentType(), this); | ||
179 | } | ||
180 | } | ||
183 | } | 181 | } |
184 | 182 | ||
185 | public void RemoveRegion(Scene scene) | 183 | public void RemoveRegion(Scene scene) |