• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
2 // reserved. Use of this source code is governed by a BSD-style license that
3 // can be found in the LICENSE file.
4 
5 #include "include/cef_process_util.h"
6 #include "libcef/common/command_line_impl.h"
7 
8 #include "base/logging.h"
9 #include "base/notreached.h"
10 #include "base/process/launch.h"
11 #include "content/public/browser/child_process_launcher_utils.h"
12 
CefLaunchProcess(CefRefPtr<CefCommandLine> command_line)13 bool CefLaunchProcess(CefRefPtr<CefCommandLine> command_line) {
14   if (!command_line.get()) {
15     NOTREACHED() << "invalid parameter";
16     return false;
17   }
18 
19   if (!content::CurrentlyOnProcessLauncherTaskRunner()) {
20     NOTREACHED() << "called on invalid thread";
21     return false;
22   }
23 
24   CefCommandLineImpl* impl =
25       static_cast<CefCommandLineImpl*>(command_line.get());
26 
27   CefValueController::AutoLock lock_scope(impl->controller());
28 
29   base::LaunchOptions options;
30   return base::LaunchProcess(impl->command_line(), options).IsValid();
31 }
32