OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/browser/renderer_host/browser_render_process_host.h" | 8 #include "chrome/browser/renderer_host/browser_render_process_host.h" |
9 | 9 |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 in_process_renderer_.reset(new RendererMainThread(channel_id)); | 319 in_process_renderer_.reset(new RendererMainThread(channel_id)); |
320 | 320 |
321 base::Thread::Options options; | 321 base::Thread::Options options; |
322 options.message_loop_type = MessageLoop::TYPE_IO; | 322 options.message_loop_type = MessageLoop::TYPE_IO; |
323 in_process_renderer_->StartWithOptions(options); | 323 in_process_renderer_->StartWithOptions(options); |
324 } else { | 324 } else { |
325 base::ProcessHandle process = 0; | 325 base::ProcessHandle process = 0; |
326 #if defined(OS_WIN) | 326 #if defined(OS_WIN) |
327 process = sandbox::StartProcess(&cmd_line); | 327 process = sandbox::StartProcess(&cmd_line); |
328 #else | 328 #else |
| 329 // NOTE: This code is duplicated with plugin_process_host.cc, but |
| 330 // there's not a good place to de-duplicate it. |
329 base::file_handle_mapping_vector fds_to_map; | 331 base::file_handle_mapping_vector fds_to_map; |
330 int src_fd = -1, dest_fd = -1; | 332 int src_fd = -1, dest_fd = -1; |
331 channel_->GetClientFileDescriptorMapping(&src_fd, &dest_fd); | 333 channel_->GetClientFileDescriptorMapping(&src_fd, &dest_fd); |
332 if (src_fd > -1) | 334 if (src_fd > -1) |
333 fds_to_map.push_back(std::pair<int, int>(src_fd, dest_fd)); | 335 fds_to_map.push_back(std::pair<int, int>(src_fd, dest_fd)); |
334 base::LaunchApp(cmd_line.argv(), fds_to_map, false, &process); | 336 base::LaunchApp(cmd_line.argv(), fds_to_map, false, &process); |
335 #endif | 337 #endif |
336 if (!process) { | 338 if (!process) { |
337 channel_.reset(); | 339 channel_.reset(); |
338 return false; | 340 return false; |
339 } | 341 } |
340 process_.set_handle(process); | 342 process_.set_handle(process); |
341 SetProcessID(process_.pid()); | 343 SetProcessID(process_.pid()); |
342 } | 344 } |
343 | 345 |
344 resource_message_filter->Init(pid()); | 346 resource_message_filter->Init(pid()); |
345 WebCacheManager::GetInstance()->Add(pid()); | 347 WebCacheManager::GetInstance()->Add(pid()); |
346 RendererSecurityPolicy::GetInstance()->Add(pid()); | 348 RendererSecurityPolicy::GetInstance()->Add(pid()); |
347 | 349 |
348 // Now that the process is created, set it's backgrounding accordingly. | 350 // Now that the process is created, set its backgrounding accordingly. |
349 SetBackgrounded(backgrounded_); | 351 SetBackgrounded(backgrounded_); |
350 | 352 |
351 InitVisitedLinks(); | 353 InitVisitedLinks(); |
352 InitUserScripts(); | 354 InitUserScripts(); |
353 InitExtensions(); | 355 InitExtensions(); |
354 | 356 |
355 if (max_page_id_ != -1) | 357 if (max_page_id_ != -1) |
356 channel_->Send(new ViewMsg_SetNextPageID(max_page_id_ + 1)); | 358 channel_->Send(new ViewMsg_SetNextPageID(max_page_id_ + 1)); |
357 | 359 |
358 return true; | 360 return true; |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 SendUserScriptsUpdate(shared_memory); | 769 SendUserScriptsUpdate(shared_memory); |
768 } | 770 } |
769 break; | 771 break; |
770 } | 772 } |
771 default: { | 773 default: { |
772 NOTREACHED(); | 774 NOTREACHED(); |
773 break; | 775 break; |
774 } | 776 } |
775 } | 777 } |
776 } | 778 } |
OLD | NEW |