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

Side by Side Diff: content/renderer/render_thread_impl.cc

Issue 9958034: Convert plugin and GPU process to brokered handle duplication. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 8 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 | Annotate | Revision Log
OLDNEW
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 893 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 gpu_channel_->state() == GpuChannelHost::kConnected) 904 gpu_channel_->state() == GpuChannelHost::kConnected)
905 return GetGpuChannel(); 905 return GetGpuChannel();
906 906
907 // Recreate the channel if it has been lost. 907 // Recreate the channel if it has been lost.
908 gpu_channel_ = NULL; 908 gpu_channel_ = NULL;
909 } 909 }
910 910
911 // Ask the browser for the channel name. 911 // Ask the browser for the channel name.
912 int client_id = 0; 912 int client_id = 0;
913 IPC::ChannelHandle channel_handle; 913 IPC::ChannelHandle channel_handle;
914 base::ProcessHandle renderer_process_for_gpu;
915 content::GPUInfo gpu_info; 914 content::GPUInfo gpu_info;
916 if (!Send(new GpuHostMsg_EstablishGpuChannel(cause_for_gpu_launch, 915 if (!Send(new GpuHostMsg_EstablishGpuChannel(cause_for_gpu_launch,
917 &client_id, 916 &client_id,
918 &channel_handle, 917 &channel_handle,
919 &renderer_process_for_gpu,
920 &gpu_info)) || 918 &gpu_info)) ||
921 channel_handle.name.empty() ||
922 #if defined(OS_POSIX) 919 #if defined(OS_POSIX)
923 channel_handle.socket.fd == -1 || 920 channel_handle.socket.fd == -1 ||
924 #endif 921 #endif
925 renderer_process_for_gpu == base::kNullProcessHandle) { 922 channel_handle.name.empty()) {
926 // Otherwise cancel the connection. 923 // Otherwise cancel the connection.
927 gpu_channel_ = NULL; 924 gpu_channel_ = NULL;
928 return NULL; 925 return NULL;
929 } 926 }
930 927
931 gpu_channel_ = new GpuChannelHost(this, 0, client_id); 928 gpu_channel_ = new GpuChannelHost(this, 0, client_id);
932 gpu_channel_->set_gpu_info(gpu_info); 929 gpu_channel_->set_gpu_info(gpu_info);
933 content::GetContentClient()->SetGpuInfo(gpu_info); 930 content::GetContentClient()->SetGpuInfo(gpu_info);
934 931
935 // Connect to the GPU process if a channel name was received. 932 // Connect to the GPU process if a channel name was received.
936 gpu_channel_->Connect(channel_handle, renderer_process_for_gpu); 933 gpu_channel_->Connect(channel_handle);
937 934
938 return GetGpuChannel(); 935 return GetGpuChannel();
939 } 936 }
940 937
941 WebKit::WebMediaStreamCenter* RenderThreadImpl::CreateMediaStreamCenter( 938 WebKit::WebMediaStreamCenter* RenderThreadImpl::CreateMediaStreamCenter(
942 WebKit::WebMediaStreamCenterClient* client) { 939 WebKit::WebMediaStreamCenterClient* client) {
943 #if defined(ENABLE_WEBRTC) 940 #if defined(ENABLE_WEBRTC)
944 if (!CommandLine::ForCurrentProcess()->HasSwitch( 941 if (!CommandLine::ForCurrentProcess()->HasSwitch(
945 switches::kEnableMediaStream)) { 942 switches::kEnableMediaStream)) {
946 return NULL; 943 return NULL;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 983
987 scoped_refptr<base::MessageLoopProxy> 984 scoped_refptr<base::MessageLoopProxy>
988 RenderThreadImpl::GetFileThreadMessageLoopProxy() { 985 RenderThreadImpl::GetFileThreadMessageLoopProxy() {
989 DCHECK(message_loop() == MessageLoop::current()); 986 DCHECK(message_loop() == MessageLoop::current());
990 if (!file_thread_.get()) { 987 if (!file_thread_.get()) {
991 file_thread_.reset(new base::Thread("Renderer::FILE")); 988 file_thread_.reset(new base::Thread("Renderer::FILE"));
992 file_thread_->Start(); 989 file_thread_->Start();
993 } 990 }
994 return file_thread_->message_loop_proxy(); 991 return file_thread_->message_loop_proxy();
995 } 992 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698