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

Side by Side Diff: mandoline/app/desktop/launcher_process.cc

Issue 1338283003: Revert of Move fetching logic out of ApplicationManager, eliminate url mappings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 | « content/content_browser.gypi ('k') | mojo/fetcher/BUILD.gn » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <stdio.h> 5 #include <stdio.h>
6 #include <string.h> 6 #include <string.h>
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <iostream> 9 #include <iostream>
10 10
11 #include "base/base_switches.h" 11 #include "base/base_switches.h"
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/files/file_util.h" 14 #include "base/files/file_util.h"
15 #include "base/message_loop/message_loop.h" 15 #include "base/message_loop/message_loop.h"
16 #include "base/path_service.h"
17 #include "base/synchronization/waitable_event.h" 16 #include "base/synchronization/waitable_event.h"
18 #include "base/trace_event/trace_event.h" 17 #include "base/trace_event/trace_event.h"
19 #include "components/tracing/trace_config_file.h" 18 #include "components/tracing/trace_config_file.h"
20 #include "components/tracing/tracing_switches.h" 19 #include "components/tracing/tracing_switches.h"
21 #include "mandoline/app/core_services_initialization.h" 20 #include "mandoline/app/core_services_initialization.h"
22 #include "mandoline/app/desktop/launcher_process.h" 21 #include "mandoline/app/desktop/launcher_process.h"
23 #include "mojo/runner/context.h" 22 #include "mojo/runner/context.h"
24 #include "mojo/runner/switches.h" 23 #include "mojo/runner/switches.h"
25 24
26 namespace mandoline { 25 namespace mandoline {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 trace_config, base::trace_event::TraceLog::RECORDING_MODE); 92 trace_config, base::trace_event::TraceLog::RECORDING_MODE);
94 } else if (tracing::TraceConfigFile::GetInstance()->IsEnabled()) { 93 } else if (tracing::TraceConfigFile::GetInstance()->IsEnabled()) {
95 g_tracing = true; 94 g_tracing = true;
96 base::trace_event::TraceLog::GetInstance()->SetEnabled( 95 base::trace_event::TraceLog::GetInstance()->SetEnabled(
97 tracing::TraceConfigFile::GetInstance()->GetTraceConfig(), 96 tracing::TraceConfigFile::GetInstance()->GetTraceConfig(),
98 base::trace_event::TraceLog::RECORDING_MODE); 97 base::trace_event::TraceLog::RECORDING_MODE);
99 } 98 }
100 99
101 // We want the runner::Context to outlive the MessageLoop so that pipes are 100 // We want the runner::Context to outlive the MessageLoop so that pipes are
102 // all gracefully closed / error-out before we try to shut the Context down. 101 // all gracefully closed / error-out before we try to shut the Context down.
103 base::FilePath shell_dir; 102 mojo::runner::Context shell_context;
104 PathService::Get(base::DIR_MODULE, &shell_dir);
105 mojo::runner::Context shell_context(shell_dir);
106 InitCoreServicesForContext(&shell_context); 103 InitCoreServicesForContext(&shell_context);
107 { 104 {
108 base::MessageLoop message_loop; 105 base::MessageLoop message_loop;
109 if (!shell_context.Init()) { 106 if (!shell_context.Init()) {
110 return 0; 107 return 0;
111 } 108 }
112 if (g_tracing) { 109 if (g_tracing) {
113 message_loop.PostDelayedTask(FROM_HERE, 110 message_loop.PostDelayedTask(FROM_HERE,
114 base::Bind(StopTracingAndFlushToDisk), 111 base::Bind(StopTracingAndFlushToDisk),
115 base::TimeDelta::FromSeconds(5)); 112 base::TimeDelta::FromSeconds(5));
116 } 113 }
117 114
118 message_loop.PostTask(FROM_HERE, 115 message_loop.PostTask(FROM_HERE,
119 base::Bind(&mojo::runner::Context::Run, 116 base::Bind(&mojo::runner::Context::Run,
120 base::Unretained(&shell_context), 117 base::Unretained(&shell_context),
121 GURL("mojo:desktop_ui"))); 118 GURL("mojo:desktop_ui")));
122 message_loop.Run(); 119 message_loop.Run();
123 120
124 // Must be called before |message_loop| is destroyed. 121 // Must be called before |message_loop| is destroyed.
125 shell_context.Shutdown(); 122 shell_context.Shutdown();
126 } 123 }
127 124
128 if (g_tracing) 125 if (g_tracing)
129 StopTracingAndFlushToDisk(); 126 StopTracingAndFlushToDisk();
130 return 0; 127 return 0;
131 } 128 }
132 129
133 } // namespace mandoline 130 } // namespace mandoline
OLDNEW
« no previous file with comments | « content/content_browser.gypi ('k') | mojo/fetcher/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698