| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 | 793 |
| 794 is_initialized_ = true; | 794 is_initialized_ = true; |
| 795 init_time_ = base::TimeTicks::Now(); | 795 init_time_ = base::TimeTicks::Now(); |
| 796 return true; | 796 return true; |
| 797 } | 797 } |
| 798 | 798 |
| 799 std::unique_ptr<IPC::ChannelProxy> RenderProcessHostImpl::CreateChannelProxy( | 799 std::unique_ptr<IPC::ChannelProxy> RenderProcessHostImpl::CreateChannelProxy( |
| 800 const std::string& channel_id) { | 800 const std::string& channel_id) { |
| 801 scoped_refptr<base::SingleThreadTaskRunner> runner = | 801 scoped_refptr<base::SingleThreadTaskRunner> runner = |
| 802 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); | 802 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); |
| 803 if (ShouldUseMojoChannel()) { | 803 mojo_channel_token_ = mojo::edk::GenerateRandomToken(); |
| 804 VLOG(1) << "Mojo Channel is enabled on host"; | 804 mojo::ScopedMessagePipeHandle handle = |
| 805 mojo_channel_token_ = mojo::edk::GenerateRandomToken(); | 805 mojo::edk::CreateParentMessagePipe(mojo_channel_token_); |
| 806 mojo::ScopedMessagePipeHandle handle = | |
| 807 mojo::edk::CreateParentMessagePipe(mojo_channel_token_); | |
| 808 | 806 |
| 809 // Do NOT expand ifdef or run time condition checks here! Synchronous | 807 // Do NOT expand ifdef or run time condition checks here! Synchronous |
| 810 // IPCs from browser process are banned. It is only narrowly allowed | 808 // IPCs from browser process are banned. It is only narrowly allowed |
| 811 // for Android WebView to maintain backward compatibility. | 809 // for Android WebView to maintain backward compatibility. |
| 812 // See crbug.com/526842 for details. | 810 // See crbug.com/526842 for details. |
| 813 #if defined(OS_ANDROID) | |
| 814 if (GetContentClient()->UsingSynchronousCompositing()) { | |
| 815 return IPC::SyncChannel::Create( | |
| 816 IPC::ChannelMojo::CreateServerFactory(std::move(handle)), this, | |
| 817 runner.get(), true, &never_signaled_); | |
| 818 } | |
| 819 #endif // OS_ANDROID | |
| 820 | |
| 821 std::unique_ptr<IPC::ChannelProxy> channel( | |
| 822 new IPC::ChannelProxy(this, runner.get())); | |
| 823 #if USE_ATTACHMENT_BROKER | |
| 824 IPC::AttachmentBroker::GetGlobal()->RegisterCommunicationChannel( | |
| 825 channel.get(), content::BrowserThread::GetMessageLoopProxyForThread( | |
| 826 content::BrowserThread::IO)); | |
| 827 #endif | |
| 828 channel->Init(IPC::ChannelMojo::CreateServerFactory(std::move(handle)), true); | |
| 829 return channel; | |
| 830 } | |
| 831 | |
| 832 // Do NOT expand ifdef or run time condition checks here! See comment above. | |
| 833 #if defined(OS_ANDROID) | 811 #if defined(OS_ANDROID) |
| 834 if (GetContentClient()->UsingSynchronousCompositing()) { | 812 if (GetContentClient()->UsingSynchronousCompositing()) { |
| 835 return IPC::SyncChannel::Create(channel_id, IPC::Channel::MODE_SERVER, this, | 813 return IPC::SyncChannel::Create( |
| 836 runner.get(), true, &never_signaled_); | 814 IPC::ChannelMojo::CreateServerFactory(std::move(handle)), this, |
| 815 runner.get(), true, &never_signaled_); |
| 837 } | 816 } |
| 838 #endif // OS_ANDROID | 817 #endif // OS_ANDROID |
| 839 | 818 |
| 840 std::unique_ptr<IPC::ChannelProxy> channel( | 819 std::unique_ptr<IPC::ChannelProxy> channel( |
| 841 new IPC::ChannelProxy(this, runner.get())); | 820 new IPC::ChannelProxy(this, runner.get())); |
| 842 #if USE_ATTACHMENT_BROKER | 821 #if USE_ATTACHMENT_BROKER |
| 843 IPC::AttachmentBroker::GetGlobal()->RegisterCommunicationChannel( | 822 IPC::AttachmentBroker::GetGlobal()->RegisterCommunicationChannel( |
| 844 channel.get(), content::BrowserThread::GetMessageLoopProxyForThread( | 823 channel.get(), content::BrowserThread::GetMessageLoopProxyForThread( |
| 845 content::BrowserThread::IO)); | 824 content::BrowserThread::IO)); |
| 846 #endif | 825 #endif |
| 847 channel->Init(channel_id, IPC::Channel::MODE_SERVER, true); | 826 channel->Init(IPC::ChannelMojo::CreateServerFactory(std::move(handle)), true); |
| 848 return channel; | 827 return channel; |
| 849 } | 828 } |
| 850 | 829 |
| 851 void RenderProcessHostImpl::CreateMessageFilters() { | 830 void RenderProcessHostImpl::CreateMessageFilters() { |
| 852 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 831 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 853 const base::CommandLine& browser_command_line = | 832 const base::CommandLine& browser_command_line = |
| 854 *base::CommandLine::ForCurrentProcess(); | 833 *base::CommandLine::ForCurrentProcess(); |
| 855 AddFilter(new ResourceSchedulerFilter(GetID())); | 834 AddFilter(new ResourceSchedulerFilter(GetID())); |
| 856 MediaInternals* media_internals = MediaInternals::GetInstance(); | 835 MediaInternals* media_internals = MediaInternals::GetInstance(); |
| 857 media::AudioManager* audio_manager = | 836 media::AudioManager* audio_manager = |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1418 switches::kEnableExperimentalWebPlatformFeatures, | 1397 switches::kEnableExperimentalWebPlatformFeatures, |
| 1419 switches::kEnableHeapProfiling, | 1398 switches::kEnableHeapProfiling, |
| 1420 switches::kEnableGPUClientLogging, | 1399 switches::kEnableGPUClientLogging, |
| 1421 switches::kEnableGpuClientTracing, | 1400 switches::kEnableGpuClientTracing, |
| 1422 switches::kEnableGpuMemoryBufferVideoFrames, | 1401 switches::kEnableGpuMemoryBufferVideoFrames, |
| 1423 switches::kEnableGPUServiceLogging, | 1402 switches::kEnableGPUServiceLogging, |
| 1424 switches::kEnableIconNtp, | 1403 switches::kEnableIconNtp, |
| 1425 switches::kEnableLinkDisambiguationPopup, | 1404 switches::kEnableLinkDisambiguationPopup, |
| 1426 switches::kEnableLowResTiling, | 1405 switches::kEnableLowResTiling, |
| 1427 switches::kEnableMediaSuspend, | 1406 switches::kEnableMediaSuspend, |
| 1428 switches::kEnableMojoChannel, | |
| 1429 switches::kEnableInbandTextTracks, | 1407 switches::kEnableInbandTextTracks, |
| 1430 switches::kEnableLCDText, | 1408 switches::kEnableLCDText, |
| 1431 switches::kEnableLogging, | 1409 switches::kEnableLogging, |
| 1432 switches::kEnableMemoryBenchmarking, | 1410 switches::kEnableMemoryBenchmarking, |
| 1433 switches::kEnableNetworkInformation, | 1411 switches::kEnableNetworkInformation, |
| 1434 switches::kEnableOverlayScrollbar, | 1412 switches::kEnableOverlayScrollbar, |
| 1435 switches::kEnablePinch, | 1413 switches::kEnablePinch, |
| 1436 switches::kEnablePluginPlaceholderTesting, | 1414 switches::kEnablePluginPlaceholderTesting, |
| 1437 switches::kEnablePreciseMemoryInfo, | 1415 switches::kEnablePreciseMemoryInfo, |
| 1438 switches::kEnablePreferCompositingToLCDText, | 1416 switches::kEnablePreferCompositingToLCDText, |
| (...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2796 | 2774 |
| 2797 // Skip widgets in other processes. | 2775 // Skip widgets in other processes. |
| 2798 if (rvh->GetProcess()->GetID() != GetID()) | 2776 if (rvh->GetProcess()->GetID() != GetID()) |
| 2799 continue; | 2777 continue; |
| 2800 | 2778 |
| 2801 rvh->OnWebkitPreferencesChanged(); | 2779 rvh->OnWebkitPreferencesChanged(); |
| 2802 } | 2780 } |
| 2803 } | 2781 } |
| 2804 | 2782 |
| 2805 } // namespace content | 2783 } // namespace content |
| OLD | NEW |