[smuxi] Frontend: moved private methods into worker dispatch context as they won't be reused
- From: Mirco M. M. Bauer <mmmbauer src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [smuxi] Frontend: moved private methods into worker dispatch context as they won't be reused
- Date: Thu, 21 Aug 2014 18:43:23 +0000 (UTC)
commit eadcf35d829cf7610a4c31613f1c9e7b202789ae
Author: Mirco Bauer <meebey meebey net>
Date: Sun Jul 20 21:26:20 2014 +0200
Frontend: moved private methods into worker dispatch context as they won't be reused
src/Frontend/ChatViewSyncManager.cs | 126 +++++++++++++---------------------
1 files changed, 48 insertions(+), 78 deletions(-)
---
diff --git a/src/Frontend/ChatViewSyncManager.cs b/src/Frontend/ChatViewSyncManager.cs
index 2aae035..3f5ef9a 100644
--- a/src/Frontend/ChatViewSyncManager.cs
+++ b/src/Frontend/ChatViewSyncManager.cs
@@ -375,7 +375,14 @@ namespace Smuxi.Frontend
var chat = GetOrCreateChat(chatModel);
WorkerQueue.Enqueue(delegate {
- AddWorker(chat);
+ try {
+ chat.ExecuteAdd();
+ } catch (InvalidStateException ex) {
+#if LOG4NET
+ Logger.Error("QueueAdd(): ExecuteAdd() threw exception!" , ex);
+#endif
+ OnWorkerException(chat.ChatModel, ex);
+ }
});
}
@@ -396,7 +403,14 @@ namespace Smuxi.Frontend
return;
}
WorkerQueue.Enqueue(delegate {
- RemoveWorker(chat);
+ try {
+ chat.ExecuteRemove();
+ } catch (InvalidStateException ex) {
+#if LOG4NET
+ Logger.Error("QueueRemove(): ExecuteRemove() threw exception!" , ex);
+#endif
+ OnWorkerException(chat.ChatModel, ex);
+ }
});
}
@@ -418,7 +432,14 @@ namespace Smuxi.Frontend
}
WorkerQueue.Enqueue(delegate {
- RemoveFinishedWorker(chat);
+ try {
+ chat.ExecuteRemoveFinished();
+ } catch (InvalidStateException ex) {
+#if LOG4NET
+ Logger.Error("QueueRemoveFinished(): ExecuteRemoveFinished() threw exception!" , ex);
+#endif
+ OnWorkerException(chat.ChatModel, ex);
+ }
});
}
@@ -464,7 +485,14 @@ namespace Smuxi.Frontend
}
WorkerQueue.Enqueue(delegate {
- SyncWorker(chat);
+ try {
+ chat.ExecuteSync();
+ } catch (InvalidStateException ex) {
+#if LOG4NET
+ Logger.Error("QueueSync(): ExecuteSync() threw exception!" , ex);
+#endif
+ OnWorkerException(chat.ChatModel, ex);
+ }
});
}
@@ -490,7 +518,14 @@ namespace Smuxi.Frontend
chat.ChatView = chatView;
WorkerQueue.Enqueue(delegate {
- ReadyToSyncWorker(chat);
+ try {
+ chat.ExecuteReadyToSync();
+ } catch (InvalidStateException ex) {
+#if LOG4NET
+ Logger.Error("ReadyToSyncWorker(): ExecuteReadyToSync() threw exception!" , ex);
+#endif
+ OnWorkerException(chat.ChatModel, ex);
+ }
});
}
@@ -512,7 +547,14 @@ namespace Smuxi.Frontend
}
WorkerQueue.Enqueue(delegate {
- SyncFinishedWorker(chat);
+ try {
+ chat.ExecuteSyncFinished();
+ } catch (Exception ex) {
+#if LOG4NET
+ Logger.Error("SyncFinishedWorker(): ExecuteSyncFinished() threw exception!" , ex);
+#endif
+ OnWorkerException(chat.ChatModel, ex);
+ }
});
}
@@ -531,78 +573,6 @@ namespace Smuxi.Frontend
return chatModel;
}
- void AddWorker(SyncInfo chat)
- {
- try {
- chat.ExecuteAdd();
- } catch(InvalidStateException ex) {
-#if LOG4NET
- Logger.Error("AddWorker(): ExecuteAdd() threw exception!" , ex);
-#endif
- OnWorkerException(chat.ChatModel, ex);
- }
- }
-
- void SyncWorker(SyncInfo chat)
- {
- try {
- chat.ExecuteSync();
- } catch(InvalidStateException ex) {
-#if LOG4NET
- Logger.Error("SyncWorker(): ExecuteSync() threw exception!" , ex);
-#endif
- OnWorkerException(chat.ChatModel, ex);
- }
- }
-
- void ReadyToSyncWorker(SyncInfo chat)
- {
- try {
- chat.ExecuteReadyToSync();
- } catch(InvalidStateException ex) {
-#if LOG4NET
- Logger.Error("ReadyToSyncWorker(): ExecuteReadyToSync() threw exception!" , ex);
-#endif
- OnWorkerException(chat.ChatModel, ex);
- }
- }
-
- void SyncFinishedWorker(SyncInfo chat)
- {
- try {
- chat.ExecuteSyncFinished();
- } catch(InvalidStateException ex) {
-#if LOG4NET
- Logger.Error("SyncFinishedWorker(): ExecuteSyncFinished() threw exception!" , ex);
-#endif
- OnWorkerException(chat.ChatModel, ex);
- }
- }
-
- void RemoveWorker(SyncInfo chat)
- {
- try {
- chat.ExecuteRemove();
- } catch(InvalidStateException ex) {
-#if LOG4NET
- Logger.Error("RemoveWorker(): ExecuteRemove() threw exception!" , ex);
-#endif
- OnWorkerException(chat.ChatModel, ex);
- }
- }
-
- void RemoveFinishedWorker(SyncInfo chat)
- {
- try {
- chat.ExecuteRemoveFinished();
- } catch(InvalidStateException ex) {
-#if LOG4NET
- Logger.Error("RemoveWorker(): ExecuteRemove() threw exception!" , ex);
-#endif
- OnWorkerException(chat.ChatModel, ex);
- }
- }
-
void OnChatAdded(ChatModel chatModel, string chatId,
ChatType chatType, int chatPosition,
IProtocolManager protocolManager,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]