Merge lp:~abreu-alexandre/oxide/prevent-race-webcontents-unloads into lp:~oxide-developers/oxide/oxide.trunk

Proposed by Alexandre Abreu
Status: Merged
Merged at revision: 1069
Proposed branch: lp:~abreu-alexandre/oxide/prevent-race-webcontents-unloads
Merge into: lp:~oxide-developers/oxide/oxide.trunk
Diff against target: 54 lines (+24/-1)
2 files modified
shared/browser/media/oxide_media_web_contents_observer.h (+1/-1)
shared/browser/oxide_web_contents_unloader.cc (+23/-0)
To merge this branch: bzr merge lp:~abreu-alexandre/oxide/prevent-race-webcontents-unloads
Reviewer Review Type Date Requested Status
Chris Coulson Approve
Review via email: mp+258387@code.launchpad.net

Commit message

Prevents deadlocking the ui process during the wait for unloads phase as the browser process is exiting. The issue happens quite reliably using AP tests that basically kill the whole process group and the renderers. The RVH Close() "loop" is being triggered but the flow can fail to properly complete w/ a CloseContents() in which case the UI process deadlocks.

Description of the change

Prevents deadlocking the ui process during the wait for unloads phase as the browser process is exiting. The issue happens quite reliably using AP tests that basically kill the whole process group and the renderers. The RVH Close() "loop" is being triggered but the flow can fail to properly complete w/ a CloseContents() in which case the UI process deadlocks.

To post a comment you must log in.
1063. By Chris Coulson

Bump Chromium rev to 44.0.2391.0

Revision history for this message
Chris Coulson (chrisccoulson) wrote :

Thanks, I've added some comments inline

review: Needs Fixing
1064. By Olivier Tilloy

Add a WebView::webProcessStatus property to notify embedders when the renderer process crashed or was killed.

1065. By Chris Coulson

Add WebView.mediaAccessPermissionRequested API

1066. By Chris Coulson

Make comments more accurate

1067. By Alexandre Abreu

Merge trunk

1068. By Alexandre Abreu

Prevent unloads race when the renderer process is killed before the closecontents is called

1069. By Alexandre Abreu

clutter

1070. By Alexandre Abreu

fix build

Revision history for this message
Alexandre Abreu (abreu-alexandre) wrote :

updated

Revision history for this message
Chris Coulson (chrisccoulson) wrote :

I've added a comment inline (there's a double-free in this)

review: Needs Fixing
1071. By Alexandre Abreu

fix double free

Revision history for this message
Alexandre Abreu (abreu-alexandre) wrote :

Updated

Revision history for this message
Chris Coulson (chrisccoulson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'shared/browser/media/oxide_media_web_contents_observer.h'
2--- shared/browser/media/oxide_media_web_contents_observer.h 2015-01-19 22:49:05 +0000
3+++ shared/browser/media/oxide_media_web_contents_observer.h 2015-05-12 22:48:25 +0000
4@@ -32,7 +32,7 @@
5 content::RenderFrameHost* render_frame_host);
6
7 private:
8- typedef base::ScopedPtrHashMap<uintptr_t, BrowserMediaPlayerManager>
9+ typedef base::ScopedPtrHashMap<uintptr_t, scoped_ptr<BrowserMediaPlayerManager>>
10 MediaPlayerManagerMap;
11 MediaPlayerManagerMap media_player_managers_;
12
13
14=== modified file 'shared/browser/oxide_web_contents_unloader.cc'
15--- shared/browser/oxide_web_contents_unloader.cc 2015-05-05 17:06:48 +0000
16+++ shared/browser/oxide_web_contents_unloader.cc 2015-05-12 22:48:25 +0000
17@@ -23,7 +23,27 @@
18 #include "base/memory/singleton.h"
19 #include "base/message_loop/message_loop.h"
20 #include "base/run_loop.h"
21+#include "base/supports_user_data.h"
22 #include "content/public/browser/web_contents.h"
23+#include "content/public/browser/web_contents_observer.h"
24+
25+class WebContentsUnloaderObserver : public content::WebContentsObserver,
26+ public base::SupportsUserData::Data {
27+public:
28+ explicit WebContentsUnloaderObserver(
29+ content::WebContents* contents)
30+ : content::WebContentsObserver(contents) {}
31+ virtual ~WebContentsUnloaderObserver() {}
32+
33+ void RenderProcessGone(base::TerminationStatus status) override {
34+ web_contents()->GetDelegate()->CloseContents(web_contents());
35+ }
36+};
37+
38+namespace {
39+const char kWebContentsUnloaderObserverKey[] = "oxide_web_contents_unloader_observer_data";
40+}
41+
42
43 namespace oxide {
44
45@@ -63,6 +83,9 @@
46 }
47
48 content::WebContents* c = contents.get();
49+ c->SetUserData(
50+ kWebContentsUnloaderObserverKey,
51+ new WebContentsUnloaderObserver(c));
52
53 // So we can intercept CloseContents
54 contents->SetDelegate(this);

Subscribers

People subscribed via source and target branches