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

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

Issue 1903663004: IPC: Fix attachment brokering race condition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase (scoped_ptr->std::unique_ptr) 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 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 if (renderer_path.empty()) 716 if (renderer_path.empty())
717 return false; 717 return false;
718 718
719 channel_connected_ = false; 719 channel_connected_ = false;
720 sent_render_process_ready_ = false; 720 sent_render_process_ready_ = false;
721 721
722 // Setup the IPC channel. 722 // Setup the IPC channel.
723 const std::string channel_id = 723 const std::string channel_id =
724 IPC::Channel::GenerateVerifiedChannelID(std::string()); 724 IPC::Channel::GenerateVerifiedChannelID(std::string());
725 channel_ = CreateChannelProxy(channel_id); 725 channel_ = CreateChannelProxy(channel_id);
726 #if USE_ATTACHMENT_BROKER
727 IPC::AttachmentBroker::GetGlobal()->RegisterCommunicationChannel(
728 channel_.get(), content::BrowserThread::GetMessageLoopProxyForThread(
729 content::BrowserThread::IO));
730 #endif
731 726
732 // Call the embedder first so that their IPC filters have priority. 727 // Call the embedder first so that their IPC filters have priority.
733 GetContentClient()->browser()->RenderProcessWillLaunch(this); 728 GetContentClient()->browser()->RenderProcessWillLaunch(this);
734 729
735 CreateMessageFilters(); 730 CreateMessageFilters();
736 RegisterMojoServices(); 731 RegisterMojoServices();
737 732
738 if (run_renderer_in_process()) { 733 if (run_renderer_in_process()) {
739 DCHECK(g_renderer_main_thread_factory); 734 DCHECK(g_renderer_main_thread_factory);
740 // Crank up a thread and run the initialization there. With the way that 735 // Crank up a thread and run the initialization there. With the way that
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 // for Android WebView to maintain backward compatibility. 811 // for Android WebView to maintain backward compatibility.
817 // See crbug.com/526842 for details. 812 // See crbug.com/526842 for details.
818 #if defined(OS_ANDROID) 813 #if defined(OS_ANDROID)
819 if (GetContentClient()->UsingSynchronousCompositing()) { 814 if (GetContentClient()->UsingSynchronousCompositing()) {
820 return IPC::SyncChannel::Create( 815 return IPC::SyncChannel::Create(
821 IPC::ChannelMojo::CreateServerFactory(std::move(handle)), this, 816 IPC::ChannelMojo::CreateServerFactory(std::move(handle)), this,
822 runner.get(), true, &never_signaled_); 817 runner.get(), true, &never_signaled_);
823 } 818 }
824 #endif // OS_ANDROID 819 #endif // OS_ANDROID
825 820
826 return IPC::ChannelProxy::Create( 821 std::unique_ptr<IPC::ChannelProxy> channel(
827 IPC::ChannelMojo::CreateServerFactory(std::move(handle)), this, 822 new IPC::ChannelProxy(this, runner.get()));
828 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;
829 } 830 }
830 831
831 // Do NOT expand ifdef or run time condition checks here! See comment above. 832 // Do NOT expand ifdef or run time condition checks here! See comment above.
832 #if defined(OS_ANDROID) 833 #if defined(OS_ANDROID)
833 if (GetContentClient()->UsingSynchronousCompositing()) { 834 if (GetContentClient()->UsingSynchronousCompositing()) {
834 return IPC::SyncChannel::Create(channel_id, IPC::Channel::MODE_SERVER, this, 835 return IPC::SyncChannel::Create(channel_id, IPC::Channel::MODE_SERVER, this,
835 runner.get(), true, &never_signaled_); 836 runner.get(), true, &never_signaled_);
836 } 837 }
837 #endif // OS_ANDROID 838 #endif // OS_ANDROID
838 839
839 return IPC::ChannelProxy::Create(channel_id, IPC::Channel::MODE_SERVER, this, 840 std::unique_ptr<IPC::ChannelProxy> channel(
840 runner.get()); 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;
841 } 849 }
842 850
843 void RenderProcessHostImpl::CreateMessageFilters() { 851 void RenderProcessHostImpl::CreateMessageFilters() {
844 DCHECK_CURRENTLY_ON(BrowserThread::UI); 852 DCHECK_CURRENTLY_ON(BrowserThread::UI);
845 const base::CommandLine& browser_command_line = 853 const base::CommandLine& browser_command_line =
846 *base::CommandLine::ForCurrentProcess(); 854 *base::CommandLine::ForCurrentProcess();
847 AddFilter(new ResourceSchedulerFilter(GetID())); 855 AddFilter(new ResourceSchedulerFilter(GetID()));
848 MediaInternals* media_internals = MediaInternals::GetInstance(); 856 MediaInternals* media_internals = MediaInternals::GetInstance();
849 media::AudioManager* audio_manager = 857 media::AudioManager* audio_manager =
850 BrowserMainLoop::GetInstance()->audio_manager(); 858 BrowserMainLoop::GetInstance()->audio_manager();
(...skipping 1938 matching lines...) Expand 10 before | Expand all | Expand 10 after
2789 2797
2790 // Skip widgets in other processes. 2798 // Skip widgets in other processes.
2791 if (rvh->GetProcess()->GetID() != GetID()) 2799 if (rvh->GetProcess()->GetID() != GetID())
2792 continue; 2800 continue;
2793 2801
2794 rvh->OnWebkitPreferencesChanged(); 2802 rvh->OnWebkitPreferencesChanged();
2795 } 2803 }
2796 } 2804 }
2797 2805
2798 } // namespace content 2806 } // 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