Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(809)

Unified Diff: content/browser/android/content_view_statics.cc

Issue 179123002: Fix bug causing blank pages on resume of Chrome for Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: reitveld Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/android/content_view_statics.cc
diff --git a/content/browser/android/content_view_statics.cc b/content/browser/android/content_view_statics.cc
index e176564c4a0f5a430aad40adaddc2d7aef806c05..cafcd606194f7593c05e611e23ebc3dbf9d49b3c 100644
--- a/content/browser/android/content_view_statics.cc
+++ b/content/browser/android/content_view_statics.cc
@@ -15,6 +15,7 @@
#include "content/common/android/address_parser.h"
#include "content/common/view_messages.h"
#include "content/public/browser/render_process_host.h"
+#include "content/public/browser/render_process_host_observer.h"
#include "jni/ContentViewStatics_jni.h"
using base::android::ConvertJavaStringToUTF16;
@@ -37,6 +38,28 @@ namespace {
base::LazyInstance<std::vector<int /* process id */> > g_suspended_processes =
Philippe 2014/02/25 09:41:12 Nit: s/process id/RPH ID (see my comment below).
Yaron 2014/02/25 18:14:48 Done.
LAZY_INSTANCE_INITIALIZER;
+// Listens for RenderProcessHosts who's renderers have crashed. This is
Philippe 2014/02/25 09:41:12 You mean in your CL description that the same Rend
Philippe 2014/02/25 09:41:12 Nit: s/who's/whose I believe although my knowledge
Yaron 2014/02/25 18:14:48 Done.
Yaron 2014/02/25 18:14:48 It's not actually the renderer process pid. It's j
+// necessary to ensure that we don't over-resume a RenderProcess as described
+// above.
+class SuspendedProcessWatcher : public content::RenderProcessHostObserver {
+ virtual void RenderProcessExited(content::RenderProcessHost* host,
+ base::ProcessHandle handle,
Philippe 2014/02/25 09:41:12 Nit: extra leading space here and on the two lines
Yaron 2014/02/25 18:14:48 Done.
+ base::TerminationStatus status,
+ int exit_code) OVERRIDE {
+ std::vector<int>* suspended_processes = g_suspended_processes.Pointer();
+ std::vector<int>::iterator pos = std::find(suspended_processes->begin(),
+ suspended_processes->end(),
+ host->GetID());
+ if (pos != suspended_processes->end()) {
+ host->RemoveObserver(this);
+ suspended_processes->erase(pos);
+ }
+ }
+};
+
+base::LazyInstance<SuspendedProcessWatcher > g_suspended_processes_watcher =
Philippe 2014/02/25 09:41:12 Nit: extra space before '>'.
Yaron 2014/02/25 18:14:48 Done.
+ LAZY_INSTANCE_INITIALIZER;
+
// Suspends timers in all current render processes.
void SuspendWebKitSharedTimers(std::vector<int>* suspended_processes) {
for (content::RenderProcessHost::iterator i(
@@ -45,6 +68,7 @@ void SuspendWebKitSharedTimers(std::vector<int>* suspended_processes) {
content::RenderProcessHost* host = i.GetCurrentValue();
suspended_processes->push_back(host->GetID());
host->Send(new ViewMsg_SetWebKitSharedTimersSuspended(true));
+ host->AddObserver(g_suspended_processes_watcher.Pointer());
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698