Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 884 } | 884 } |
| 885 | 885 |
| 886 bool RenderProcessHostImpl::IsGuest() const { | 886 bool RenderProcessHostImpl::IsGuest() const { |
| 887 return is_guest_; | 887 return is_guest_; |
| 888 } | 888 } |
| 889 | 889 |
| 890 StoragePartition* RenderProcessHostImpl::GetStoragePartition() const { | 890 StoragePartition* RenderProcessHostImpl::GetStoragePartition() const { |
| 891 return storage_partition_impl_; | 891 return storage_partition_impl_; |
| 892 } | 892 } |
| 893 | 893 |
| 894 static void AppendGpuCommandLineFlags(CommandLine* command_line) { | |
| 895 if (content::IsThreadedCompositingEnabled()) | |
| 896 command_line->AppendSwitch(switches::kEnableThreadedCompositing); | |
| 897 | |
| 898 if (content::IsDelegatedRendererEnabled()) | |
| 899 command_line->AppendSwitch(switches::kEnableDelegatedRenderer); | |
| 900 | |
| 901 if (content::IsDeadlineSchedulingEnabled()) | |
| 902 command_line->AppendSwitch(switches::kEnableDeadlineScheduling); | |
| 903 | |
| 904 // Appending disable-gpu-feature switches due to software rendering list. | |
|
jamesr
2014/01/08 22:20:40
can you remove any of the code from content/gpu/ t
| |
| 905 GpuDataManagerImpl* gpu_data_manager = GpuDataManagerImpl::GetInstance(); | |
| 906 DCHECK(gpu_data_manager); | |
| 907 gpu_data_manager->AppendRendererCommandLine(command_line); | |
| 908 } | |
| 909 | |
| 894 void RenderProcessHostImpl::AppendRendererCommandLine( | 910 void RenderProcessHostImpl::AppendRendererCommandLine( |
| 895 CommandLine* command_line) const { | 911 CommandLine* command_line) const { |
| 896 // Pass the process type first, so it shows first in process listings. | 912 // Pass the process type first, so it shows first in process listings. |
| 897 command_line->AppendSwitchASCII(switches::kProcessType, | 913 command_line->AppendSwitchASCII(switches::kProcessType, |
| 898 switches::kRendererProcess); | 914 switches::kRendererProcess); |
| 899 | 915 |
| 900 // Now send any options from our own command line we want to propagate. | 916 // Now send any options from our own command line we want to propagate. |
| 901 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | 917 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
| 902 PropagateBrowserCommandLineToRenderer(browser_command_line, command_line); | 918 PropagateBrowserCommandLineToRenderer(browser_command_line, command_line); |
| 903 | 919 |
| 904 // Pass on the browser locale. | 920 // Pass on the browser locale. |
| 905 const std::string locale = | 921 const std::string locale = |
| 906 GetContentClient()->browser()->GetApplicationLocale(); | 922 GetContentClient()->browser()->GetApplicationLocale(); |
| 907 command_line->AppendSwitchASCII(switches::kLang, locale); | 923 command_line->AppendSwitchASCII(switches::kLang, locale); |
| 908 | 924 |
| 909 // If we run base::FieldTrials, we want to pass to their state to the | 925 // 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 | 926 // renderer so that it can act in accordance with each state, or record |
| 911 // histograms relating to the base::FieldTrial states. | 927 // histograms relating to the base::FieldTrial states. |
| 912 std::string field_trial_states; | 928 std::string field_trial_states; |
| 913 base::FieldTrialList::StatesToString(&field_trial_states); | 929 base::FieldTrialList::StatesToString(&field_trial_states); |
| 914 if (!field_trial_states.empty()) { | 930 if (!field_trial_states.empty()) { |
| 915 command_line->AppendSwitchASCII(switches::kForceFieldTrials, | 931 command_line->AppendSwitchASCII(switches::kForceFieldTrials, |
| 916 field_trial_states); | 932 field_trial_states); |
| 917 } | 933 } |
| 918 | 934 |
| 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( | 935 GetContentClient()->browser()->AppendExtraCommandLineSwitches( |
| 929 command_line, GetID()); | 936 command_line, GetID()); |
| 930 | 937 |
| 931 // Appending disable-gpu-feature switches due to software rendering list. | 938 AppendGpuCommandLineFlags(command_line); |
| 932 GpuDataManagerImpl* gpu_data_manager = GpuDataManagerImpl::GetInstance(); | |
| 933 DCHECK(gpu_data_manager); | |
| 934 gpu_data_manager->AppendRendererCommandLine(command_line); | |
| 935 } | 939 } |
| 936 | 940 |
| 937 void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( | 941 void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( |
| 938 const CommandLine& browser_cmd, | 942 const CommandLine& browser_cmd, |
| 939 CommandLine* renderer_cmd) const { | 943 CommandLine* renderer_cmd) const { |
| 940 // Propagate the following switches to the renderer command line (along | 944 // Propagate the following switches to the renderer command line (along |
| 941 // with any associated values) if present in the browser command line. | 945 // with any associated values) if present in the browser command line. |
| 942 static const char* const kSwitchNames[] = { | 946 static const char* const kSwitchNames[] = { |
| 943 switches::kAudioBufferSize, | 947 switches::kAudioBufferSize, |
| 944 switches::kAuditAllHandles, | 948 switches::kAuditAllHandles, |
| (...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1649 // static | 1653 // static |
| 1650 bool RenderProcessHost::run_renderer_in_process() { | 1654 bool RenderProcessHost::run_renderer_in_process() { |
| 1651 return g_run_renderer_in_process_; | 1655 return g_run_renderer_in_process_; |
| 1652 } | 1656 } |
| 1653 | 1657 |
| 1654 // static | 1658 // static |
| 1655 void RenderProcessHost::SetRunRendererInProcess(bool value) { | 1659 void RenderProcessHost::SetRunRendererInProcess(bool value) { |
| 1656 g_run_renderer_in_process_ = value; | 1660 g_run_renderer_in_process_ = value; |
| 1657 | 1661 |
| 1658 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 1662 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 1659 if (value && !command_line->HasSwitch(switches::kLang)) { | 1663 if (value) { |
| 1660 // Modify the current process' command line to include the browser locale, | 1664 if (!command_line->HasSwitch(switches::kLang)) { |
| 1661 // as the renderer expects this flag to be set. | 1665 // Modify the current process' command line to include the browser locale, |
| 1662 const std::string locale = | 1666 // as the renderer expects this flag to be set. |
| 1663 GetContentClient()->browser()->GetApplicationLocale(); | 1667 const std::string locale = |
| 1664 command_line->AppendSwitchASCII(switches::kLang, locale); | 1668 GetContentClient()->browser()->GetApplicationLocale(); |
| 1669 command_line->AppendSwitchASCII(switches::kLang, locale); | |
| 1670 } | |
| 1671 AppendGpuCommandLineFlags(command_line); | |
|
jamesr
2014/01/08 22:20:40
probably deserves a comment with link to a bug and
| |
| 1665 } | 1672 } |
| 1666 } | 1673 } |
| 1667 | 1674 |
| 1668 // static | 1675 // static |
| 1669 RenderProcessHost::iterator RenderProcessHost::AllHostsIterator() { | 1676 RenderProcessHost::iterator RenderProcessHost::AllHostsIterator() { |
| 1670 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1677 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 1671 return iterator(g_all_hosts.Pointer()); | 1678 return iterator(g_all_hosts.Pointer()); |
| 1672 } | 1679 } |
| 1673 | 1680 |
| 1674 // static | 1681 // static |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2018 return; | 2025 return; |
| 2019 Send(new MediaStreamMsg_EnableAecDump(file_for_transit)); | 2026 Send(new MediaStreamMsg_EnableAecDump(file_for_transit)); |
| 2020 } | 2027 } |
| 2021 | 2028 |
| 2022 void RenderProcessHostImpl::SendDisableAecDumpToRenderer() { | 2029 void RenderProcessHostImpl::SendDisableAecDumpToRenderer() { |
| 2023 Send(new MediaStreamMsg_DisableAecDump()); | 2030 Send(new MediaStreamMsg_DisableAecDump()); |
| 2024 } | 2031 } |
| 2025 #endif | 2032 #endif |
| 2026 | 2033 |
| 2027 } // namespace content | 2034 } // namespace content |
| OLD | NEW |