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

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

Issue 7888024: Move handle dumpage to the renderer process (so that it works correctly) and factor out redundant... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/browser_render_process_host.h" 8 #include "content/browser/renderer_host/browser_render_process_host.h"
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 switches::kEnableAccessibilityLogging, 557 switches::kEnableAccessibilityLogging,
558 switches::kEnableAdaptive, 558 switches::kEnableAdaptive,
559 switches::kEnableBenchmarking, 559 switches::kEnableBenchmarking,
560 switches::kEnableDCHECK, 560 switches::kEnableDCHECK,
561 switches::kEnableGPUServiceLogging, 561 switches::kEnableGPUServiceLogging,
562 switches::kEnableGPUClientLogging, 562 switches::kEnableGPUClientLogging,
563 switches::kEnableLogging, 563 switches::kEnableLogging,
564 switches::kEnableMediaStream, 564 switches::kEnableMediaStream,
565 switches::kDisableFullScreen, 565 switches::kDisableFullScreen,
566 switches::kEnablePepperTesting, 566 switches::kEnablePepperTesting,
567 #if defined(OS_WIN)
jam 2011/09/19 17:10:48 nit: this really isn't needed, no?
Cris Neckar 2011/09/20 01:22:15 Done.
568 switches::kAuditAllHandles,
569 switches::kAuditHandles,
570 #endif
567 #if defined(OS_MACOSX) 571 #if defined(OS_MACOSX)
568 // Allow this to be set when invoking the browser and relayed along. 572 // Allow this to be set when invoking the browser and relayed along.
569 switches::kEnableSandboxLogging, 573 switches::kEnableSandboxLogging,
570 #endif 574 #endif
571 switches::kEnableSeccompSandbox, 575 switches::kEnableSeccompSandbox,
572 switches::kEnableStatsTable, 576 switches::kEnableStatsTable,
573 switches::kEnableVideoFullscreen, 577 switches::kEnableVideoFullscreen,
574 switches::kEnableVideoLogging, 578 switches::kEnableVideoLogging,
575 switches::kFullMemoryCrashReport, 579 switches::kFullMemoryCrashReport,
576 #if !defined (GOOGLE_CHROME_BUILD) 580 #if !defined (GOOGLE_CHROME_BUILD)
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 // state that will be lost by not calling its unload handlers properly. 653 // state that will be lost by not calling its unload handlers properly.
650 if (!sudden_termination_allowed()) 654 if (!sudden_termination_allowed())
651 return false; 655 return false;
652 656
653 child_process_launcher_.reset(); 657 child_process_launcher_.reset();
654 ProcessDied(); 658 ProcessDied();
655 fast_shutdown_started_ = true; 659 fast_shutdown_started_ = true;
656 return true; 660 return true;
657 } 661 }
658 662
663 void BrowserRenderProcessHost::DumpHandles() {
664 #if defined(OS_WIN)
665 Send(new ChildProcessMsg_DumpHandles());
666 return;
667 #endif
668
669 NOTIMPLEMENTED();
670 }
671
659 // This is a platform specific function for mapping a transport DIB given its id 672 // This is a platform specific function for mapping a transport DIB given its id
660 TransportDIB* BrowserRenderProcessHost::MapTransportDIB( 673 TransportDIB* BrowserRenderProcessHost::MapTransportDIB(
661 TransportDIB::Id dib_id) { 674 TransportDIB::Id dib_id) {
662 #if defined(OS_WIN) 675 #if defined(OS_WIN)
663 // On Windows we need to duplicate the handle from the remote process 676 // On Windows we need to duplicate the handle from the remote process
664 HANDLE section = chrome::GetSectionFromProcess( 677 HANDLE section = chrome::GetSectionFromProcess(
665 dib_id.handle, GetHandle(), false /* read write */); 678 dib_id.handle, GetHandle(), false /* read write */);
666 return TransportDIB::Map(section); 679 return TransportDIB::Map(section);
667 #elif defined(OS_MACOSX) 680 #elif defined(OS_MACOSX)
668 // On OSX, the browser allocates all DIBs and keeps a file descriptor around 681 // On OSX, the browser allocates all DIBs and keeps a file descriptor around
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 if (deleting_soon_) 761 if (deleting_soon_)
749 return false; 762 return false;
750 763
751 mark_child_process_activity_time(); 764 mark_child_process_activity_time();
752 if (msg.routing_id() == MSG_ROUTING_CONTROL) { 765 if (msg.routing_id() == MSG_ROUTING_CONTROL) {
753 // Dispatch control messages. 766 // Dispatch control messages.
754 bool msg_is_ok = true; 767 bool msg_is_ok = true;
755 IPC_BEGIN_MESSAGE_MAP_EX(BrowserRenderProcessHost, msg, msg_is_ok) 768 IPC_BEGIN_MESSAGE_MAP_EX(BrowserRenderProcessHost, msg, msg_is_ok)
756 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ShutdownRequest, 769 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ShutdownRequest,
757 OnShutdownRequest) 770 OnShutdownRequest)
771 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_DumpHandlesDone,
772 OnDumpHandlesDone)
758 IPC_MESSAGE_HANDLER(ViewHostMsg_SuddenTerminationChanged, 773 IPC_MESSAGE_HANDLER(ViewHostMsg_SuddenTerminationChanged,
759 SuddenTerminationChanged) 774 SuddenTerminationChanged)
760 IPC_MESSAGE_HANDLER(ViewHostMsg_UserMetricsRecordAction, 775 IPC_MESSAGE_HANDLER(ViewHostMsg_UserMetricsRecordAction,
761 OnUserMetricsRecordAction) 776 OnUserMetricsRecordAction)
762 IPC_MESSAGE_HANDLER(ViewHostMsg_RevealFolderInOS, OnRevealFolderInOS) 777 IPC_MESSAGE_HANDLER(ViewHostMsg_RevealFolderInOS, OnRevealFolderInOS)
763 IPC_MESSAGE_HANDLER(ViewHostMsg_SavedPageAsMHTML, OnSavedPageAsMHTML) 778 IPC_MESSAGE_HANDLER(ViewHostMsg_SavedPageAsMHTML, OnSavedPageAsMHTML)
764 IPC_MESSAGE_UNHANDLED_ERROR() 779 IPC_MESSAGE_UNHANDLED_ERROR()
765 IPC_END_MESSAGE_MAP_EX() 780 IPC_END_MESSAGE_MAP_EX()
766 781
767 if (!msg_is_ok) { 782 if (!msg_is_ok) {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 878
864 // Notify any tabs that might have swapped out renderers from this process. 879 // Notify any tabs that might have swapped out renderers from this process.
865 // They should not attempt to swap them back in. 880 // They should not attempt to swap them back in.
866 NotificationService::current()->Notify( 881 NotificationService::current()->Notify(
867 content::NOTIFICATION_RENDERER_PROCESS_CLOSING, 882 content::NOTIFICATION_RENDERER_PROCESS_CLOSING,
868 Source<RenderProcessHost>(this), NotificationService::NoDetails()); 883 Source<RenderProcessHost>(this), NotificationService::NoDetails());
869 884
870 Send(new ChildProcessMsg_Shutdown()); 885 Send(new ChildProcessMsg_Shutdown());
871 } 886 }
872 887
888 void BrowserRenderProcessHost::OnDumpHandlesDone() {
889 // When no other owners of this object, we can delete ourselves.
jam 2011/09/19 17:10:48 you don't want to duplicate this code from RenderP
Cris Neckar 2011/09/20 01:22:15 Done.
890 if (listeners_.IsEmpty()) {
891 NotificationService::current()->Notify(
892 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED,
893 Source<RenderProcessHost>(this), NotificationService::NoDetails());
894 MessageLoop::current()->DeleteSoon(FROM_HERE, this);
895 deleting_soon_ = true;
896 }
897 }
898
873 void BrowserRenderProcessHost::SuddenTerminationChanged(bool enabled) { 899 void BrowserRenderProcessHost::SuddenTerminationChanged(bool enabled) {
874 set_sudden_termination_allowed(enabled); 900 set_sudden_termination_allowed(enabled);
875 } 901 }
876 902
877 void BrowserRenderProcessHost::SetBackgrounded(bool backgrounded) { 903 void BrowserRenderProcessHost::SetBackgrounded(bool backgrounded) {
878 // Note: we always set the backgrounded_ value. If the process is NULL 904 // Note: we always set the backgrounded_ value. If the process is NULL
879 // (and hence hasn't been created yet), we will set the process priority 905 // (and hence hasn't been created yet), we will set the process priority
880 // later when we create the process. 906 // later when we create the process.
881 backgrounded_ = backgrounded; 907 backgrounded_ = backgrounded;
882 if (!child_process_launcher_.get() || child_process_launcher_->IsStarting()) 908 if (!child_process_launcher_.get() || child_process_launcher_->IsStarting())
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 void BrowserRenderProcessHost::OnRevealFolderInOS(const FilePath& path) { 966 void BrowserRenderProcessHost::OnRevealFolderInOS(const FilePath& path) {
941 // Only honor the request if appropriate persmissions are granted. 967 // Only honor the request if appropriate persmissions are granted.
942 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(id(), path)) 968 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(id(), path))
943 content::GetContentClient()->browser()->OpenItem(path); 969 content::GetContentClient()->browser()->OpenItem(path);
944 } 970 }
945 971
946 void BrowserRenderProcessHost::OnSavedPageAsMHTML(int job_id, bool success) { 972 void BrowserRenderProcessHost::OnSavedPageAsMHTML(int job_id, bool success) {
947 content::GetContentClient()->browser()->GetMHTMLGenerationManager()-> 973 content::GetContentClient()->browser()->GetMHTMLGenerationManager()->
948 MHTMLGenerated(job_id, success); 974 MHTMLGenerated(job_id, success);
949 } 975 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698