[smuxi: 174/179] Frontend: add remoting call and optimization comments in CommandManager



commit 9637f8209b327eeec9eb35eeac14ed88713d8838
Author: Mirco Bauer <meebey meebey net>
Date:   Sat Oct 7 11:20:47 2017 +0800

    Frontend: add remoting call and optimization comments in CommandManager

 src/Frontend/CommandManager.cs |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/src/Frontend/CommandManager.cs b/src/Frontend/CommandManager.cs
index de83abe..0577f2b 100644
--- a/src/Frontend/CommandManager.cs
+++ b/src/Frontend/CommandManager.cs
@@ -162,33 +162,43 @@ namespace Smuxi.Frontend
             DateTime start, stop;
             start = DateTime.UtcNow;
 
+            // REMOTING CALL
             handled = f_Session.Command(cmd);
             IProtocolManager pm = null;
             if (!handled) {
                 if (cmd.Chat is SessionChatModel && cmd.FrontendManager != null) {
+                    // REMOTING CALL
                     pm = cmd.FrontendManager.CurrentProtocolManager;
                 } else {
+                    // REMOTING CALL
                     pm = cmd.Chat.ProtocolManager;
                 }
 
                 // we maybe have no network manager yet
                 if (pm != null) {
+                    // REMOTING CALL
                     handled = pm.Command(cmd);
                 } else {
                     handled = false;
                 }
             }
             if (!handled) {
+                // OPT TODO: the remoting calls in this code branch should be
+                // avoided by checking if there are any frontend commands hooks
+                // available or not
                 var filteredCmd = IOSecurity.GetFilteredPath(cmd.Command);
                 var hooks = new HookRunner("frontend", "command-manager",
                                            "command-" + filteredCmd);
                 hooks.EnvironmentVariables.Add("FRONTEND_VERSION", FrontendVersion);
                 hooks.Environments.Add(new CommandHookEnvironment(cmd));
+                // 3 REMOTING CALLS inside the ctor
                 hooks.Environments.Add(new ChatHookEnvironment(cmd.Chat));
                 if (pm != null) {
+                    // 6-7 REMOTING CALLS inside the ctor
                     hooks.Environments.Add(new ProtocolManagerHookEnvironment(pm));
                 }
 
+                // REMOTING CALL
                 var cmdChar = (string) f_Session.UserConfig["Interface/Entry/CommandCharacter"];
                 hooks.Commands.Add(new SessionHookCommand(f_Session, cmd.Chat, cmdChar));
                 if (pm != null) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]