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

Side by Side Diff: mojo/shell/context.cc

Issue 420143003: mojo: shell::Context should outlive the shell MessageLoop (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix + verify android Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « mojo/shell/context.h ('k') | mojo/shell/desktop/mojo_main.cc » ('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 "mojo/shell/context.h" 5 #include "mojo/shell/context.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 } 76 }
77 77
78 virtual void OnServiceError(ServiceManager* manager, 78 virtual void OnServiceError(ServiceManager* manager,
79 const GURL& url) OVERRIDE { 79 const GURL& url) OVERRIDE {
80 } 80 }
81 81
82 scoped_ptr<ApplicationImpl> app_; 82 scoped_ptr<ApplicationImpl> app_;
83 DISALLOW_COPY_AND_ASSIGN(NativeViewportServiceLoader); 83 DISALLOW_COPY_AND_ASSIGN(NativeViewportServiceLoader);
84 }; 84 };
85 85
86 Context::Context() 86 Context::Context() {
87 : task_runners_(base::MessageLoop::current()->message_loop_proxy()) { 87 DCHECK(!base::MessageLoop::current());
88 }
89
90 void Context::Init() {
88 setup.Get(); 91 setup.Get();
92 task_runners_.reset(
93 new TaskRunners(base::MessageLoop::current()->message_loop_proxy()));
89 94
90 for (size_t i = 0; i < arraysize(kLocalMojoURLs); ++i) 95 for (size_t i = 0; i < arraysize(kLocalMojoURLs); ++i)
91 mojo_url_resolver_.AddLocalFileMapping(GURL(kLocalMojoURLs[i])); 96 mojo_url_resolver_.AddLocalFileMapping(GURL(kLocalMojoURLs[i]));
92 97
93 base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess(); 98 base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess();
94 scoped_ptr<DynamicServiceRunnerFactory> runner_factory; 99 scoped_ptr<DynamicServiceRunnerFactory> runner_factory;
95 if (cmdline->HasSwitch(switches::kEnableMultiprocess)) 100 if (cmdline->HasSwitch(switches::kEnableMultiprocess))
96 runner_factory.reset(new OutOfProcessDynamicServiceRunnerFactory()); 101 runner_factory.reset(new OutOfProcessDynamicServiceRunnerFactory());
97 else 102 else
98 runner_factory.reset(new InProcessDynamicServiceRunnerFactory()); 103 runner_factory.reset(new InProcessDynamicServiceRunnerFactory());
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 #if defined(USE_AURA) 162 #if defined(USE_AURA)
158 service_manager_.SetLoaderForURL( 163 service_manager_.SetLoaderForURL(
159 scoped_ptr<ServiceLoader>(), 164 scoped_ptr<ServiceLoader>(),
160 GURL("mojo:mojo_view_manager")); 165 GURL("mojo:mojo_view_manager"));
161 #endif 166 #endif
162 service_manager_.set_default_loader(scoped_ptr<ServiceLoader>()); 167 service_manager_.set_default_loader(scoped_ptr<ServiceLoader>());
163 service_manager_.TerminateShellConnections(); 168 service_manager_.TerminateShellConnections();
164 } 169 }
165 170
166 Context::~Context() { 171 Context::~Context() {
172 DCHECK(!base::MessageLoop::current());
167 Shutdown(); 173 Shutdown();
168 } 174 }
169 175
170 } // namespace shell 176 } // namespace shell
171 } // namespace mojo 177 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/shell/context.h ('k') | mojo/shell/desktop/mojo_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698