cc: Added inline to Tile::IsReadyToDraw
[chromium-blink-merge.git] / content / utility / utility_main.cc
blobc93c1eca5366ae0c3c53f75af3de4a88593262fc
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/command_line.h"
6 #include "base/message_loop/message_loop.h"
7 #include "base/threading/platform_thread.h"
8 #include "base/timer/hi_res_timer_manager.h"
9 #include "content/child/child_process.h"
10 #include "content/common/sandbox_linux.h"
11 #include "content/public/common/content_switches.h"
12 #include "content/public/common/main_function_params.h"
13 #include "content/public/common/sandbox_init.h"
14 #include "content/utility/utility_thread_impl.h"
16 #if defined(OS_WIN)
17 #include "sandbox/win/src/sandbox.h"
18 #endif
20 namespace content {
22 // Mainline routine for running as the utility process.
23 int UtilityMain(const MainFunctionParams& parameters) {
24 // The main message loop of the utility process.
25 base::MessageLoop main_message_loop;
26 base::PlatformThread::SetName("CrUtilityMain");
28 #if defined(OS_LINUX)
29 // Initialize the sandbox before any thread is created.
30 LinuxSandbox::InitializeSandbox();
31 #endif
33 ChildProcess utility_process;
34 utility_process.set_main_thread(new UtilityThreadImpl());
36 base::HighResolutionTimerManager hi_res_timer_manager;
38 #if defined(OS_WIN)
39 bool no_sandbox = parameters.command_line.HasSwitch(switches::kNoSandbox);
40 if (!no_sandbox) {
41 sandbox::TargetServices* target_services =
42 parameters.sandbox_info->target_services;
43 if (!target_services)
44 return false;
45 target_services->LowerToken();
47 #endif
49 base::MessageLoop::current()->Run();
51 return 0;
54 } // namespace content