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

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

Issue 129633002: Also append GPU command-line flags to the browser in single-process mode (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix single-process cleanup Created 6 years, 11 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/browser/gpu/gpu_process_host.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 // 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 #include <algorithm> 10 #include <algorithm>
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 << "in-process."; 443 << "in-process.";
444 } 444 }
445 } 445 }
446 446
447 RenderProcessHostImpl::~RenderProcessHostImpl() { 447 RenderProcessHostImpl::~RenderProcessHostImpl() {
448 #ifndef NDEBUG 448 #ifndef NDEBUG
449 DCHECK(is_self_deleted_) 449 DCHECK(is_self_deleted_)
450 << "RenderProcessHostImpl is destroyed by something other than itself"; 450 << "RenderProcessHostImpl is destroyed by something other than itself";
451 #endif 451 #endif
452 452
453 // Make sure to clean up the in-process renderer before the channel, otherwise
454 // it may still run and have its IPCs fail, causing asserts.
455 in_process_renderer_.reset();
456
453 ChildProcessSecurityPolicyImpl::GetInstance()->Remove(GetID()); 457 ChildProcessSecurityPolicyImpl::GetInstance()->Remove(GetID());
454 458
455 if (gpu_observer_registered_) { 459 if (gpu_observer_registered_) {
456 GpuDataManagerImpl::GetInstance()->RemoveObserver(this); 460 GpuDataManagerImpl::GetInstance()->RemoveObserver(this);
457 gpu_observer_registered_ = false; 461 gpu_observer_registered_ = false;
458 } 462 }
459 463
460 // We may have some unsent messages at this point, but that's OK. 464 // We may have some unsent messages at this point, but that's OK.
461 channel_.reset(); 465 channel_.reset();
462 while (!queued_messages_.empty()) { 466 while (!queued_messages_.empty()) {
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 } 888 }
885 889
886 bool RenderProcessHostImpl::IsGuest() const { 890 bool RenderProcessHostImpl::IsGuest() const {
887 return is_guest_; 891 return is_guest_;
888 } 892 }
889 893
890 StoragePartition* RenderProcessHostImpl::GetStoragePartition() const { 894 StoragePartition* RenderProcessHostImpl::GetStoragePartition() const {
891 return storage_partition_impl_; 895 return storage_partition_impl_;
892 } 896 }
893 897
898 static void AppendGpuCommandLineFlags(CommandLine* command_line) {
899 if (content::IsThreadedCompositingEnabled())
900 command_line->AppendSwitch(switches::kEnableThreadedCompositing);
901
902 if (content::IsDelegatedRendererEnabled())
903 command_line->AppendSwitch(switches::kEnableDelegatedRenderer);
904
905 if (content::IsDeadlineSchedulingEnabled())
906 command_line->AppendSwitch(switches::kEnableDeadlineScheduling);
907
908 // Appending disable-gpu-feature switches due to software rendering list.
909 GpuDataManagerImpl* gpu_data_manager = GpuDataManagerImpl::GetInstance();
910 DCHECK(gpu_data_manager);
911 gpu_data_manager->AppendRendererCommandLine(command_line);
912 }
913
894 void RenderProcessHostImpl::AppendRendererCommandLine( 914 void RenderProcessHostImpl::AppendRendererCommandLine(
895 CommandLine* command_line) const { 915 CommandLine* command_line) const {
896 // Pass the process type first, so it shows first in process listings. 916 // Pass the process type first, so it shows first in process listings.
897 command_line->AppendSwitchASCII(switches::kProcessType, 917 command_line->AppendSwitchASCII(switches::kProcessType,
898 switches::kRendererProcess); 918 switches::kRendererProcess);
899 919
900 // Now send any options from our own command line we want to propagate. 920 // Now send any options from our own command line we want to propagate.
901 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); 921 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
902 PropagateBrowserCommandLineToRenderer(browser_command_line, command_line); 922 PropagateBrowserCommandLineToRenderer(browser_command_line, command_line);
903 923
904 // Pass on the browser locale. 924 // Pass on the browser locale.
905 const std::string locale = 925 const std::string locale =
906 GetContentClient()->browser()->GetApplicationLocale(); 926 GetContentClient()->browser()->GetApplicationLocale();
907 command_line->AppendSwitchASCII(switches::kLang, locale); 927 command_line->AppendSwitchASCII(switches::kLang, locale);
908 928
909 // If we run base::FieldTrials, we want to pass to their state to the 929 // If we run base::FieldTrials, we want to pass to their state to the
910 // renderer so that it can act in accordance with each state, or record 930 // renderer so that it can act in accordance with each state, or record
911 // histograms relating to the base::FieldTrial states. 931 // histograms relating to the base::FieldTrial states.
912 std::string field_trial_states; 932 std::string field_trial_states;
913 base::FieldTrialList::StatesToString(&field_trial_states); 933 base::FieldTrialList::StatesToString(&field_trial_states);
914 if (!field_trial_states.empty()) { 934 if (!field_trial_states.empty()) {
915 command_line->AppendSwitchASCII(switches::kForceFieldTrials, 935 command_line->AppendSwitchASCII(switches::kForceFieldTrials,
916 field_trial_states); 936 field_trial_states);
917 } 937 }
918 938
919 if (content::IsThreadedCompositingEnabled())
920 command_line->AppendSwitch(switches::kEnableThreadedCompositing);
921
922 if (content::IsDelegatedRendererEnabled())
923 command_line->AppendSwitch(switches::kEnableDelegatedRenderer);
924
925 if (content::IsDeadlineSchedulingEnabled())
926 command_line->AppendSwitch(switches::kEnableDeadlineScheduling);
927
928 GetContentClient()->browser()->AppendExtraCommandLineSwitches( 939 GetContentClient()->browser()->AppendExtraCommandLineSwitches(
929 command_line, GetID()); 940 command_line, GetID());
930 941
931 // Appending disable-gpu-feature switches due to software rendering list. 942 AppendGpuCommandLineFlags(command_line);
932 GpuDataManagerImpl* gpu_data_manager = GpuDataManagerImpl::GetInstance();
933 DCHECK(gpu_data_manager);
934 gpu_data_manager->AppendRendererCommandLine(command_line);
935 } 943 }
936 944
937 void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( 945 void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
938 const CommandLine& browser_cmd, 946 const CommandLine& browser_cmd,
939 CommandLine* renderer_cmd) const { 947 CommandLine* renderer_cmd) const {
940 // Propagate the following switches to the renderer command line (along 948 // Propagate the following switches to the renderer command line (along
941 // with any associated values) if present in the browser command line. 949 // with any associated values) if present in the browser command line.
942 static const char* const kSwitchNames[] = { 950 static const char* const kSwitchNames[] = {
943 switches::kAudioBufferSize, 951 switches::kAudioBufferSize,
944 switches::kAuditAllHandles, 952 switches::kAuditAllHandles,
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
1649 // static 1657 // static
1650 bool RenderProcessHost::run_renderer_in_process() { 1658 bool RenderProcessHost::run_renderer_in_process() {
1651 return g_run_renderer_in_process_; 1659 return g_run_renderer_in_process_;
1652 } 1660 }
1653 1661
1654 // static 1662 // static
1655 void RenderProcessHost::SetRunRendererInProcess(bool value) { 1663 void RenderProcessHost::SetRunRendererInProcess(bool value) {
1656 g_run_renderer_in_process_ = value; 1664 g_run_renderer_in_process_ = value;
1657 1665
1658 CommandLine* command_line = CommandLine::ForCurrentProcess(); 1666 CommandLine* command_line = CommandLine::ForCurrentProcess();
1659 if (value && !command_line->HasSwitch(switches::kLang)) { 1667 if (value) {
1660 // Modify the current process' command line to include the browser locale, 1668 if (!command_line->HasSwitch(switches::kLang)) {
1661 // as the renderer expects this flag to be set. 1669 // Modify the current process' command line to include the browser locale,
1662 const std::string locale = 1670 // as the renderer expects this flag to be set.
1663 GetContentClient()->browser()->GetApplicationLocale(); 1671 const std::string locale =
1664 command_line->AppendSwitchASCII(switches::kLang, locale); 1672 GetContentClient()->browser()->GetApplicationLocale();
1673 command_line->AppendSwitchASCII(switches::kLang, locale);
1674 }
1675 // TODO(piman): we should really send configuration through bools rather
1676 // than by parsing strings, i.e. sending an IPC rather than command line
1677 // args. crbug.com/314909
1678 AppendGpuCommandLineFlags(command_line);
1665 } 1679 }
1666 } 1680 }
1667 1681
1668 // static 1682 // static
1669 RenderProcessHost::iterator RenderProcessHost::AllHostsIterator() { 1683 RenderProcessHost::iterator RenderProcessHost::AllHostsIterator() {
1670 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1684 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1671 return iterator(g_all_hosts.Pointer()); 1685 return iterator(g_all_hosts.Pointer());
1672 } 1686 }
1673 1687
1674 // static 1688 // static
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
2018 return; 2032 return;
2019 Send(new MediaStreamMsg_EnableAecDump(file_for_transit)); 2033 Send(new MediaStreamMsg_EnableAecDump(file_for_transit));
2020 } 2034 }
2021 2035
2022 void RenderProcessHostImpl::SendDisableAecDumpToRenderer() { 2036 void RenderProcessHostImpl::SendDisableAecDumpToRenderer() {
2023 Send(new MediaStreamMsg_DisableAecDump()); 2037 Send(new MediaStreamMsg_DisableAecDump());
2024 } 2038 }
2025 #endif 2039 #endif
2026 2040
2027 } // namespace content 2041 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_process_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698