| 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; | |
| 913 content::GPUInfo gpu_info; | 912 content::GPUInfo gpu_info; |
| 914 if (!Send(new GpuHostMsg_EstablishGpuChannel(cause_for_gpu_launch, | 913 if (!Send(new GpuHostMsg_EstablishGpuChannel(cause_for_gpu_launch, |
| 915 &client_id, | 914 &client_id, |
| 916 &channel_handle, | 915 &channel_handle, |
| 917 &renderer_process_for_gpu, | |
| 918 &gpu_info)) || | 916 &gpu_info)) || |
| 919 channel_handle.name.empty() || | |
| 920 #if defined(OS_POSIX) | 917 #if defined(OS_POSIX) |
| 921 channel_handle.socket.fd == -1 || | 918 channel_handle.socket.fd == -1 || |
| 922 #endif | 919 #endif |
| 923 renderer_process_for_gpu == base::kNullProcessHandle) { | 920 channel_handle.name.empty()) { |
| 924 // Otherwise cancel the connection. | 921 // Otherwise cancel the connection. |
| 925 gpu_channel_ = NULL; | 922 gpu_channel_ = NULL; |
| 926 return NULL; | 923 return NULL; |
| 927 } | 924 } |
| 928 | 925 |
| 929 gpu_channel_ = new GpuChannelHost(this, 0, client_id); | 926 gpu_channel_ = new GpuChannelHost(this, 0, client_id); |
| 930 gpu_channel_->set_gpu_info(gpu_info); | 927 gpu_channel_->set_gpu_info(gpu_info); |
| 931 content::GetContentClient()->SetGpuInfo(gpu_info); | 928 content::GetContentClient()->SetGpuInfo(gpu_info); |
| 932 | 929 |
| 933 // Connect to the GPU process if a channel name was received. | 930 // Connect to the GPU process if a channel name was received. |
| 934 gpu_channel_->Connect(channel_handle, renderer_process_for_gpu); | 931 gpu_channel_->Connect(channel_handle); |
| 935 | 932 |
| 936 return GetGpuChannel(); | 933 return GetGpuChannel(); |
| 937 } | 934 } |
| 938 | 935 |
| 939 WebKit::WebMediaStreamCenter* RenderThreadImpl::CreateMediaStreamCenter( | 936 WebKit::WebMediaStreamCenter* RenderThreadImpl::CreateMediaStreamCenter( |
| 940 WebKit::WebMediaStreamCenterClient* client) { | 937 WebKit::WebMediaStreamCenterClient* client) { |
| 941 #if defined(ENABLE_WEBRTC) | 938 #if defined(ENABLE_WEBRTC) |
| 942 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 939 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
| 943 switches::kEnableMediaStream)) { | 940 switches::kEnableMediaStream)) { |
| 944 return NULL; | 941 return NULL; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 984 | 981 |
| 985 scoped_refptr<base::MessageLoopProxy> | 982 scoped_refptr<base::MessageLoopProxy> |
| 986 RenderThreadImpl::GetFileThreadMessageLoopProxy() { | 983 RenderThreadImpl::GetFileThreadMessageLoopProxy() { |
| 987 DCHECK(message_loop() == MessageLoop::current()); | 984 DCHECK(message_loop() == MessageLoop::current()); |
| 988 if (!file_thread_.get()) { | 985 if (!file_thread_.get()) { |
| 989 file_thread_.reset(new base::Thread("Renderer::FILE")); | 986 file_thread_.reset(new base::Thread("Renderer::FILE")); |
| 990 file_thread_->Start(); | 987 file_thread_->Start(); |
| 991 } | 988 } |
| 992 return file_thread_->message_loop_proxy(); | 989 return file_thread_->message_loop_proxy(); |
| 993 } | 990 } |
| OLD | NEW |