summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2016-09-19 16:07:03 -0700
committerCedric BAIL <cedric@osg.samsung.com>2016-09-19 16:07:03 -0700
commit0d0ca579c6697aef93e84c4b8e6993120e18614a (patch)
treef7c3425b4be1c4f83970d0de307a7f8028f87a01 /src
parent25aef34aa044503024b6b608feb87d4d4e02ff3b (diff)
elementary: be more conservative on the amount of data requested from disk.
Diffstat (limited to 'src')
-rw-r--r--src/lib/elementary/efl_ui_image.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/lib/elementary/efl_ui_image.c b/src/lib/elementary/efl_ui_image.c
index 3a28ee4fa9..d4370b6045 100644
--- a/src/lib/elementary/efl_ui_image.c
+++ b/src/lib/elementary/efl_ui_image.c
@@ -249,7 +249,6 @@ _efl_ui_image_async_open_do(void *data, Ecore_Thread *thread)
249 Async_Open_Data *todo = data; 249 Async_Open_Data *todo = data;
250 Eina_File *f; 250 Eina_File *f;
251 void *map = NULL; 251 void *map = NULL;
252 unsigned char *p, sum = 0;
253 size_t i, size; 252 size_t i, size;
254 253
255 if (ecore_thread_check(thread)) return; 254 if (ecore_thread_check(thread)) return;
@@ -273,17 +272,13 @@ _efl_ui_image_async_open_do(void *data, Ecore_Thread *thread)
273 } 272 }
274 273
275 // Read just enough data for map to actually do something. 274 // Read just enough data for map to actually do something.
276 p = map = eina_file_map_all(f, EINA_FILE_SEQUENTIAL);
277 size = eina_file_size_get(f); 275 size = eina_file_size_get(f);
278 // Read and ensure all pages are in memory for sure first just 276 // Read and ensure all pages are in memory for sure first just
279 // 1 byte per page will do. also keep a limit on how much we will 277 // 1 byte per page will do. also keep a limit on how much we will
280 // blindly load in here to let's say 512M 278 // blindly load in here to let's say 32KB (Should be enough to get
281 if (size > (512 * 1024 * 1024)) size = 512 * 1024 * 1024; 279 // image headers without getting to much data from the hard drive).
282 for (i = 0; i < size; i += 4096) 280 size = size > 32 * 1024 ? 32 * 1024 : size;
283 { 281 map = eina_file_map_new(f, EINA_FILE_POPULATE, 0, size);
284 if (ecore_thread_check(thread)) break;
285 sum += p[i];
286 }
287 282
288 if (ecore_thread_check(thread)) 283 if (ecore_thread_check(thread))
289 { 284 {