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/child/child_thread_impl.cc

Issue 974933002: content: Refactor ChildThreadImpl::Options (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Build fix. Created 5 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
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/child/child_thread_impl.h" 5 #include "content/child/child_thread_impl.h"
6 6
7 #include <signal.h> 7 #include <signal.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 return ChildThreadImpl::current(); 203 return ChildThreadImpl::current();
204 } 204 }
205 205
206 ChildThreadImpl::Options::Options() 206 ChildThreadImpl::Options::Options()
207 : channel_name(base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 207 : channel_name(base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
208 switches::kProcessChannelID)), 208 switches::kProcessChannelID)),
209 use_mojo_channel(false), 209 use_mojo_channel(false),
210 in_browser_process(false) { 210 in_browser_process(false) {
211 } 211 }
212 212
213 ChildThreadImpl::Options::Options(bool mojo)
214 : channel_name(base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
215 switches::kProcessChannelID)),
216 use_mojo_channel(mojo),
217 in_browser_process(true) {
218 }
219
220 ChildThreadImpl::Options::Options(std::string name, bool mojo)
221 : channel_name(name), use_mojo_channel(mojo), in_browser_process(true) {
222 }
223
224 ChildThreadImpl::Options::~Options() { 213 ChildThreadImpl::Options::~Options() {
225 } 214 }
226 215
216 ChildThreadImpl::Options::Builder::Builder() {
217 }
218
219 ChildThreadImpl::Options::Builder&
220 ChildThreadImpl::Options::Builder::InBrowserProcess(bool in_browser_process) {
221 options_.in_browser_process = in_browser_process;
222 return *this;
223 }
224
225 ChildThreadImpl::Options::Builder& ChildThreadImpl::Options::Builder::WithMojo(
226 bool mojo) {
227 options_.use_mojo_channel = mojo;
228 return *this;
229 }
230
231 ChildThreadImpl::Options::Builder&
232 ChildThreadImpl::Options::Builder::WithChannelName(
233 const std::string& channel_name) {
234 options_.channel_name = channel_name;
235 return *this;
236 }
237
238 ChildThreadImpl::Options ChildThreadImpl::Options::Builder::Build() {
239 return options_;
240 }
241
227 ChildThreadImpl::ChildThreadMessageRouter::ChildThreadMessageRouter( 242 ChildThreadImpl::ChildThreadMessageRouter::ChildThreadMessageRouter(
228 IPC::Sender* sender) 243 IPC::Sender* sender)
229 : sender_(sender) {} 244 : sender_(sender) {}
230 245
231 bool ChildThreadImpl::ChildThreadMessageRouter::Send(IPC::Message* msg) { 246 bool ChildThreadImpl::ChildThreadMessageRouter::Send(IPC::Message* msg) {
232 return sender_->Send(msg); 247 return sender_->Send(msg);
233 } 248 }
234 249
235 ChildThreadImpl::ChildThreadImpl() 250 ChildThreadImpl::ChildThreadImpl()
236 : router_(this), 251 : router_(this),
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 // doesn't cause such issues. TODO(gab): Remove this once the experiment is 678 // doesn't cause such issues. TODO(gab): Remove this once the experiment is
664 // over (http://crbug.com/458594). 679 // over (http://crbug.com/458594).
665 base::FieldTrial* trial = 680 base::FieldTrial* trial =
666 base::FieldTrialList::Find("BackgroundRendererProcesses"); 681 base::FieldTrialList::Find("BackgroundRendererProcesses");
667 if (trial && trial->group_name() == "AllowBackgroundModeFromRenderer") 682 if (trial && trial->group_name() == "AllowBackgroundModeFromRenderer")
668 base::Process::Current().SetProcessBackgrounded(background); 683 base::Process::Current().SetProcessBackgrounded(background);
669 #endif // OS_WIN 684 #endif // OS_WIN
670 } 685 }
671 686
672 } // namespace content 687 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698