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

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

Issue 1960513002: [Merge to M50] IPC: Fix attachment brokering race condition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
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 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 if (renderer_path.empty()) 722 if (renderer_path.empty())
723 return false; 723 return false;
724 724
725 channel_connected_ = false; 725 channel_connected_ = false;
726 sent_render_process_ready_ = false; 726 sent_render_process_ready_ = false;
727 727
728 // Setup the IPC channel. 728 // Setup the IPC channel.
729 const std::string channel_id = 729 const std::string channel_id =
730 IPC::Channel::GenerateVerifiedChannelID(std::string()); 730 IPC::Channel::GenerateVerifiedChannelID(std::string());
731 channel_ = CreateChannelProxy(channel_id); 731 channel_ = CreateChannelProxy(channel_id);
732 #if USE_ATTACHMENT_BROKER
733 IPC::AttachmentBroker::GetGlobal()->RegisterCommunicationChannel(
734 channel_.get());
735 #endif
736 732
737 // Setup the Mojo channel. 733 // Setup the Mojo channel.
738 mojo_application_host_->Init(); 734 mojo_application_host_->Init();
739 735
740 // Call the embedder first so that their IPC filters have priority. 736 // Call the embedder first so that their IPC filters have priority.
741 GetContentClient()->browser()->RenderProcessWillLaunch(this); 737 GetContentClient()->browser()->RenderProcessWillLaunch(this);
742 738
743 CreateMessageFilters(); 739 CreateMessageFilters();
744 RegisterMojoServices(); 740 RegisterMojoServices();
745 741
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 // See crbug.com/526842 for details. 820 // See crbug.com/526842 for details.
825 #if defined(OS_ANDROID) 821 #if defined(OS_ANDROID)
826 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 822 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
827 switches::kIPCSyncCompositing)) { 823 switches::kIPCSyncCompositing)) {
828 return IPC::SyncChannel::Create( 824 return IPC::SyncChannel::Create(
829 IPC::ChannelMojo::CreateServerFactory(mojo_task_runner, channel_id), 825 IPC::ChannelMojo::CreateServerFactory(mojo_task_runner, channel_id),
830 this, runner.get(), true, &never_signaled_); 826 this, runner.get(), true, &never_signaled_);
831 } 827 }
832 #endif // OS_ANDROID 828 #endif // OS_ANDROID
833 829
834 return IPC::ChannelProxy::Create( 830 scoped_ptr<IPC::ChannelProxy> channel(
835 IPC::ChannelMojo::CreateServerFactory(mojo_task_runner, channel_id), 831 new IPC::ChannelProxy(this, runner.get()));
836 this, runner.get()); 832 #if USE_ATTACHMENT_BROKER
833 IPC::AttachmentBroker::GetGlobal()->RegisterCommunicationChannel(
834 channel.get());
835 #endif
836 channel->Init(
837 IPC::ChannelMojo::CreateServerFactory(mojo_task_runner, channel_id),
838 true);
839 return channel;
837 } 840 }
838 841
839 // Do NOT expand ifdef or run time condition checks here! See comment above. 842 // Do NOT expand ifdef or run time condition checks here! See comment above.
840 #if defined(OS_ANDROID) 843 #if defined(OS_ANDROID)
841 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 844 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
842 switches::kIPCSyncCompositing)) { 845 switches::kIPCSyncCompositing)) {
843 return IPC::SyncChannel::Create(channel_id, IPC::Channel::MODE_SERVER, this, 846 return IPC::SyncChannel::Create(channel_id, IPC::Channel::MODE_SERVER, this,
844 runner.get(), true, &never_signaled_); 847 runner.get(), true, &never_signaled_);
845 } 848 }
846 #endif // OS_ANDROID 849 #endif // OS_ANDROID
847 850
848 return IPC::ChannelProxy::Create(channel_id, IPC::Channel::MODE_SERVER, this, 851 scoped_ptr<IPC::ChannelProxy> channel(
849 runner.get()); 852 new IPC::ChannelProxy(this, runner.get()));
853 #if USE_ATTACHMENT_BROKER
854 IPC::AttachmentBroker::GetGlobal()->RegisterCommunicationChannel(
855 channel.get());
856 #endif
857 channel->Init(channel_id, IPC::Channel::MODE_SERVER, true);
858 return channel;
850 } 859 }
851 860
852 void RenderProcessHostImpl::CreateMessageFilters() { 861 void RenderProcessHostImpl::CreateMessageFilters() {
853 DCHECK_CURRENTLY_ON(BrowserThread::UI); 862 DCHECK_CURRENTLY_ON(BrowserThread::UI);
854 const base::CommandLine& browser_command_line = 863 const base::CommandLine& browser_command_line =
855 *base::CommandLine::ForCurrentProcess(); 864 *base::CommandLine::ForCurrentProcess();
856 AddFilter(new ResourceSchedulerFilter(GetID())); 865 AddFilter(new ResourceSchedulerFilter(GetID()));
857 MediaInternals* media_internals = MediaInternals::GetInstance(); 866 MediaInternals* media_internals = MediaInternals::GetInstance();
858 media::AudioManager* audio_manager = 867 media::AudioManager* audio_manager =
859 BrowserMainLoop::GetInstance()->audio_manager(); 868 BrowserMainLoop::GetInstance()->audio_manager();
(...skipping 1957 matching lines...) Expand 10 before | Expand all | Expand 10 after
2817 2826
2818 // Skip widgets in other processes. 2827 // Skip widgets in other processes.
2819 if (rvh->GetProcess()->GetID() != GetID()) 2828 if (rvh->GetProcess()->GetID() != GetID())
2820 continue; 2829 continue;
2821 2830
2822 rvh->OnWebkitPreferencesChanged(); 2831 rvh->OnWebkitPreferencesChanged();
2823 } 2832 }
2824 } 2833 }
2825 2834
2826 } // namespace content 2835 } // 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