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

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

Issue 2585963002: Clarifying the parameters ownership of BrowserChildProcessHost::Launch() (Closed)
Patch Set: Fixed crasher on Windows. Created 4 years 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 865 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 in_process_renderer_->StartWithOptions(options); 876 in_process_renderer_->StartWithOptions(options);
877 877
878 g_in_process_thread = in_process_renderer_->message_loop(); 878 g_in_process_thread = in_process_renderer_->message_loop();
879 879
880 // Make sure any queued messages on the channel are flushed in the case 880 // Make sure any queued messages on the channel are flushed in the case
881 // where we aren't launching a child process. 881 // where we aren't launching a child process.
882 channel_->Flush(); 882 channel_->Flush();
883 } else { 883 } else {
884 // Build command line for renderer. We call AppendRendererCommandLine() 884 // Build command line for renderer. We call AppendRendererCommandLine()
885 // first so the process type argument will appear first. 885 // first so the process type argument will appear first.
886 base::CommandLine* cmd_line = new base::CommandLine(renderer_path); 886 std::unique_ptr<base::CommandLine> cmd_line =
887 base::MakeUnique<base::CommandLine>(renderer_path);
887 if (!renderer_prefix.empty()) 888 if (!renderer_prefix.empty())
888 cmd_line->PrependWrapper(renderer_prefix); 889 cmd_line->PrependWrapper(renderer_prefix);
889 AppendRendererCommandLine(cmd_line); 890 AppendRendererCommandLine(cmd_line.get());
890 891
891 // Spawn the child process asynchronously to avoid blocking the UI thread. 892 // Spawn the child process asynchronously to avoid blocking the UI thread.
892 // As long as there's no renderer prefix, we can use the zygote process 893 // As long as there's no renderer prefix, we can use the zygote process
893 // at this stage. 894 // at this stage.
894 child_process_launcher_.reset(new ChildProcessLauncher( 895 child_process_launcher_.reset(new ChildProcessLauncher(
895 new RendererSandboxedProcessLauncherDelegate(), cmd_line, GetID(), this, 896 base::MakeUnique<RendererSandboxedProcessLauncherDelegate>(),
896 child_token_, base::Bind(&RenderProcessHostImpl::OnMojoError, id_))); 897 std::move(cmd_line), GetID(), this, child_token_,
898 base::Bind(&RenderProcessHostImpl::OnMojoError, id_)));
897 channel_->Pause(); 899 channel_->Pause();
898 900
899 fast_shutdown_started_ = false; 901 fast_shutdown_started_ = false;
900 } 902 }
901 903
902 if (!gpu_observer_registered_) { 904 if (!gpu_observer_registered_) {
903 gpu_observer_registered_ = true; 905 gpu_observer_registered_ = true;
904 ui::GpuSwitchingManager::GetInstance()->AddObserver(this); 906 ui::GpuSwitchingManager::GetInstance()->AddObserver(this);
905 } 907 }
906 908
(...skipping 2115 matching lines...) Expand 10 before | Expand all | Expand 10 after
3022 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; 3024 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error;
3023 3025
3024 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. 3026 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing.
3025 // Capture the error message in a crash key value. 3027 // Capture the error message in a crash key value.
3026 base::debug::ScopedCrashKey error_key_value("mojo-message-error", error); 3028 base::debug::ScopedCrashKey error_key_value("mojo-message-error", error);
3027 bad_message::ReceivedBadMessage(render_process_id, 3029 bad_message::ReceivedBadMessage(render_process_id,
3028 bad_message::RPH_MOJO_PROCESS_ERROR); 3030 bad_message::RPH_MOJO_PROCESS_ERROR);
3029 } 3031 }
3030 3032
3031 } // namespace content 3033 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/ppapi_plugin_process_host.cc ('k') | content/browser/utility_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698