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

Side by Side Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 10702048: Remove the code to wait on disconnected child processes to get the exit code. This was done in r101… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 5 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) 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 // Represents the browser side of the browser <--> renderer communication 5 // Represents the browser side of the browser <--> renderer communication
6 // channel. There will be one RenderProcessHost per renderer process. 6 // channel. There will be one RenderProcessHost per renderer process.
7 7
8 #include "content/browser/renderer_host/render_process_host_impl.h" 8 #include "content/browser/renderer_host/render_process_host_impl.h"
9 9
10 #if defined(OS_WIN) 10 #if defined(OS_WIN)
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 #include "ipc/ipc_switches.h" 109 #include "ipc/ipc_switches.h"
110 #include "media/base/media_switches.h" 110 #include "media/base/media_switches.h"
111 #include "net/url_request/url_request_context_getter.h" 111 #include "net/url_request/url_request_context_getter.h"
112 #include "ui/base/ui_base_switches.h" 112 #include "ui/base/ui_base_switches.h"
113 #include "ui/gl/gl_switches.h" 113 #include "ui/gl/gl_switches.h"
114 #include "webkit/fileapi/sandbox_mount_point_provider.h" 114 #include "webkit/fileapi/sandbox_mount_point_provider.h"
115 #include "webkit/glue/resource_type.h" 115 #include "webkit/glue/resource_type.h"
116 #include "webkit/plugins/plugin_switches.h" 116 #include "webkit/plugins/plugin_switches.h"
117 117
118 #if defined(OS_WIN) 118 #if defined(OS_WIN)
119 #include "base/synchronization/waitable_event.h"
120 #include "content/common/font_cache_dispatcher_win.h" 119 #include "content/common/font_cache_dispatcher_win.h"
121 #endif 120 #endif
122 121
123 #include "third_party/skia/include/core/SkBitmap.h" 122 #include "third_party/skia/include/core/SkBitmap.h"
124 123
125 extern bool g_exited_main_message_loop; 124 extern bool g_exited_main_message_loop;
126 125
127 static const char* kSiteProcessMapKeyName = "content_site_process_map"; 126 static const char* kSiteProcessMapKeyName = "content_site_process_map";
128 127
129 namespace content { 128 namespace content {
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 return false; // Render process hasn't started or is probably crashed. 846 return false; // Render process hasn't started or is probably crashed.
848 847
849 // Test if there's an unload listener. 848 // Test if there's an unload listener.
850 // NOTE: It's possible that an onunload listener may be installed 849 // NOTE: It's possible that an onunload listener may be installed
851 // while we're shutting down, so there's a small race here. Given that 850 // while we're shutting down, so there's a small race here. Given that
852 // the window is small, it's unlikely that the web page has much 851 // the window is small, it's unlikely that the web page has much
853 // state that will be lost by not calling its unload handlers properly. 852 // state that will be lost by not calling its unload handlers properly.
854 if (!SuddenTerminationAllowed()) 853 if (!SuddenTerminationAllowed())
855 return false; 854 return false;
856 855
857 // Store the handle before it gets changed. 856 ProcessDied();
858 base::ProcessHandle handle = GetHandle();
859 ProcessDied(handle, base::TERMINATION_STATUS_NORMAL_TERMINATION, 0, false);
860 fast_shutdown_started_ = true; 857 fast_shutdown_started_ = true;
861 return true; 858 return true;
862 } 859 }
863 860
864 void RenderProcessHostImpl::DumpHandles() { 861 void RenderProcessHostImpl::DumpHandles() {
865 #if defined(OS_WIN) 862 #if defined(OS_WIN)
866 Send(new ChildProcessMsg_DumpHandles()); 863 Send(new ChildProcessMsg_DumpHandles());
867 return; 864 return;
868 #endif 865 #endif
869 866
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 Send(new ChildProcessMsg_SetIPCLoggingEnabled( 1016 Send(new ChildProcessMsg_SetIPCLoggingEnabled(
1020 IPC::Logging::GetInstance()->Enabled())); 1017 IPC::Logging::GetInstance()->Enabled()));
1021 #endif 1018 #endif
1022 1019
1023 tracked_objects::ThreadData::Status status = 1020 tracked_objects::ThreadData::Status status =
1024 tracked_objects::ThreadData::status(); 1021 tracked_objects::ThreadData::status();
1025 Send(new ChildProcessMsg_SetProfilerStatus(status)); 1022 Send(new ChildProcessMsg_SetProfilerStatus(status));
1026 } 1023 }
1027 1024
1028 void RenderProcessHostImpl::OnChannelError() { 1025 void RenderProcessHostImpl::OnChannelError() {
1029 if (!channel_.get()) 1026 ProcessDied();
1030 return;
1031
1032 // Store the handle before it gets changed.
1033 base::ProcessHandle handle = GetHandle();
1034
1035 // child_process_launcher_ can be NULL in single process mode or if fast
1036 // termination happened.
1037 int exit_code = 0;
1038 base::TerminationStatus status =
1039 child_process_launcher_.get() ?
1040 child_process_launcher_->GetChildTerminationStatus(&exit_code) :
1041 base::TERMINATION_STATUS_NORMAL_TERMINATION;
1042
1043 #if defined(OS_WIN)
1044 if (!run_renderer_in_process()) {
1045 if (status == base::TERMINATION_STATUS_STILL_RUNNING) {
1046 HANDLE process = child_process_launcher_->GetHandle();
1047 child_process_watcher_.StartWatching(
1048 new base::WaitableEvent(process), this);
1049 return;
1050 }
1051 }
1052 #endif
1053 ProcessDied(handle, status, exit_code, false);
1054 }
1055
1056 // Called when the renderer process handle has been signaled.
1057 void RenderProcessHostImpl::OnWaitableEventSignaled(
1058 base::WaitableEvent* waitable_event) {
1059 #if defined (OS_WIN)
1060 base::ProcessHandle handle = GetHandle();
1061 int exit_code = 0;
1062 base::TerminationStatus status =
1063 base::GetTerminationStatus(waitable_event->Release(), &exit_code);
1064 delete waitable_event;
1065 ProcessDied(handle, status, exit_code, true);
1066 #endif
1067 } 1027 }
1068 1028
1069 BrowserContext* RenderProcessHostImpl::GetBrowserContext() const { 1029 BrowserContext* RenderProcessHostImpl::GetBrowserContext() const {
1070 return browser_context_; 1030 return browser_context_;
1071 } 1031 }
1072 1032
1073 int RenderProcessHostImpl::GetID() const { 1033 int RenderProcessHostImpl::GetID() const {
1074 return id_; 1034 return id_;
1075 } 1035 }
1076 1036
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
1370 GetSiteProcessMapForBrowserContext(browser_context); 1330 GetSiteProcessMapForBrowserContext(browser_context);
1371 1331
1372 // TODO(creis): Determine if it's better to allow registration of 1332 // TODO(creis): Determine if it's better to allow registration of
1373 // empty sites or not. For now, group anything from which we can't parse 1333 // empty sites or not. For now, group anything from which we can't parse
1374 // a site into the same process, when using --process-per-site. 1334 // a site into the same process, when using --process-per-site.
1375 std::string site = SiteInstanceImpl::GetSiteForURL(browser_context, url) 1335 std::string site = SiteInstanceImpl::GetSiteForURL(browser_context, url)
1376 .possibly_invalid_spec(); 1336 .possibly_invalid_spec();
1377 map->RegisterProcess(site, process); 1337 map->RegisterProcess(site, process);
1378 } 1338 }
1379 1339
1380 void RenderProcessHostImpl::ProcessDied(base::ProcessHandle handle, 1340 void RenderProcessHostImpl::ProcessDied() {
1381 base::TerminationStatus status,
1382 int exit_code,
1383 bool was_alive) {
1384 // Our child process has died. If we didn't expect it, it's a crash. 1341 // Our child process has died. If we didn't expect it, it's a crash.
1385 // In any case, we need to let everyone know it's gone. 1342 // In any case, we need to let everyone know it's gone.
1386 // The OnChannelError notification can fire multiple times due to nested sync 1343 // The OnChannelError notification can fire multiple times due to nested sync
1387 // calls to a renderer. If we don't have a valid channel here it means we 1344 // calls to a renderer. If we don't have a valid channel here it means we
1388 // already handled the error. 1345 // already handled the error.
1389 1346
1390 RendererClosedDetails details(handle, status, exit_code, was_alive); 1347 // child_process_launcher_ can be NULL in single process mode or if fast
1348 // termination happened.
1349 int exit_code = 0;
1350 base::TerminationStatus status =
1351 child_process_launcher_.get() ?
1352 child_process_launcher_->GetChildTerminationStatus(&exit_code) :
1353 base::TERMINATION_STATUS_NORMAL_TERMINATION;
1354
1355 RendererClosedDetails details(GetHandle(), status, exit_code);
1391 NotificationService::current()->Notify( 1356 NotificationService::current()->Notify(
1392 NOTIFICATION_RENDERER_PROCESS_CLOSED, 1357 NOTIFICATION_RENDERER_PROCESS_CLOSED,
1393 Source<RenderProcessHost>(this), 1358 Source<RenderProcessHost>(this),
1394 Details<RendererClosedDetails>(&details)); 1359 Details<RendererClosedDetails>(&details));
1395 1360
1396 child_process_launcher_.reset(); 1361 child_process_launcher_.reset();
1397 channel_.reset(); 1362 channel_.reset();
1398 gpu_message_filter_ = NULL; 1363 gpu_message_filter_ = NULL;
1399 1364
1400 IDMap<RenderWidgetHost>::iterator iter(&render_widget_hosts_); 1365 IDMap<RenderWidgetHost>::iterator iter(&render_widget_hosts_);
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
1534 int32 route_id, 1499 int32 route_id,
1535 int32 gpu_process_host_id) { 1500 int32 gpu_process_host_id) {
1536 TRACE_EVENT0("renderer_host", 1501 TRACE_EVENT0("renderer_host",
1537 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost"); 1502 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost");
1538 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, 1503 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id,
1539 gpu_process_host_id, 1504 gpu_process_host_id,
1540 0); 1505 0);
1541 } 1506 }
1542 1507
1543 } // namespace content 1508 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698