activating an existing instance by typing "chromium" in a shell causes some delay (maybe 300 to 500ms)
Reported by
wanahoga...@gmail.com,
Feb 23 2017
|
|||
Issue descriptionUserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36 Steps to reproduce the problem: 1. open chromium 2. type "chromium" into a shell and compare the delay to ctrl-w in an existing window What is the expected behavior? That "chromium" in shell activates the existing process as fast as "xmessage" opens. What went wrong? - Did this work before? N/A Chrome version: 56.0.2924.87 Channel: stable OS Version: nixos Flash Version: I think that chromium is very widely used and that reopening it by shortcut (thus running chromium) is a task many people do so its worth investigating whether the "is an instance already running" check can be done before loading/linking (whatever takes that much time).
,
Feb 27 2017
Considering this as a feature request and making the status to Untriaged so that the issue would get addressed. Thank you.
,
Oct 25 2017
The following is a test script which opens a new window without the overhead loading the chromium binary, however its still slow. It looks like forwarding the arguments to the main thread is the slow down, because the printf added below appears on the console as fast as the window.
#!/bin/sh
# START to find JSON communiaction code process_singleton_posix.cc, see shell code below triggering it
# important tags to open window
# IDS_USED_EXISTING_BROWSER
# IDC_NEW_WINDOW
# using this patch and the shell script makes the line print as fast as the
# window, so I think that forwarding the args to the main thread is the slow
# down.
# diff -r ./chrome/browser/process_singleton_posix.cc /tmp/chrome-orig/chromium-61.0.3163.100/chrome/browser/process_singleton_posix.cc
# 633d632
# < printf("ProcessSingleton::LinuxWatcher::HandleMessage -> parent_->notification_callback_.Run\n");
SOCKET=~/.config/chromium/SingletonSocket
if [ -f "$SOCKET" ]; then
{
echo -e "START\0$(pwd)\0"
for arg in "$@"; do
echo -e "$arg\0"
done
} | nc -U $SOCKET
else
exec chromium "$@"
fi
,
Oct 26 2017
The following patch with previous .sh script shows the following timings
shows timings:
1509046600,4094650745 got start token
1509046600,4094829559 PostTask
1509046600,4095969200 ProcessSingleton::LinuxWatcher::HandleMessage -> parent_->notification_callback_.Run
the console message appear as fast as the window, but delayed. So I think that
reading from the
socat - UNIX-LISTEN:/tmp/p
echo x | socat - UNIX-CONNECT:/tmp/p
=> instantly shows x.
diff --git a/chrome/browser/process_singleton_posix.cc b/chrome/browser/process_singleton_posix.cc
index b8df920..cc2592f 100644
--- a/chrome/browser/process_singleton_posix.cc
+++ b/chrome/browser/process_singleton_posix.cc
@@ -101,6 +101,15 @@
#include "ui/views/linux_ui/linux_ui.h"
#endif
+
+#include <sys/time.h>
+
+double mytime(){
+ struct timeval t1;
+ gettimeofday(&t1, NULL);
+ return t1.tv_sec + ((double) t1.tv_usec) / 1e6;
+}
+
using content::BrowserThread;
namespace {
@@ -630,6 +639,7 @@ void ProcessSingleton::LinuxWatcher::HandleMessage(
DCHECK(ui_task_runner_->BelongsToCurrentThread());
DCHECK(reader);
+ printf("ProcessSingleton::LinuxWatcher::HandleMessage -> parent_->notification_callback_.Run %.10f\n", mytime());
if (parent_->notification_callback_.Run(base::CommandLine(argv),
base::FilePath(current_dir))) {
// Send back "ACK" message to prevent the client process from starting up.
@@ -690,6 +700,7 @@ void ProcessSingleton::LinuxWatcher::SocketReader::
CleanupAndDeleteSelf();
return;
}
+ printf("got start token %.10f\n", mytime());
std::string str(buf_, bytes_read_);
std::vector<std::string> tokens = base::SplitString(
@@ -713,6 +724,7 @@ void ProcessSingleton::LinuxWatcher::SocketReader::
tokens.erase(tokens.begin());
// Return to the UI thread to handle opening a new browser tab.
+ printf("PostTask %.10f\n", mytime());
ui_task_runner_->PostTask(
FROM_HERE, base::BindOnce(&ProcessSingleton::LinuxWatcher::HandleMessage,
parent_, current_dir, tokens, this));
So what is causing the delay reading from the socket?
,
Sep 13
Archiving old bugs that haven't been actively assigned in over 180 days. If you feel this issue should still be addressed, feel free to reopen it or to file a new issue. Thanks! |
|||
►
Sign in to add a comment |
|||
Comment 1 by ligim...@chromium.org
, Feb 24 2017