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

Side by Side Diff: mojo/shell/desktop/mojo_main.cc

Issue 603273003: Prevent static mojo builds from pulling //ui/gl into mojo_shell (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: No need to export Created 6 years, 2 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 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"
15 14
16 #if defined(COMPONENT_BUILD) 15 #if defined(COMPONENT_BUILD)
17 #include "ui/gl/gl_surface.h" 16 #include "ui/gl/gl_surface.h"
18 #endif 17 #endif
19 18
20 namespace { 19 namespace {
21 20
21 // Copied from ui/gfx/switches.cc to avoid a dependency on //ui/gfx
22 const char kEnableHarfBuzzRenderText[] = "enable-harfbuzz-rendertext";
23
22 void RunApps(mojo::shell::Context* context) { 24 void RunApps(mojo::shell::Context* context) {
23 const base::CommandLine& command_line = 25 const base::CommandLine& command_line =
24 *base::CommandLine::ForCurrentProcess(); 26 *base::CommandLine::ForCurrentProcess();
25 base::CommandLine::StringVector args = command_line.GetArgs(); 27 base::CommandLine::StringVector args = command_line.GetArgs();
26 for (base::CommandLine::StringVector::const_iterator it = args.begin(); 28 for (base::CommandLine::StringVector::const_iterator it = args.begin();
27 it != args.end(); 29 it != args.end();
28 ++it) { 30 ++it) {
29 context->Run(GURL(*it)); 31 context->Run(GURL(*it));
30 } 32 }
31 } 33 }
32 34
33 } // namespace 35 } // namespace
34 36
35 int main(int argc, char** argv) { 37 int main(int argc, char** argv) {
36 base::AtExitManager at_exit; 38 base::AtExitManager at_exit;
37 base::CommandLine::Init(argc, argv); 39 base::CommandLine::Init(argc, argv);
38 #if defined(OS_LINUX) 40 #if defined(OS_LINUX)
39 // We use gfx::RenderText from multiple threads concurrently and the pango 41 // We use gfx::RenderText from multiple threads concurrently and the pango
40 // backend (currently the default on linux) is not close to threadsafe. Force 42 // backend (currently the default on linux) is not close to threadsafe. Force
41 // use of the harfbuzz backend for now. 43 // use of the harfbuzz backend for now.
42 base::CommandLine::ForCurrentProcess()->AppendSwitch( 44 base::CommandLine::ForCurrentProcess()->AppendSwitch(
43 switches::kEnableHarfBuzzRenderText); 45 kEnableHarfBuzzRenderText);
44 #endif 46 #endif
45 mojo::shell::InitializeLogging(); 47 mojo::shell::InitializeLogging();
46 48
47 // TODO(vtl): Unify parent and child process cases to the extent possible. 49 // TODO(vtl): Unify parent and child process cases to the extent possible.
48 if (scoped_ptr<mojo::shell::ChildProcess> child_process = 50 if (scoped_ptr<mojo::shell::ChildProcess> child_process =
49 mojo::shell::ChildProcess::Create( 51 mojo::shell::ChildProcess::Create(
50 *base::CommandLine::ForCurrentProcess())) { 52 *base::CommandLine::ForCurrentProcess())) {
51 child_process->Main(); 53 child_process->Main();
52 } else { 54 } else {
53 #if defined(COMPONENT_BUILD) 55 #if defined(COMPONENT_BUILD)
(...skipping 12 matching lines...) Expand all
66 shell_context.mojo_url_resolver()->SetBaseURL( 68 shell_context.mojo_url_resolver()->SetBaseURL(
67 GURL(command_line.GetSwitchValueASCII(switches::kOrigin))); 69 GURL(command_line.GetSwitchValueASCII(switches::kOrigin)));
68 } 70 }
69 71
70 message_loop.PostTask(FROM_HERE, base::Bind(RunApps, &shell_context)); 72 message_loop.PostTask(FROM_HERE, base::Bind(RunApps, &shell_context));
71 message_loop.Run(); 73 message_loop.Run();
72 } 74 }
73 } 75 }
74 return 0; 76 return 0;
75 } 77 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698