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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_mac.mm

Issue 1453803002: Separate RenderViewHost from RenderWidgetHost, part 10: shutdown. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/render_widget_host_view_mac.h" 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h"
6 6
7 #import <objc/runtime.h> 7 #import <objc/runtime.h>
8 #include <OpenGL/gl.h> 8 #include <OpenGL/gl.h>
9 #include <QuartzCore/QuartzCore.h> 9 #include <QuartzCore/QuartzCore.h>
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 #include "content/common/edit_command.h" 51 #include "content/common/edit_command.h"
52 #include "content/common/gpu/gpu_messages.h" 52 #include "content/common/gpu/gpu_messages.h"
53 #include "content/common/input_messages.h" 53 #include "content/common/input_messages.h"
54 #include "content/common/view_messages.h" 54 #include "content/common/view_messages.h"
55 #include "content/common/webplugin_geometry.h" 55 #include "content/common/webplugin_geometry.h"
56 #include "content/public/browser/browser_context.h" 56 #include "content/public/browser/browser_context.h"
57 #include "content/public/browser/browser_plugin_guest_manager.h" 57 #include "content/public/browser/browser_plugin_guest_manager.h"
58 #include "content/public/browser/browser_thread.h" 58 #include "content/public/browser/browser_thread.h"
59 #include "content/public/browser/native_web_keyboard_event.h" 59 #include "content/public/browser/native_web_keyboard_event.h"
60 #include "content/public/browser/notification_service.h" 60 #include "content/public/browser/notification_service.h"
61 #include "content/public/browser/notification_types.h" 61 #include "content/public/browser/notification_types.h"
ncarter (slow) 2015/11/17 22:22:55 off topic, but can we remove these #includes? I ca
Avi (use Gerrit) 2015/11/18 00:29:59 Done.
62 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" 62 #include "content/public/browser/render_widget_host_view_frame_subscriber.h"
63 #import "content/public/browser/render_widget_host_view_mac_delegate.h" 63 #import "content/public/browser/render_widget_host_view_mac_delegate.h"
64 #include "content/public/browser/web_contents.h" 64 #include "content/public/browser/web_contents.h"
65 #include "skia/ext/platform_canvas.h" 65 #include "skia/ext/platform_canvas.h"
66 #include "skia/ext/skia_utils_mac.h" 66 #include "skia/ext/skia_utils_mac.h"
67 #include "third_party/WebKit/public/platform/WebScreenInfo.h" 67 #include "third_party/WebKit/public/platform/WebScreenInfo.h"
68 #include "third_party/WebKit/public/web/WebInputEvent.h" 68 #include "third_party/WebKit/public/web/WebInputEvent.h"
69 #import "third_party/mozilla/ComplexTextInputPanel.h" 69 #import "third_party/mozilla/ComplexTextInputPanel.h"
70 #include "ui/accelerated_widget_mac/surface_handle_types.h" 70 #include "ui/accelerated_widget_mac/surface_handle_types.h"
71 #include "ui/base/cocoa/animation_utils.h" 71 #include "ui/base/cocoa/animation_utils.h"
(...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after
1048 [cocoa_view_ setMarkedRange:range.ToNSRange()]; 1048 [cocoa_view_ setMarkedRange:range.ToNSRange()];
1049 composition_range_ = range; 1049 composition_range_ = range;
1050 composition_bounds_ = character_bounds; 1050 composition_bounds_ = character_bounds;
1051 } 1051 }
1052 1052
1053 void RenderWidgetHostViewMac::RenderProcessGone(base::TerminationStatus status, 1053 void RenderWidgetHostViewMac::RenderProcessGone(base::TerminationStatus status,
1054 int error_code) { 1054 int error_code) {
1055 Destroy(); 1055 Destroy();
1056 } 1056 }
1057 1057
1058 void RenderWidgetHostViewMac::RenderWidgetHostGone() {
1059 // Clear SurfaceID namespace ownership before we shutdown the
1060 // compositor.
1061 if (UseSurfacesEnabled() && render_widget_host_ &&
1062 render_widget_host_->delegate() &&
1063 render_widget_host_->delegate()->GetInputEventRouter()) {
1064 render_widget_host_->delegate()
1065 ->GetInputEventRouter()
1066 ->RemoveSurfaceIdNamespaceOwner(GetSurfaceIdNamespace());
1067 }
1068
1069 // Destroy the DelegatedFrameHost, to prevent crashes when Destroy is never
1070 // called on the view.
1071 // http://crbug.com/404828
1072 ShutdownBrowserCompositor();
1073 }
1074
1075 void RenderWidgetHostViewMac::Destroy() { 1058 void RenderWidgetHostViewMac::Destroy() {
1076 [[NSNotificationCenter defaultCenter] 1059 [[NSNotificationCenter defaultCenter]
1077 removeObserver:cocoa_view_ 1060 removeObserver:cocoa_view_
1078 name:NSWindowWillCloseNotification 1061 name:NSWindowWillCloseNotification
1079 object:popup_window_]; 1062 object:popup_window_];
1080 1063
1081 // We've been told to destroy. 1064 // We've been told to destroy.
1082 [cocoa_view_ retain]; 1065 [cocoa_view_ retain];
1083 [cocoa_view_ removeFromSuperview]; 1066 [cocoa_view_ removeFromSuperview];
1084 [cocoa_view_ autorelease]; 1067 [cocoa_view_ autorelease];
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
1621 1604
1622 bool RenderWidgetHostViewMac::Send(IPC::Message* message) { 1605 bool RenderWidgetHostViewMac::Send(IPC::Message* message) {
1623 if (render_widget_host_) 1606 if (render_widget_host_)
1624 return render_widget_host_->Send(message); 1607 return render_widget_host_->Send(message);
1625 delete message; 1608 delete message;
1626 return false; 1609 return false;
1627 } 1610 }
1628 1611
1629 void RenderWidgetHostViewMac::ShutdownHost() { 1612 void RenderWidgetHostViewMac::ShutdownHost() {
1630 weak_factory_.InvalidateWeakPtrs(); 1613 weak_factory_.InvalidateWeakPtrs();
1631 render_widget_host_->Shutdown(); 1614 render_widget_host_->ShutdownWidget(true);
ncarter (slow) 2015/11/17 22:22:55 So what's happening here: 1. RWHV tells the widge
Avi (use Gerrit) 2015/11/18 00:29:59 Lemme work on wrapping my brain around this.
1632 // Do not touch any members at this point, |this| has been deleted. 1615 // Do not touch any members at this point, |this| has been deleted.
1633 } 1616 }
1634 1617
1635 void RenderWidgetHostViewMac::ShutdownBrowserCompositor() { 1618 void RenderWidgetHostViewMac::ShutdownBrowserCompositor() {
1636 DestroyBrowserCompositorView(); 1619 DestroyBrowserCompositorView();
1637 delegated_frame_host_.reset(); 1620 delegated_frame_host_.reset();
1638 root_layer_.reset(); 1621 root_layer_.reset();
1639 browser_compositor_placeholder_.reset(); 1622 browser_compositor_placeholder_.reset();
1640 } 1623 }
1641 1624
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
2089 2072
2090 // Force fullscreen windows to close on Escape so they won't keep the keyboard 2073 // Force fullscreen windows to close on Escape so they won't keep the keyboard
2091 // grabbed or be stuck onscreen if the renderer is hanging. 2074 // grabbed or be stuck onscreen if the renderer is hanging.
2092 if (event.type == NativeWebKeyboardEvent::RawKeyDown && 2075 if (event.type == NativeWebKeyboardEvent::RawKeyDown &&
2093 event.windowsKeyCode == ui::VKEY_ESCAPE && 2076 event.windowsKeyCode == ui::VKEY_ESCAPE &&
2094 renderWidgetHostView_->pepper_fullscreen_window()) { 2077 renderWidgetHostView_->pepper_fullscreen_window()) {
2095 RenderWidgetHostViewMac* parent = 2078 RenderWidgetHostViewMac* parent =
2096 renderWidgetHostView_->fullscreen_parent_host_view(); 2079 renderWidgetHostView_->fullscreen_parent_host_view();
2097 if (parent) 2080 if (parent)
2098 parent->cocoa_view()->suppressNextEscapeKeyUp_ = YES; 2081 parent->cocoa_view()->suppressNextEscapeKeyUp_ = YES;
2099 widgetHost->Shutdown(); 2082 widgetHost->ShutdownWidget(true);
2100 return; 2083 return;
2101 } 2084 }
2102 2085
2103 // If there are multiple widgets on the page (such as when there are 2086 // If there are multiple widgets on the page (such as when there are
2104 // out-of-process iframes), pick the one that should process this event. 2087 // out-of-process iframes), pick the one that should process this event.
2105 if (widgetHost->delegate()) { 2088 if (widgetHost->delegate()) {
2106 RenderWidgetHostImpl* focusedHost = 2089 RenderWidgetHostImpl* focusedHost =
2107 widgetHost->delegate()->GetFocusedRenderWidgetHost(); 2090 widgetHost->delegate()->GetFocusedRenderWidgetHost();
2108 if (focusedHost) 2091 if (focusedHost)
2109 widgetHost = focusedHost; 2092 widgetHost = focusedHost;
(...skipping 1331 matching lines...) Expand 10 before | Expand all | Expand 10 after
3441 3424
3442 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding 3425 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding
3443 // regions that are not draggable. (See ControlRegionView in 3426 // regions that are not draggable. (See ControlRegionView in
3444 // native_app_window_cocoa.mm). This requires the render host view to be 3427 // native_app_window_cocoa.mm). This requires the render host view to be
3445 // draggable by default. 3428 // draggable by default.
3446 - (BOOL)mouseDownCanMoveWindow { 3429 - (BOOL)mouseDownCanMoveWindow {
3447 return YES; 3430 return YES;
3448 } 3431 }
3449 3432
3450 @end 3433 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698