Closed Bug 517963 Opened 15 years ago Closed 15 years ago

New-tab opening should not synclaunch the content process

Categories

(Core :: IPC, defect)

Other Branch
x86
Windows NT
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: benjamin, Assigned: jdm)

References

Details

Attachments

(1 file, 5 obsolete files)

Currently opening an IPC-bound tab synchronously waits for the content process to launch. This is unacceptable and needs to be fixed to be asynchronous.
As far as I can tell this patch makes the content process launch asynchronously.  The test shell works fine, and the main browser now crashes and burns with warnings about no docshells for remote frames.
Assignee: nobody → josh
The previous comment is misleading; the main browser was already crashing and burning without this patch.  That behaviour has not changed.
Attachment #409087 - Flags: review?(benjamin)
Comment on attachment 409087 [details] [diff] [review]
First pass at making content process launch async

>diff --git a/dom/ipc/ContentProcessParent.cpp b/dom/ipc/ContentProcessParent.cpp

>@@ -141,7 +140,7 @@
>     mSubprocess = nsnull;
>     mon.Notify();
> }
>-
>+    

nit, extraneous whitespace.

>diff --git a/ipc/glue/GeckoChildProcessHost.cpp b/ipc/glue/GeckoChildProcessHost.cpp

>+    MessageLoop* ioLoop = 
>+        BrowserProcessSubThread::GetMessageLoop(BrowserProcessSubThread::IO);
>+    ioLoop->PostTask(FROM_HERE,
>+                    NewRunnableMethod(this,
>+                                      &GeckoChildProcessHost::InitializeChannel));

nit, indent doesn't line up

>@@ -71,16 +78,13 @@
> {
>   MessageLoop* loop = MessageLoop::current();
>   MessageLoop* ioLoop = 
>-    BrowserProcessSubThread::GetMessageLoop(BrowserProcessSubThread::IO);
>+      BrowserProcessSubThread::GetMessageLoop(BrowserProcessSubThread::IO);
>   NS_ASSERTION(loop != ioLoop, "sync launch from the IO thread NYI");
>-
>+    

nit, whitespace and this reindent is incorrect

Please attach a patch with nits fixed and request review from cjones: I don't know the chromium+glue code enough to review this for content.
Attachment #409087 - Flags: review?(benjamin)
Attached patch Same patch with nits addressed (obsolete) — Splinter Review
Nits addressed.
Attachment #409087 - Attachment is obsolete: true
Attachment #409962 - Flags: review?
Attachment #409962 - Flags: review? → review?(jones.chris.g)
Attachment #409962 - Flags: review?(jones.chris.g) → review+
Comment on attachment 409962 [details] [diff] [review]
Same patch with nits addressed

diff --git a/ipc/glue/GeckoChildProcessHost.cpp b/ipc/glue/GeckoChildProcessHost.cpp
--- a/ipc/glue/GeckoChildProcessHost.cpp
+++ b/ipc/glue/GeckoChildProcessHost.cpp
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 /* ***** BEGIN LICENSE BLOCK *****
  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  *
@@ -61,3 +62,4 @@
     mProcessType(aProcessType),
     mMonitor("mozilla.ipc.GeckChildProcessHost.mMonitor"),
     mLaunched(false),
+    mInitialized(false),

Nit: I'd prefer this be called |mChannelInitialized|.  |mInitialized| sounds like "subprocess initialized", which it isn't.

@@ -92,3 +99,17 @@
 bool
 GeckoChildProcessHost::AsyncLaunch(std::vector<std::wstring> aExtraOpts)
 {
+  MessageLoop* ioLoop = 
+    BrowserProcessSubThread::GetMessageLoop(BrowserProcessSubThread::IO);
+  ioLoop->PostTask(FROM_HERE,
+                   NewRunnableMethod(this,
+                                     &GeckoChildProcessHost::PerformAsyncLaunch,
+                                     aExtraOpts));
+
+  // This may look like the sync launch wait, but we only delay as
+  // long as it takes to create the channel.
+  MonitorAutoEnter mon(mMonitor);
+  while (!mInitialized) {
+    mon.Wait();
+  }
+

Clever, nicely done.

I think it might be worthwhile to add a comment here (or in PerformAsyncLaunch()) noting that this code relies on InitializeChannel() and PerformAsyncLaunch() being processed in that order, by the IO thread.  It would help future maintainers of the code get up to speed faster.
Attached patch Same patch + rename and comment (obsolete) — Splinter Review
Nits addressed, comment added.  I'm assuming the review carries over?
Attachment #409962 - Attachment is obsolete: true
Attached patch Same patch + missing change (obsolete) — Splinter Review
Just kidding, this is the actual changed patch.  Silly hg qrefresh.
Attachment #410696 - Attachment is obsolete: true
Attached patch Same patch unbitrotted (obsolete) — Splinter Review
And it's already bitrotted.  That was fast.
Attachment #410697 - Attachment is obsolete: true
Can somebody with commit access push this?
Unbitrotted once again.
Attachment #410729 - Attachment is obsolete: true
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Version: unspecified → Other Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: