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

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: Address James' comments 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
« no previous file with comments | « mojo/shell/BUILD.gn ('k') | ui/gl/gl_switches.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #if defined(OS_LINUX)
22 // Copied from ui/gfx/switches.cc to avoid a dependency on //ui/gfx
23 const char kEnableHarfBuzzRenderText[] = "enable-harfbuzz-rendertext";
24 #endif
25
22 void RunApps(mojo::shell::Context* context) { 26 void RunApps(mojo::shell::Context* context) {
23 const base::CommandLine& command_line = 27 const base::CommandLine& command_line =
24 *base::CommandLine::ForCurrentProcess(); 28 *base::CommandLine::ForCurrentProcess();
25 base::CommandLine::StringVector args = command_line.GetArgs(); 29 base::CommandLine::StringVector args = command_line.GetArgs();
26 for (base::CommandLine::StringVector::const_iterator it = args.begin(); 30 for (base::CommandLine::StringVector::const_iterator it = args.begin();
27 it != args.end(); 31 it != args.end();
28 ++it) { 32 ++it) {
29 context->Run(GURL(*it)); 33 context->Run(GURL(*it));
30 } 34 }
31 } 35 }
32 36
33 } // namespace 37 } // namespace
34 38
35 int main(int argc, char** argv) { 39 int main(int argc, char** argv) {
36 base::AtExitManager at_exit; 40 base::AtExitManager at_exit;
37 base::CommandLine::Init(argc, argv); 41 base::CommandLine::Init(argc, argv);
38 #if defined(OS_LINUX) 42 #if defined(OS_LINUX)
39 // We use gfx::RenderText from multiple threads concurrently and the pango 43 // We use gfx::RenderText from multiple threads concurrently and the pango
40 // backend (currently the default on linux) is not close to threadsafe. Force 44 // backend (currently the default on linux) is not close to threadsafe. Force
41 // use of the harfbuzz backend for now. 45 // use of the harfbuzz backend for now.
42 base::CommandLine::ForCurrentProcess()->AppendSwitch( 46 base::CommandLine::ForCurrentProcess()->AppendSwitch(
43 switches::kEnableHarfBuzzRenderText); 47 kEnableHarfBuzzRenderText);
44 #endif 48 #endif
45 mojo::shell::InitializeLogging(); 49 mojo::shell::InitializeLogging();
46 50
47 // TODO(vtl): Unify parent and child process cases to the extent possible. 51 // TODO(vtl): Unify parent and child process cases to the extent possible.
48 if (scoped_ptr<mojo::shell::ChildProcess> child_process = 52 if (scoped_ptr<mojo::shell::ChildProcess> child_process =
49 mojo::shell::ChildProcess::Create( 53 mojo::shell::ChildProcess::Create(
50 *base::CommandLine::ForCurrentProcess())) { 54 *base::CommandLine::ForCurrentProcess())) {
51 child_process->Main(); 55 child_process->Main();
52 } else { 56 } else {
53 #if defined(COMPONENT_BUILD) 57 #if defined(COMPONENT_BUILD)
(...skipping 12 matching lines...) Expand all
66 shell_context.mojo_url_resolver()->SetBaseURL( 70 shell_context.mojo_url_resolver()->SetBaseURL(
67 GURL(command_line.GetSwitchValueASCII(switches::kOrigin))); 71 GURL(command_line.GetSwitchValueASCII(switches::kOrigin)));
68 } 72 }
69 73
70 message_loop.PostTask(FROM_HERE, base::Bind(RunApps, &shell_context)); 74 message_loop.PostTask(FROM_HERE, base::Bind(RunApps, &shell_context));
71 message_loop.Run(); 75 message_loop.Run();
72 } 76 }
73 } 77 }
74 return 0; 78 return 0;
75 } 79 }
OLDNEW
« no previous file with comments | « mojo/shell/BUILD.gn ('k') | ui/gl/gl_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698