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

Side by Side Diff: content/renderer/renderer_main.cc

Issue 10071038: RefCounted types should not have public destructors, content/browser part 2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Copyright bump Created 8 years, 7 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
« no previous file with comments | « content/renderer/render_widget_fullscreen.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/base_switches.h" 5 #include "base/base_switches.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/debug/debugger.h" 7 #include "base/debug/debugger.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 NULL); 67 NULL);
68 CHECK_EQ(err_none, err); 68 CHECK_EQ(err_none, err);
69 } 69 }
70 } 70 }
71 71
72 #endif // OS_MACOSX 72 #endif // OS_MACOSX
73 73
74 #if defined(OS_POSIX) 74 #if defined(OS_POSIX)
75 75
76 class SuicideOnChannelErrorFilter : public IPC::ChannelProxy::MessageFilter { 76 class SuicideOnChannelErrorFilter : public IPC::ChannelProxy::MessageFilter {
77 void OnChannelError() { 77 public:
78 // IPC::ChannelProxy::MessageFilter
79 virtual void OnChannelError() OVERRIDE {
78 // On POSIX, at least, one can install an unload handler which loops 80 // On POSIX, at least, one can install an unload handler which loops
79 // forever and leave behind a renderer process which eats 100% CPU forever. 81 // forever and leave behind a renderer process which eats 100% CPU forever.
80 // 82 //
81 // This is because the terminate signals (ViewMsg_ShouldClose and the error 83 // This is because the terminate signals (ViewMsg_ShouldClose and the error
82 // from the IPC channel) are routed to the main message loop but never 84 // from the IPC channel) are routed to the main message loop but never
83 // processed (because that message loop is stuck in V8). 85 // processed (because that message loop is stuck in V8).
84 // 86 //
85 // One could make the browser SIGKILL the renderers, but that leaves open a 87 // One could make the browser SIGKILL the renderers, but that leaves open a
86 // large window where a browser failure (or a user, manually terminating 88 // large window where a browser failure (or a user, manually terminating
87 // the browser because "it's stuck") will leave behind a process eating all 89 // the browser because "it's stuck") will leave behind a process eating all
88 // the CPU. 90 // the CPU.
89 // 91 //
90 // So, we install a filter on the channel so that we can process this event 92 // So, we install a filter on the channel so that we can process this event
91 // here and kill the process. 93 // here and kill the process.
92 // 94 //
93 // We want to kill this process after giving it 30 seconds to run the exit 95 // We want to kill this process after giving it 30 seconds to run the exit
94 // handlers. SIGALRM has a default disposition of terminating the 96 // handlers. SIGALRM has a default disposition of terminating the
95 // application. 97 // application.
96 #if defined(OS_POSIX) 98 #if defined(OS_POSIX)
97 if (CommandLine::ForCurrentProcess()-> 99 if (CommandLine::ForCurrentProcess()->
98 HasSwitch(switches::kRendererCleanExit)) 100 HasSwitch(switches::kRendererCleanExit))
99 alarm(30); 101 alarm(30);
100 else 102 else
101 #endif 103 #endif
102 _exit(0); 104 _exit(0);
103 } 105 }
106
107 protected:
108 virtual ~SuicideOnChannelErrorFilter() {}
104 }; 109 };
105 110
106 #endif // OS(POSIX) 111 #endif // OS(POSIX)
107 112
108 } // namespace 113 } // namespace
109 114
110 // This function provides some ways to test crash and assertion handling 115 // This function provides some ways to test crash and assertion handling
111 // behavior of the renderer. 116 // behavior of the renderer.
112 static void HandleRendererErrorTestParameters(const CommandLine& command_line) { 117 static void HandleRendererErrorTestParameters(const CommandLine& command_line) {
113 if (command_line.HasSwitch(switches::kWaitForDebugger)) 118 if (command_line.HasSwitch(switches::kWaitForDebugger))
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 #endif 269 #endif
265 TRACE_EVENT_BEGIN_ETW("RendererMain.START_MSG_LOOP", 0, 0); 270 TRACE_EVENT_BEGIN_ETW("RendererMain.START_MSG_LOOP", 0, 0);
266 MessageLoop::current()->Run(); 271 MessageLoop::current()->Run();
267 TRACE_EVENT_END_ETW("RendererMain.START_MSG_LOOP", 0, 0); 272 TRACE_EVENT_END_ETW("RendererMain.START_MSG_LOOP", 0, 0);
268 } 273 }
269 } 274 }
270 platform.PlatformUninitialize(); 275 platform.PlatformUninitialize();
271 TRACE_EVENT_END_ETW("RendererMain", 0, ""); 276 TRACE_EVENT_END_ETW("RendererMain", 0, "");
272 return 0; 277 return 0;
273 } 278 }
OLDNEW
« no previous file with comments | « content/renderer/render_widget_fullscreen.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698