OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "content/renderer/render_thread_impl.h" | 5 #include "content/renderer/render_thread_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <map> | 9 #include <map> |
10 #include <vector> | 10 #include <vector> |
(...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
902 gpu_channel_->state() == GpuChannelHost::kConnected) | 902 gpu_channel_->state() == GpuChannelHost::kConnected) |
903 return GetGpuChannel(); | 903 return GetGpuChannel(); |
904 | 904 |
905 // Recreate the channel if it has been lost. | 905 // Recreate the channel if it has been lost. |
906 gpu_channel_ = NULL; | 906 gpu_channel_ = NULL; |
907 } | 907 } |
908 | 908 |
909 // Ask the browser for the channel name. | 909 // Ask the browser for the channel name. |
910 int client_id = 0; | 910 int client_id = 0; |
911 IPC::ChannelHandle channel_handle; | 911 IPC::ChannelHandle channel_handle; |
| 912 base::ProcessHandle renderer_process_for_gpu; |
912 content::GPUInfo gpu_info; | 913 content::GPUInfo gpu_info; |
913 if (!Send(new GpuHostMsg_EstablishGpuChannel(cause_for_gpu_launch, | 914 if (!Send(new GpuHostMsg_EstablishGpuChannel(cause_for_gpu_launch, |
914 &client_id, | 915 &client_id, |
915 &channel_handle, | 916 &channel_handle, |
| 917 &renderer_process_for_gpu, |
916 &gpu_info)) || | 918 &gpu_info)) || |
| 919 channel_handle.name.empty() || |
917 #if defined(OS_POSIX) | 920 #if defined(OS_POSIX) |
918 channel_handle.socket.fd == -1 || | 921 channel_handle.socket.fd == -1 || |
919 #endif | 922 #endif |
920 channel_handle.name.empty()) { | 923 renderer_process_for_gpu == base::kNullProcessHandle) { |
921 // Otherwise cancel the connection. | 924 // Otherwise cancel the connection. |
922 gpu_channel_ = NULL; | 925 gpu_channel_ = NULL; |
923 return NULL; | 926 return NULL; |
924 } | 927 } |
925 | 928 |
926 gpu_channel_ = new GpuChannelHost(this, 0, client_id); | 929 gpu_channel_ = new GpuChannelHost(this, 0, client_id); |
927 gpu_channel_->set_gpu_info(gpu_info); | 930 gpu_channel_->set_gpu_info(gpu_info); |
928 content::GetContentClient()->SetGpuInfo(gpu_info); | 931 content::GetContentClient()->SetGpuInfo(gpu_info); |
929 | 932 |
930 // Connect to the GPU process if a channel name was received. | 933 // Connect to the GPU process if a channel name was received. |
931 gpu_channel_->Connect(channel_handle); | 934 gpu_channel_->Connect(channel_handle, renderer_process_for_gpu); |
932 | 935 |
933 return GetGpuChannel(); | 936 return GetGpuChannel(); |
934 } | 937 } |
935 | 938 |
936 WebKit::WebMediaStreamCenter* RenderThreadImpl::CreateMediaStreamCenter( | 939 WebKit::WebMediaStreamCenter* RenderThreadImpl::CreateMediaStreamCenter( |
937 WebKit::WebMediaStreamCenterClient* client) { | 940 WebKit::WebMediaStreamCenterClient* client) { |
938 #if defined(ENABLE_WEBRTC) | 941 #if defined(ENABLE_WEBRTC) |
939 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 942 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
940 switches::kEnableMediaStream)) { | 943 switches::kEnableMediaStream)) { |
941 return NULL; | 944 return NULL; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 | 984 |
982 scoped_refptr<base::MessageLoopProxy> | 985 scoped_refptr<base::MessageLoopProxy> |
983 RenderThreadImpl::GetFileThreadMessageLoopProxy() { | 986 RenderThreadImpl::GetFileThreadMessageLoopProxy() { |
984 DCHECK(message_loop() == MessageLoop::current()); | 987 DCHECK(message_loop() == MessageLoop::current()); |
985 if (!file_thread_.get()) { | 988 if (!file_thread_.get()) { |
986 file_thread_.reset(new base::Thread("Renderer::FILE")); | 989 file_thread_.reset(new base::Thread("Renderer::FILE")); |
987 file_thread_->Start(); | 990 file_thread_->Start(); |
988 } | 991 } |
989 return file_thread_->message_loop_proxy(); | 992 return file_thread_->message_loop_proxy(); |
990 } | 993 } |
OLD | NEW |