nautilus r14851 - in trunk: . libnautilus-private
- From: alexl svn gnome org
- To: svn-commits-list gnome org
- Subject: nautilus r14851 - in trunk: . libnautilus-private
- Date: Tue, 13 Jan 2009 12:52:57 +0000 (UTC)
Author: alexl
Date: Tue Jan 13 12:52:57 2009
New Revision: 14851
URL: http://svn.gnome.org/viewvc/nautilus?rev=14851&view=rev
Log:
2009-01-13 Alexander Larsson <alexl redhat com>
* libnautilus-private/nautilus-directory-async.c:
* libnautilus-private/nautilus-directory-private.h:
Use the monitor and call_when_ready counts to avoid
iterating over the potentially long lists.
Modified:
trunk/ChangeLog
trunk/libnautilus-private/nautilus-directory-async.c
trunk/libnautilus-private/nautilus-directory-private.h
Modified: trunk/libnautilus-private/nautilus-directory-async.c
==============================================================================
--- trunk/libnautilus-private/nautilus-directory-async.c (original)
+++ trunk/libnautilus-private/nautilus-directory-async.c Tue Jan 13 12:52:57 2009
@@ -1122,23 +1122,13 @@
static gboolean
is_anyone_waiting_for_metafile (NautilusDirectory *directory)
{
- GList *node;
- ReadyCallback *callback;
- Monitor *monitor;
-
- for (node = directory->details->call_when_ready_list; node != NULL; node = node->next) {
- callback = node->data;
- if (REQUEST_WANTS_TYPE (callback->request, REQUEST_METAFILE)) {
- return TRUE;
- }
+ if (directory->details->call_when_ready_counters[REQUEST_METAFILE] > 0) {
+ return TRUE;
}
- for (node = directory->details->monitor_list; node != NULL; node = node->next) {
- monitor = node->data;
- if (REQUEST_WANTS_TYPE (monitor->request, REQUEST_METAFILE)) {
- return TRUE;
- }
- }
+ if (directory->details->monitor_counters[REQUEST_METAFILE] > 0) {
+ return TRUE;
+ }
return FALSE;
}
@@ -2002,24 +1992,12 @@
gboolean
nautilus_directory_is_anyone_monitoring_file_list (NautilusDirectory *directory)
{
- GList *node;
- ReadyCallback *callback;
- Monitor *monitor;
-
- for (node = directory->details->call_when_ready_list;
- node != NULL; node = node->next) {
- callback = node->data;
- if (REQUEST_WANTS_TYPE (callback->request, REQUEST_FILE_LIST)) {
- return TRUE;
- }
+ if (directory->details->call_when_ready_counters[REQUEST_FILE_LIST] > 0) {
+ return TRUE;
}
- for (node = directory->details->monitor_list;
- node != NULL; node = node->next) {
- monitor = node->data;
- if (REQUEST_WANTS_TYPE (monitor->request, REQUEST_FILE_LIST)) {
- return TRUE;
- }
+ if (directory->details->monitor_counters[REQUEST_FILE_LIST] > 0) {
+ return TRUE;
}
return FALSE;
@@ -2421,26 +2399,31 @@
}
directory = file->details->directory;
- for (node = directory->details->call_when_ready_list;
- node != NULL; node = node->next) {
- callback = node->data;
- if (callback->active &&
- REQUEST_WANTS_TYPE (callback->request, request_type_wanted)) {
- if (callback->file == file) {
- return TRUE;
- }
- if (callback->file == NULL
- && file != directory->details->as_file) {
- return TRUE;
+ if (directory->details->call_when_ready_counters[request_type_wanted] > 0) {
+ for (node = directory->details->call_when_ready_list;
+ node != NULL; node = node->next) {
+ callback = node->data;
+ if (callback->active &&
+ REQUEST_WANTS_TYPE (callback->request, request_type_wanted)) {
+ if (callback->file == file) {
+ return TRUE;
+ }
+ if (callback->file == NULL
+ && file != directory->details->as_file) {
+ return TRUE;
+ }
}
}
}
- for (node = directory->details->monitor_list;
- node != NULL; node = node->next) {
- monitor = node->data;
- if (REQUEST_WANTS_TYPE (monitor->request, request_type_wanted)) {
- if (monitor_includes_file (monitor, file)) {
- return TRUE;
+
+ if (directory->details->monitor_counters[request_type_wanted] > 0) {
+ for (node = directory->details->monitor_list;
+ node != NULL; node = node->next) {
+ monitor = node->data;
+ if (REQUEST_WANTS_TYPE (monitor->request, request_type_wanted)) {
+ if (monitor_includes_file (monitor, file)) {
+ return TRUE;
+ }
}
}
}
Modified: trunk/libnautilus-private/nautilus-directory-private.h
==============================================================================
--- trunk/libnautilus-private/nautilus-directory-private.h (original)
+++ trunk/libnautilus-private/nautilus-directory-private.h Tue Jan 13 12:52:57 2009
@@ -65,7 +65,7 @@
/* A request for information about one or more files. */
typedef guint32 Request;
-typedef guint32 RequestCounter[REQUEST_TYPE_LAST];
+typedef gint32 RequestCounter[REQUEST_TYPE_LAST];
#define REQUEST_WANTS_TYPE(request, type) ((request) & (1<<(type)))
#define REQUEST_SET_TYPE(request, type) (request) |= (1<<(type))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]