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