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

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

Issue 1917333002: IPC: Fix attachment brokering race condition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 7 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
« no previous file with comments | « components/nacl/loader/nacl_listener.cc ('k') | content/child/child_thread_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 708 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 if (renderer_path.empty()) 719 if (renderer_path.empty())
720 return false; 720 return false;
721 721
722 channel_connected_ = false; 722 channel_connected_ = false;
723 sent_render_process_ready_ = false; 723 sent_render_process_ready_ = false;
724 724
725 // Setup the IPC channel. 725 // Setup the IPC channel.
726 const std::string channel_id = 726 const std::string channel_id =
727 IPC::Channel::GenerateVerifiedChannelID(std::string()); 727 IPC::Channel::GenerateVerifiedChannelID(std::string());
728 channel_ = CreateChannelProxy(channel_id); 728 channel_ = CreateChannelProxy(channel_id);
729 #if USE_ATTACHMENT_BROKER
730 IPC::AttachmentBroker::GetGlobal()->RegisterCommunicationChannel(
731 channel_.get(), content::BrowserThread::GetMessageLoopProxyForThread(
732 content::BrowserThread::IO));
733 #endif
734 729
735 // Setup the Mojo channel. 730 // Setup the Mojo channel.
736 mojo_application_host_->Init(); 731 mojo_application_host_->Init();
737 732
738 // Call the embedder first so that their IPC filters have priority. 733 // Call the embedder first so that their IPC filters have priority.
739 GetContentClient()->browser()->RenderProcessWillLaunch(this); 734 GetContentClient()->browser()->RenderProcessWillLaunch(this);
740 735
741 CreateMessageFilters(); 736 CreateMessageFilters();
742 RegisterMojoServices(); 737 RegisterMojoServices();
743 738
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 // See crbug.com/526842 for details. 825 // See crbug.com/526842 for details.
831 #if defined(OS_ANDROID) 826 #if defined(OS_ANDROID)
832 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 827 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
833 switches::kIPCSyncCompositing)) { 828 switches::kIPCSyncCompositing)) {
834 return IPC::SyncChannel::Create( 829 return IPC::SyncChannel::Create(
835 IPC::ChannelMojo::CreateServerFactory(std::move(handle)), this, 830 IPC::ChannelMojo::CreateServerFactory(std::move(handle)), this,
836 runner.get(), true, &never_signaled_); 831 runner.get(), true, &never_signaled_);
837 } 832 }
838 #endif // OS_ANDROID 833 #endif // OS_ANDROID
839 834
840 return IPC::ChannelProxy::Create( 835 std::unique_ptr<IPC::ChannelProxy> channel(
841 IPC::ChannelMojo::CreateServerFactory(std::move(handle)), this, 836 new IPC::ChannelProxy(this, runner.get()));
842 runner.get()); 837 #if USE_ATTACHMENT_BROKER
838 IPC::AttachmentBroker::GetGlobal()->RegisterCommunicationChannel(
839 channel.get(), content::BrowserThread::GetMessageLoopProxyForThread(
840 content::BrowserThread::IO));
841 #endif
842 channel->Init(IPC::ChannelMojo::CreateServerFactory(std::move(handle)), true);
843 return channel;
843 } 844 }
844 845
845 // Do NOT expand ifdef or run time condition checks here! See comment above. 846 // Do NOT expand ifdef or run time condition checks here! See comment above.
846 #if defined(OS_ANDROID) 847 #if defined(OS_ANDROID)
847 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 848 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
848 switches::kIPCSyncCompositing)) { 849 switches::kIPCSyncCompositing)) {
849 return IPC::SyncChannel::Create(channel_id, IPC::Channel::MODE_SERVER, this, 850 return IPC::SyncChannel::Create(channel_id, IPC::Channel::MODE_SERVER, this,
850 runner.get(), true, &never_signaled_); 851 runner.get(), true, &never_signaled_);
851 } 852 }
852 #endif // OS_ANDROID 853 #endif // OS_ANDROID
853 854
854 return IPC::ChannelProxy::Create(channel_id, IPC::Channel::MODE_SERVER, this, 855 std::unique_ptr<IPC::ChannelProxy> channel(
855 runner.get()); 856 new IPC::ChannelProxy(this, runner.get()));
857 #if USE_ATTACHMENT_BROKER
858 IPC::AttachmentBroker::GetGlobal()->RegisterCommunicationChannel(
859 channel.get(), content::BrowserThread::GetMessageLoopProxyForThread(
860 content::BrowserThread::IO));
861 #endif
862 channel->Init(channel_id, IPC::Channel::MODE_SERVER, true);
863 return channel;
856 } 864 }
857 865
858 void RenderProcessHostImpl::CreateMessageFilters() { 866 void RenderProcessHostImpl::CreateMessageFilters() {
859 DCHECK_CURRENTLY_ON(BrowserThread::UI); 867 DCHECK_CURRENTLY_ON(BrowserThread::UI);
860 const base::CommandLine& browser_command_line = 868 const base::CommandLine& browser_command_line =
861 *base::CommandLine::ForCurrentProcess(); 869 *base::CommandLine::ForCurrentProcess();
862 AddFilter(new ResourceSchedulerFilter(GetID())); 870 AddFilter(new ResourceSchedulerFilter(GetID()));
863 MediaInternals* media_internals = MediaInternals::GetInstance(); 871 MediaInternals* media_internals = MediaInternals::GetInstance();
864 media::AudioManager* audio_manager = 872 media::AudioManager* audio_manager =
865 BrowserMainLoop::GetInstance()->audio_manager(); 873 BrowserMainLoop::GetInstance()->audio_manager();
(...skipping 1962 matching lines...) Expand 10 before | Expand all | Expand 10 after
2828 2836
2829 // Skip widgets in other processes. 2837 // Skip widgets in other processes.
2830 if (rvh->GetProcess()->GetID() != GetID()) 2838 if (rvh->GetProcess()->GetID() != GetID())
2831 continue; 2839 continue;
2832 2840
2833 rvh->OnWebkitPreferencesChanged(); 2841 rvh->OnWebkitPreferencesChanged();
2834 } 2842 }
2835 } 2843 }
2836 2844
2837 } // namespace content 2845 } // namespace content
OLDNEW
« no previous file with comments | « components/nacl/loader/nacl_listener.cc ('k') | content/child/child_thread_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698