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

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: rebase 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
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() {}
jamesr 2014/07/28 20:11:27 could you DCHECK that base::MessageLoop::current()
tim (not reviewing) 2014/07/28 22:16:37 Good idea. Done.
87 : task_runners_(base::MessageLoop::current()->message_loop_proxy()) { 87
88 void Context::Init() {
88 setup.Get(); 89 setup.Get();
90 task_runners_.reset(
91 new TaskRunners(base::MessageLoop::current()->message_loop_proxy()));
89 92
90 for (size_t i = 0; i < arraysize(kLocalMojoURLs); ++i) 93 for (size_t i = 0; i < arraysize(kLocalMojoURLs); ++i)
91 mojo_url_resolver_.AddLocalFileMapping(GURL(kLocalMojoURLs[i])); 94 mojo_url_resolver_.AddLocalFileMapping(GURL(kLocalMojoURLs[i]));
92 95
93 base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess(); 96 base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess();
94 scoped_ptr<DynamicServiceRunnerFactory> runner_factory; 97 scoped_ptr<DynamicServiceRunnerFactory> runner_factory;
95 if (cmdline->HasSwitch(switches::kEnableMultiprocess)) 98 if (cmdline->HasSwitch(switches::kEnableMultiprocess))
96 runner_factory.reset(new OutOfProcessDynamicServiceRunnerFactory()); 99 runner_factory.reset(new OutOfProcessDynamicServiceRunnerFactory());
97 else 100 else
98 runner_factory.reset(new InProcessDynamicServiceRunnerFactory()); 101 runner_factory.reset(new InProcessDynamicServiceRunnerFactory());
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 service_manager_.set_default_loader(scoped_ptr<ServiceLoader>()); 165 service_manager_.set_default_loader(scoped_ptr<ServiceLoader>());
163 service_manager_.TerminateShellConnections(); 166 service_manager_.TerminateShellConnections();
164 } 167 }
165 168
166 Context::~Context() { 169 Context::~Context() {
167 Shutdown(); 170 Shutdown();
168 } 171 }
169 172
170 } // namespace shell 173 } // namespace shell
171 } // namespace mojo 174 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698