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

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: review 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() {
87 : task_runners_(base::MessageLoop::current()->message_loop_proxy()) { 87 DCHECK(!base::MessageLoop::current());
darin (slow to review) 2014/07/28 23:02:12 perhaps the dtor should have a similar assertion?
tim (not reviewing) 2014/07/29 00:54:57 Done.
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
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() {
167 Shutdown(); 172 Shutdown();
168 } 173 }
169 174
170 } // namespace shell 175 } // namespace shell
171 } // namespace mojo 176 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698