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

Side by Side Diff: headless/lib/browser/headless_browser_impl.cc

Issue 2666503002: Make headless_shell target compile for Windows (Closed)
Patch Set: Fix initlogging placing, always enable logging in Windows Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "headless/lib/browser/headless_browser_impl.h" 5 #include "headless/lib/browser/headless_browser_impl.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 196
197 HeadlessBrowserContext* HeadlessBrowserImpl::GetBrowserContextForId( 197 HeadlessBrowserContext* HeadlessBrowserImpl::GetBrowserContextForId(
198 const std::string& id) { 198 const std::string& id) {
199 auto find_it = browser_contexts_.find(id); 199 auto find_it = browser_contexts_.find(id);
200 if (find_it == browser_contexts_.end()) 200 if (find_it == browser_contexts_.end())
201 return nullptr; 201 return nullptr;
202 return find_it->second.get(); 202 return find_it->second.get();
203 } 203 }
204 204
205 void RunChildProcessIfNeeded(int argc, const char** argv) { 205 void RunChildProcessIfNeeded(int argc, const char** argv) {
206 base::CommandLine command_line(argc, argv); 206 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
207 if (!command_line.HasSwitch(switches::kProcessType)) 207 switches::kProcessType))
208 return; 208 return;
209 209
210 HeadlessBrowser::Options::Builder builder(argc, argv); 210 HeadlessBrowser::Options::Builder builder(argc, argv);
211 exit(RunContentMain(builder.Build(), 211 exit(RunContentMain(builder.Build(),
212 base::Callback<void(HeadlessBrowser*)>())); 212 base::Callback<void(HeadlessBrowser*)>()));
213 } 213 }
214 214
215 int HeadlessBrowserMain( 215 int HeadlessBrowserMain(
216 HeadlessBrowser::Options options, 216 HeadlessBrowser::Options options,
217 const base::Callback<void(HeadlessBrowser*)>& on_browser_start_callback) { 217 const base::Callback<void(HeadlessBrowser*)>& on_browser_start_callback) {
218 DCHECK(!on_browser_start_callback.is_null()); 218 DCHECK(!on_browser_start_callback.is_null());
219 #if DCHECK_IS_ON() 219 #if DCHECK_IS_ON()
220 // The browser can only be initialized once. 220 // The browser can only be initialized once.
221 static bool browser_was_initialized; 221 static bool browser_was_initialized;
222 DCHECK(!browser_was_initialized); 222 DCHECK(!browser_was_initialized);
223 browser_was_initialized = true; 223 browser_was_initialized = true;
224 224
225 // Child processes should not end up here. 225 // Child processes should not end up here.
226 base::CommandLine command_line(options.argc, options.argv); 226 DCHECK(!base::CommandLine::ForCurrentProcess()->HasSwitch(
227 DCHECK(!command_line.HasSwitch(switches::kProcessType)); 227 switches::kProcessType));
228 #endif 228 #endif
229 return RunContentMain(std::move(options), 229 return RunContentMain(std::move(options),
230 std::move(on_browser_start_callback)); 230 std::move(on_browser_start_callback));
231 } 231 }
232 232
233 } // namespace headless 233 } // namespace headless
OLDNEW
« no previous file with comments | « headless/lib/browser/devtools_api/domain_h.template ('k') | headless/lib/headless_browser_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698