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

Unified Diff: chrome/browser/extensions/extension_view.cc

Issue 126289: Graceful handling of extension process crashes (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 6 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 | « chrome/browser/extensions/extension_view.h ('k') | chrome/browser/task_manager_resource_providers.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_view.cc
===================================================================
--- chrome/browser/extensions/extension_view.cc (revision 18701)
+++ chrome/browser/extensions/extension_view.cc (working copy)
@@ -19,8 +19,7 @@
}
ExtensionView::~ExtensionView() {
- if (native_view())
- Detach();
+ CleanUp();
}
Extension* ExtensionView::extension() const {
@@ -56,6 +55,37 @@
render_view_host()->view()->SetSize(gfx::Size(width(), height()));
}
+void ExtensionView::CreateWidgetHostView() {
+ DCHECK(!initialized_);
+ initialized_ = true;
+ RenderWidgetHostView* view =
+ RenderWidgetHostView::CreateViewForWidget(render_view_host());
+
+ // TODO(mpcomplete): RWHV needs a cross-platform Init function.
+#if defined(OS_WIN)
+ // Create the HWND. Note:
+ // RenderWidgetHostHWND supports windowed plugins, but if we ever also
+ // wanted to support constrained windows with this, we would need an
+ // additional HWND to parent off of because windowed plugin HWNDs cannot
+ // exist in the same z-order as constrained windows.
+ RenderWidgetHostViewWin* view_win =
+ static_cast<RenderWidgetHostViewWin*>(view);
+ HWND hwnd = view_win->Create(GetWidget()->GetNativeView());
+ view_win->ShowWindow(SW_SHOW);
+ Attach(hwnd);
+#else
+ NOTIMPLEMENTED();
+#endif
+
+ host_->CreateRenderView(view);
+ SetVisible(false);
+
+ if (!pending_background_.empty()) {
+ render_view_host()->view()->SetBackground(pending_background_);
+ pending_background_.reset();
+ }
+}
+
void ExtensionView::ShowIfCompletelyLoaded() {
// We wait to show the ExtensionView until it has loaded and our parent has
// given us a background. These can happen in different orders.
@@ -66,6 +96,14 @@
}
}
+void ExtensionView::CleanUp() {
+ if (!initialized_)
+ return;
+ if (native_view())
+ Detach();
+ initialized_ = false;
+}
+
void ExtensionView::SetBackground(const SkBitmap& background) {
if (initialized_ && render_view_host()->view()) {
render_view_host()->view()->SetBackground(background);
@@ -89,35 +127,13 @@
views::View *parent,
views::View *child) {
NativeViewHost::ViewHierarchyChanged(is_add, parent, child);
- if (is_add && GetWidget() && !initialized_) {
- initialized_ = true;
- RenderWidgetHostView* view =
- RenderWidgetHostView::CreateViewForWidget(render_view_host());
+ if (is_add && GetWidget() && !initialized_)
+ CreateWidgetHostView();
+}
- // TODO(mpcomplete): RWHV needs a cross-platform Init function.
-#if defined(OS_WIN)
- // Create the HWND. Note:
- // RenderWidgetHostHWND supports windowed plugins, but if we ever also
- // wanted to support constrained windows with this, we would need an
- // additional HWND to parent off of because windowed plugin HWNDs cannot
- // exist in the same z-order as constrained windows.
- RenderWidgetHostViewWin* view_win =
- static_cast<RenderWidgetHostViewWin*>(view);
- HWND hwnd = view_win->Create(GetWidget()->GetNativeView());
- view_win->ShowWindow(SW_SHOW);
- Attach(hwnd);
-#else
- NOTIMPLEMENTED();
-#endif
-
- host_->CreateRenderView(view);
- SetVisible(false);
-
- if (!pending_background_.empty()) {
- render_view_host()->view()->SetBackground(pending_background_);
- pending_background_.reset();
- }
- }
+void ExtensionView::RecoverCrashedExtension() {
+ CleanUp();
+ CreateWidgetHostView();
}
void ExtensionView::HandleMouseEvent() {
« no previous file with comments | « chrome/browser/extensions/extension_view.h ('k') | chrome/browser/task_manager_resource_providers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698