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

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

Issue 6076005: Mac: Don't hang gpu process on popup close under certain conditions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome
Patch Set: final touches Created 9 years, 12 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <QuartzCore/QuartzCore.h> 5 #include <QuartzCore/QuartzCore.h>
6 6
7 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" 7 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h"
8 8
9 #include "app/app_switches.h" 9 #include "app/app_switches.h"
10 #include "app/surface/io_surface_support_mac.h" 10 #include "app/surface/io_surface_support_mac.h"
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 return; 941 return;
942 } 942 }
943 [it->second removeFromSuperview]; 943 [it->second removeFromSuperview];
944 plugin_views_.erase(it); 944 plugin_views_.erase(it);
945 945
946 // The view's dealloc will call DeallocFakePluginWindowHandle(), which will 946 // The view's dealloc will call DeallocFakePluginWindowHandle(), which will
947 // remove the handle from |plugin_container_manager_|. This code path is 947 // remove the handle from |plugin_container_manager_|. This code path is
948 // taken if a plugin is removed, but the RWHVMac itself stays alive. 948 // taken if a plugin is removed, but the RWHVMac itself stays alive.
949 } 949 }
950 950
951 namespace {
952 class DidDestroySurfaceSender : public Task {
953 public:
954 DidDestroySurfaceSender(
955 int renderer_id,
956 int32 renderer_route_id)
957 : renderer_id_(renderer_id),
958 renderer_route_id_(renderer_route_id) {
959 }
960
961 void Run() {
962 GpuProcessHost::Get()->Send(
963 new GpuMsg_DidDestroySurface(
964 renderer_id_, renderer_route_id_));
965 }
966
967 private:
968 int renderer_id_;
969 int32 renderer_route_id_;
970
971 DISALLOW_COPY_AND_ASSIGN(DidDestroySurfaceSender);
972 };
973 } // anonymous namespace
974
951 // This is called by AcceleratedPluginView's -dealloc. 975 // This is called by AcceleratedPluginView's -dealloc.
952 void RenderWidgetHostViewMac::DeallocFakePluginWindowHandle( 976 void RenderWidgetHostViewMac::DeallocFakePluginWindowHandle(
953 gfx::PluginWindowHandle window) { 977 gfx::PluginWindowHandle window) {
978 // When a browser window with a GPUProcessor is closed, the render process
979 // will attempt to finish all GL commands. It will busy-wait on the GPU
980 // process until the command queue is empty. If a paint is pending, the GPU
981 // process won't process any GL commands until the browser sends a paint ack,
982 // but since the browser window is already closed, it will never arrive.
983 // To break this infinite loop, the browser tells the GPU process that the
984 // surface became invalid, which causes the GPU process to not wait for paint
985 // acks.
986 if (render_widget_host_ &&
987 plugin_container_manager_.IsRootContainer(window)) {
988 BrowserThread::PostTask(
989 BrowserThread::IO, FROM_HERE,
990 new DidDestroySurfaceSender(
991 render_widget_host_->process()->id(),
992 render_widget_host_->routing_id()));
993 }
994
954 plugin_container_manager_.DestroyFakePluginWindowHandle(window); 995 plugin_container_manager_.DestroyFakePluginWindowHandle(window);
955 } 996 }
956 997
957 AcceleratedPluginView* RenderWidgetHostViewMac::ViewForPluginWindowHandle( 998 AcceleratedPluginView* RenderWidgetHostViewMac::ViewForPluginWindowHandle(
958 gfx::PluginWindowHandle window) { 999 gfx::PluginWindowHandle window) {
959 PluginViewMap::iterator it = plugin_views_.find(window); 1000 PluginViewMap::iterator it = plugin_views_.find(window);
960 DCHECK(plugin_views_.end() != it); 1001 DCHECK(plugin_views_.end() != it);
961 if (plugin_views_.end() == it) 1002 if (plugin_views_.end() == it)
962 return nil; 1003 return nil;
963 return it->second; 1004 return it->second;
(...skipping 1715 matching lines...) Expand 10 before | Expand all | Expand 10 after
2679 if (!string) return NO; 2720 if (!string) return NO;
2680 2721
2681 // If the user is currently using an IME, confirm the IME input, 2722 // If the user is currently using an IME, confirm the IME input,
2682 // and then insert the text from the service, the same as TextEdit and Safari. 2723 // and then insert the text from the service, the same as TextEdit and Safari.
2683 [self confirmComposition]; 2724 [self confirmComposition];
2684 [self insertText:string]; 2725 [self insertText:string];
2685 return YES; 2726 return YES;
2686 } 2727 }
2687 2728
2688 @end 2729 @end
OLDNEW
« no previous file with comments | « no previous file | chrome/common/gpu_messages_internal.h » ('j') | chrome/common/gpu_messages_internal.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698