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

Unified Diff: content/child/child_thread_impl.cc

Issue 974933002: content: Refactor ChildThreadImpl::Options (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments. Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/child/child_thread_impl.h ('k') | content/gpu/gpu_child_thread.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/child_thread_impl.cc
diff --git a/content/child/child_thread_impl.cc b/content/child/child_thread_impl.cc
index 5df66318d42a5cc76c8f9307976153f4f4f72691..b6a2eea2b8aa2e4fde1c6d6a0c41023ba0bb5576 100644
--- a/content/child/child_thread_impl.cc
+++ b/content/child/child_thread_impl.cc
@@ -210,18 +210,40 @@ ChildThreadImpl::Options::Options()
in_browser_process(false) {
}
-ChildThreadImpl::Options::Options(bool mojo)
- : channel_name(base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
- switches::kProcessChannelID)),
- use_mojo_channel(mojo),
- in_browser_process(true) {
+ChildThreadImpl::Options::~Options() {
}
-ChildThreadImpl::Options::Options(std::string name, bool mojo)
- : channel_name(name), use_mojo_channel(mojo), in_browser_process(true) {
+ChildThreadImpl::Options::Builder::Builder() {
}
-ChildThreadImpl::Options::~Options() {
+ChildThreadImpl::Options::Builder&
+ChildThreadImpl::Options::Builder::InBrowserProcess(bool in_browser_process) {
+ options_.in_browser_process = in_browser_process;
+ return *this;
+}
+
+ChildThreadImpl::Options::Builder&
+ChildThreadImpl::Options::Builder::UseMojoChannel(bool use_mojo_channel) {
+ options_.use_mojo_channel = use_mojo_channel;
+ return *this;
+}
+
+ChildThreadImpl::Options::Builder&
+ChildThreadImpl::Options::Builder::WithChannelName(
+ const std::string& channel_name) {
+ options_.channel_name = channel_name;
+ return *this;
+}
+
+ChildThreadImpl::Options::Builder&
+ChildThreadImpl::Options::Builder::AddStartupFilter(
+ IPC::MessageFilter* filter) {
+ options_.startup_filters.push_back(filter);
+ return *this;
+}
+
+ChildThreadImpl::Options ChildThreadImpl::Options::Builder::Build() {
+ return options_;
}
ChildThreadImpl::ChildThreadMessageRouter::ChildThreadMessageRouter(
@@ -236,7 +258,7 @@ ChildThreadImpl::ChildThreadImpl()
: router_(this),
in_browser_process_(false),
channel_connected_factory_(this) {
- Init(Options());
+ Init(Options::Builder().Build());
}
ChildThreadImpl::ChildThreadImpl(const Options& options)
« no previous file with comments | « content/child/child_thread_impl.h ('k') | content/gpu/gpu_child_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698