summaryrefslogtreecommitdiffstats
path: root/ash/screensaver
diff options
context:
space:
mode:
authorrkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-15 08:41:16 +0000
committerrkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-15 08:41:16 +0000
commit260e1fed4a30ed96453d0fca42bcc2a72468abc2 (patch)
tree01d1de94342510d8d2b0a865455d8240ff05dcc3 /ash/screensaver
parentdba0f35bf12406ac6b5df3d50d2768cc77fad66d (diff)
downloadchromium_src-260e1fed4a30ed96453d0fca42bcc2a72468abc2.zip
chromium_src-260e1fed4a30ed96453d0fca42bcc2a72468abc2.tar.gz
chromium_src-260e1fed4a30ed96453d0fca42bcc2a72468abc2.tar.bz2
Limit the number of the times the screensaver restarts.
In case the screensaver crashes/terminates, restart it only up to the second time. If a third termination occurs, simply close the screensaver. R=sky@chromium.org BUG=132918 TEST=Verified manually that the screensaver restarts the first two times that the screensaver renderer is terminated; the third time the screensaver window closes. Review URL: https://chromiumcodereview.appspot.com/10542173 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142359 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/screensaver')
-rw-r--r--ash/screensaver/screensaver_view.cc22
-rw-r--r--ash/screensaver/screensaver_view.h4
2 files changed, 22 insertions, 4 deletions
diff --git a/ash/screensaver/screensaver_view.cc b/ash/screensaver/screensaver_view.cc
index f8a3bd3..39eb8fb 100644
--- a/ash/screensaver/screensaver_view.cc
+++ b/ash/screensaver/screensaver_view.cc
@@ -22,6 +22,10 @@ namespace {
ash::internal::ScreensaverView* g_instance = NULL;
+// Do not restart the screensaver again if it has
+// terminated kMaxTerminations times already.
+const int kMaxTerminations = 3;
+
} // namespace
namespace ash {
@@ -62,16 +66,26 @@ views::View* ScreensaverView::GetContentsView() {
// ScreensaverView, content::WebContentsObserver implementation.
void ScreensaverView::RenderViewGone(
base::TerminationStatus status) {
- LOG(ERROR) << "Screensaver terminated with status " << status
- << ", reloading.";
- // Reload the screensaver url into the webcontents.
- LoadScreensaver();
+ LOG(ERROR) << "Screensaver terminated with status " << status;
+ termination_count_++;
+
+ if (termination_count_ < kMaxTerminations) {
+ LOG(ERROR) << termination_count_
+ << " terminations is under the threshold of "
+ << kMaxTerminations
+ << "; reloading Screensaver.";
+ LoadScreensaver();
+ } else {
+ LOG(ERROR) << "Exceeded termination threshold, closing Screensaver.";
+ ScreensaverView::CloseScreensaver();
+ }
}
////////////////////////////////////////////////////////////////////////////////
// ScreensaverView private methods.
ScreensaverView::ScreensaverView(const GURL& url)
: url_(url),
+ termination_count_(0),
screensaver_webview_(NULL),
container_window_(NULL) {
}
diff --git a/ash/screensaver/screensaver_view.h b/ash/screensaver/screensaver_view.h
index 541a254..6092e50 100644
--- a/ash/screensaver/screensaver_view.h
+++ b/ash/screensaver/screensaver_view.h
@@ -72,6 +72,10 @@ class ScreensaverView : public views::WidgetDelegateView,
// URL to show in the screensaver.
GURL url_;
+ // Number of times the screensaver has been terminated (usually this will be
+ // synonymous with the number of times it has crashed).
+ int termination_count_;
+
// Host for the extension that implements this dialog.
views::WebView* screensaver_webview_;