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

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

Issue 208263008: Revert 258763 "Adds plumbing to pass WebUI mojo::Handle from bro..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 9 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 // 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 #endif 154 #endif
155 155
156 #if defined(ENABLE_WEBRTC) 156 #if defined(ENABLE_WEBRTC)
157 #include "content/browser/media/webrtc_internals.h" 157 #include "content/browser/media/webrtc_internals.h"
158 #include "content/browser/renderer_host/media/media_stream_track_metrics_host.h" 158 #include "content/browser/renderer_host/media/media_stream_track_metrics_host.h"
159 #include "content/browser/renderer_host/media/webrtc_identity_service_host.h" 159 #include "content/browser/renderer_host/media/webrtc_identity_service_host.h"
160 #include "content/common/media/media_stream_messages.h" 160 #include "content/common/media/media_stream_messages.h"
161 #endif 161 #endif
162 162
163 #if defined(USE_MOJO) 163 #if defined(USE_MOJO)
164 #include "content/browser/renderer_host/render_process_host_mojo_impl.h" 164 #include "content/common/mojo/mojo_channel_init.h"
165 #include "content/common/mojo/mojo_messages.h"
166 #include "mojo/embedder/platform_channel_pair.h"
165 #endif 167 #endif
166 168
167 extern bool g_exited_main_message_loop; 169 extern bool g_exited_main_message_loop;
168 170
169 static const char* kSiteProcessMapKeyName = "content_site_process_map"; 171 static const char* kSiteProcessMapKeyName = "content_site_process_map";
170 172
171 namespace content { 173 namespace content {
172 namespace { 174 namespace {
173 175
174 void CacheShaderInfo(int32 id, base::FilePath path) { 176 void CacheShaderInfo(int32 id, base::FilePath path) {
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 return ipc_fd_; 324 return ipc_fd_;
323 } 325 }
324 #endif // OS_WIN 326 #endif // OS_WIN
325 327
326 private: 328 private:
327 #if defined(OS_POSIX) 329 #if defined(OS_POSIX)
328 int ipc_fd_; 330 int ipc_fd_;
329 #endif // OS_POSIX 331 #endif // OS_POSIX
330 }; 332 };
331 333
334 #if defined(USE_MOJO)
335 base::PlatformFile PlatformFileFromScopedPlatformHandle(
336 mojo::embedder::ScopedPlatformHandle handle) {
337 #if defined(OS_POSIX)
338 return handle.release().fd;
339 #elif defined(OS_WIN)
340 return handle.release().handle;
341 #endif
342 }
343 #endif
344
332 } // namespace 345 } // namespace
333 346
334 RendererMainThreadFactoryFunction g_renderer_main_thread_factory = NULL; 347 RendererMainThreadFactoryFunction g_renderer_main_thread_factory = NULL;
335 348
336 void RenderProcessHost::RegisterRendererMainThreadFactory( 349 void RenderProcessHost::RegisterRendererMainThreadFactory(
337 RendererMainThreadFactoryFunction create) { 350 RendererMainThreadFactoryFunction create) {
338 g_renderer_main_thread_factory = create; 351 g_renderer_main_thread_factory = create;
339 } 352 }
340 353
341 base::MessageLoop* g_in_process_thread; 354 base::MessageLoop* g_in_process_thread;
(...skipping 1579 matching lines...) Expand 10 before | Expand all | Expand 10 after
1921 while (!iter.IsAtEnd()) { 1934 while (!iter.IsAtEnd()) {
1922 iter.GetCurrentValue()->OnMessageReceived( 1935 iter.GetCurrentValue()->OnMessageReceived(
1923 ViewHostMsg_RenderProcessGone(iter.GetCurrentKey(), 1936 ViewHostMsg_RenderProcessGone(iter.GetCurrentKey(),
1924 static_cast<int>(status), 1937 static_cast<int>(status),
1925 exit_code)); 1938 exit_code));
1926 iter.Advance(); 1939 iter.Advance();
1927 } 1940 }
1928 1941
1929 ClearTransportDIBCache(); 1942 ClearTransportDIBCache();
1930 1943
1931 #if defined(USE_MOJO)
1932 render_process_host_mojo_.reset();
1933 #endif
1934
1935 // It's possible that one of the calls out to the observers might have caused 1944 // It's possible that one of the calls out to the observers might have caused
1936 // this object to be no longer needed. 1945 // this object to be no longer needed.
1937 if (delayed_cleanup_needed_) 1946 if (delayed_cleanup_needed_)
1938 Cleanup(); 1947 Cleanup();
1939 1948
1940 // This object is not deleted at this point and might be reused later. 1949 // This object is not deleted at this point and might be reused later.
1941 // TODO(darin): clean this up 1950 // TODO(darin): clean this up
1942 } 1951 }
1943 1952
1944 int RenderProcessHostImpl::GetActiveViewCount() { 1953 int RenderProcessHostImpl::GetActiveViewCount() {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
2067 2076
2068 while (!queued_messages_.empty()) { 2077 while (!queued_messages_.empty()) {
2069 Send(queued_messages_.front()); 2078 Send(queued_messages_.front());
2070 queued_messages_.pop(); 2079 queued_messages_.pop();
2071 } 2080 }
2072 2081
2073 #if defined(ENABLE_WEBRTC) 2082 #if defined(ENABLE_WEBRTC)
2074 if (WebRTCInternals::GetInstance()->aec_dump_enabled()) 2083 if (WebRTCInternals::GetInstance()->aec_dump_enabled())
2075 EnableAecDump(WebRTCInternals::GetInstance()->aec_dump_file_path()); 2084 EnableAecDump(WebRTCInternals::GetInstance()->aec_dump_file_path());
2076 #endif 2085 #endif
2077
2078 #if defined(USE_MOJO)
2079 if (render_process_host_mojo_.get())
2080 render_process_host_mojo_->OnProcessLaunched();
2081 #endif
2082 } 2086 }
2083 2087
2084 scoped_refptr<AudioRendererHost> 2088 scoped_refptr<AudioRendererHost>
2085 RenderProcessHostImpl::audio_renderer_host() const { 2089 RenderProcessHostImpl::audio_renderer_host() const {
2086 return audio_renderer_host_; 2090 return audio_renderer_host_;
2087 } 2091 }
2088 2092
2089 void RenderProcessHostImpl::OnUserMetricsRecordAction( 2093 void RenderProcessHostImpl::OnUserMetricsRecordAction(
2090 const std::string& action) { 2094 const std::string& action) {
2091 RecordComputedAction(action); 2095 RecordComputedAction(action);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
2146 2150
2147 void RenderProcessHostImpl::DecrementWorkerRefCount() { 2151 void RenderProcessHostImpl::DecrementWorkerRefCount() {
2148 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 2152 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
2149 DCHECK_GT(worker_ref_count_, 0); 2153 DCHECK_GT(worker_ref_count_, 0);
2150 --worker_ref_count_; 2154 --worker_ref_count_;
2151 if (worker_ref_count_ == 0) 2155 if (worker_ref_count_ == 0)
2152 Cleanup(); 2156 Cleanup();
2153 } 2157 }
2154 2158
2155 #if defined(USE_MOJO) 2159 #if defined(USE_MOJO)
2156 void RenderProcessHostImpl::SetWebUIHandle( 2160 void RenderProcessHostImpl::CreateMojoChannel() {
2157 int32 view_routing_id, 2161 if (mojo_channel_init_.get())
2158 mojo::ScopedMessagePipeHandle handle) { 2162 return;
2159 if (!render_process_host_mojo_) 2163
2160 render_process_host_mojo_.reset(new RenderProcessHostMojoImpl(this)); 2164 mojo::embedder::PlatformChannelPair channel_pair;
2161 render_process_host_mojo_->SetWebUIHandle(view_routing_id, handle.Pass()); 2165 mojo_channel_init_.reset(new MojoChannelInit);
2166 mojo_channel_init_->Init(
2167 PlatformFileFromScopedPlatformHandle(channel_pair.PassServerHandle()),
2168 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
2169 if (mojo_channel_init_->is_handle_valid()) {
2170 base::ProcessHandle process_handle = run_renderer_in_process() ?
2171 base::Process::Current().handle() :
2172 child_process_launcher_->GetHandle();
2173 base::PlatformFile client_file =
2174 PlatformFileFromScopedPlatformHandle(channel_pair.PassClientHandle());
2175 Send(new MojoMsg_ChannelCreated(
2176 IPC::GetFileHandleForProcess(client_file, process_handle, true)));
2177 }
2162 } 2178 }
2163 #endif 2179 #endif
2164 2180
2165 } // namespace content 2181 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698