| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/at_exit.h" | 5 #include "base/at_exit.h" |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "mojo/shell/child_process.h" | 10 #include "mojo/shell/child_process.h" |
| 11 #include "mojo/shell/context.h" | 11 #include "mojo/shell/context.h" |
| 12 #include "mojo/shell/init.h" | 12 #include "mojo/shell/init.h" |
| 13 #include "mojo/shell/switches.h" | 13 #include "mojo/shell/switches.h" |
| 14 #include "ui/gfx/switches.h" |
| 14 #include "ui/gl/gl_surface.h" | 15 #include "ui/gl/gl_surface.h" |
| 15 | 16 |
| 16 namespace { | 17 namespace { |
| 17 | 18 |
| 18 void RunApps(mojo::shell::Context* context, std::vector<GURL> app_urls) { | 19 void RunApps(mojo::shell::Context* context, std::vector<GURL> app_urls) { |
| 19 for (std::vector<GURL>::const_iterator it = app_urls.begin(); | 20 for (std::vector<GURL>::const_iterator it = app_urls.begin(); |
| 20 it != app_urls.end(); ++it) { | 21 it != app_urls.end(); ++it) { |
| 21 context->Run(*it); | 22 context->Run(*it); |
| 22 } | 23 } |
| 23 } | 24 } |
| 24 | 25 |
| 25 } // namespace | 26 } // namespace |
| 26 | 27 |
| 27 int main(int argc, char** argv) { | 28 int main(int argc, char** argv) { |
| 28 base::AtExitManager at_exit; | 29 base::AtExitManager at_exit; |
| 29 base::CommandLine::Init(argc, argv); | 30 base::CommandLine::Init(argc, argv); |
| 31 #if defined(OS_LINUX) |
| 32 // We use gfx::RenderText from multiple threads concurrently and the pango |
| 33 // backend (currently the default on linux) is not close to threadsafe. Force |
| 34 // use of the harfbuzz backend for now. |
| 35 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 36 switches::kEnableHarfBuzzRenderText); |
| 37 #endif |
| 30 mojo::shell::InitializeLogging(); | 38 mojo::shell::InitializeLogging(); |
| 31 | 39 |
| 32 // TODO(vtl): Unify parent and child process cases to the extent possible. | 40 // TODO(vtl): Unify parent and child process cases to the extent possible. |
| 33 if (scoped_ptr<mojo::shell::ChildProcess> child_process = | 41 if (scoped_ptr<mojo::shell::ChildProcess> child_process = |
| 34 mojo::shell::ChildProcess::Create( | 42 mojo::shell::ChildProcess::Create( |
| 35 *base::CommandLine::ForCurrentProcess())) { | 43 *base::CommandLine::ForCurrentProcess())) { |
| 36 child_process->Main(); | 44 child_process->Main(); |
| 37 } else { | 45 } else { |
| 38 gfx::GLSurface::InitializeOneOff(); | 46 gfx::GLSurface::InitializeOneOff(); |
| 39 | 47 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 60 | 68 |
| 61 message_loop.PostTask(FROM_HERE, | 69 message_loop.PostTask(FROM_HERE, |
| 62 base::Bind(RunApps, | 70 base::Bind(RunApps, |
| 63 &shell_context, | 71 &shell_context, |
| 64 app_urls)); | 72 app_urls)); |
| 65 message_loop.Run(); | 73 message_loop.Run(); |
| 66 } | 74 } |
| 67 } | 75 } |
| 68 return 0; | 76 return 0; |
| 69 } | 77 } |
| OLD | NEW |