Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 152 &request); | 152 &request); |
| 153 } | 153 } |
| 154 | 154 |
| 155 scoped_refptr<gfx::GLShareGroup> share_group_; | 155 scoped_refptr<gfx::GLShareGroup> share_group_; |
| 156 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; | 156 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; |
| 157 scoped_ptr<ApplicationImpl> app_; | 157 scoped_ptr<ApplicationImpl> app_; |
| 158 DISALLOW_COPY_AND_ASSIGN(NativeViewportApplicationLoader); | 158 DISALLOW_COPY_AND_ASSIGN(NativeViewportApplicationLoader); |
| 159 }; | 159 }; |
| 160 #endif | 160 #endif |
| 161 | 161 |
| 162 Context::Context() { | 162 Context::Context() : application_manager_(NULL) { |
|
qsr
2014/10/31 12:22:15
s/NULL/this/ ?
Aaron Boodman
2014/10/31 18:14:02
Thanks, I went back and forth on how to do this an
| |
| 163 DCHECK(!base::MessageLoop::current()); | 163 DCHECK(!base::MessageLoop::current()); |
| 164 } | 164 } |
| 165 | 165 |
| 166 Context::~Context() { | 166 Context::~Context() { |
| 167 DCHECK(!base::MessageLoop::current()); | 167 DCHECK(!base::MessageLoop::current()); |
| 168 } | 168 } |
| 169 | 169 |
| 170 void Context::Init() { | 170 void Context::Init() { |
| 171 application_manager_.set_delegate(this); | 171 application_manager_.set_delegate(this); |
| 172 setup.Get(); | 172 setup.Get(); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 235 base::MessageLoop::TYPE_IO)); | 235 base::MessageLoop::TYPE_IO)); |
| 236 application_manager_.SetLoaderForURL(loader.Pass(), | 236 application_manager_.SetLoaderForURL(loader.Pass(), |
| 237 GURL("mojo:network_service")); | 237 GURL("mojo:network_service")); |
| 238 } | 238 } |
| 239 #endif | 239 #endif |
| 240 | 240 |
| 241 if (listener_) | 241 if (listener_) |
| 242 listener_->WaitForListening(); | 242 listener_->WaitForListening(); |
| 243 } | 243 } |
| 244 | 244 |
| 245 void Context::OnApplicationError(const GURL& gurl) { | 245 void Context::OnApplicationError(const GURL& url) { |
| 246 if (app_urls_.find(gurl) != app_urls_.end()) { | 246 if (app_urls_.find(url) != app_urls_.end()) { |
| 247 app_urls_.erase(gurl); | 247 app_urls_.erase(url); |
| 248 if (app_urls_.empty() && base::MessageLoop::current()->is_running()) | 248 if (app_urls_.empty() && base::MessageLoop::current()->is_running()) |
| 249 base::MessageLoop::current()->Quit(); | 249 base::MessageLoop::current()->Quit(); |
| 250 } | 250 } |
| 251 } | 251 } |
| 252 | 252 |
| 253 GURL Context::ResolveURL(const GURL& url) { | |
| 254 return mojo_url_resolver_.Resolve(url); | |
| 255 } | |
| 256 | |
| 253 void Context::Run(const GURL& url) { | 257 void Context::Run(const GURL& url) { |
| 254 EmptyServiceProvider* sp = new EmptyServiceProvider; | 258 EmptyServiceProvider* sp = new EmptyServiceProvider; |
| 255 ServiceProviderPtr spp; | 259 ServiceProviderPtr spp; |
| 256 BindToProxy(sp, &spp); | 260 BindToProxy(sp, &spp); |
| 257 | 261 |
| 258 app_urls_.insert(url); | 262 app_urls_.insert(url); |
| 259 application_manager_.ConnectToApplication(url, GURL(), spp.Pass()); | 263 application_manager_.ConnectToApplication(url, GURL(), spp.Pass()); |
| 260 } | 264 } |
| 261 | 265 |
| 262 ScopedMessagePipeHandle Context::ConnectToServiceByName( | 266 ScopedMessagePipeHandle Context::ConnectToServiceByName( |
| 263 const GURL& application_url, | 267 const GURL& application_url, |
| 264 const std::string& service_name) { | 268 const std::string& service_name) { |
| 265 app_urls_.insert(application_url); | 269 app_urls_.insert(application_url); |
| 266 return application_manager_.ConnectToServiceByName( | 270 return application_manager_.ConnectToServiceByName( |
| 267 application_url, service_name).Pass(); | 271 application_url, service_name).Pass(); |
| 268 } | 272 } |
| 269 | 273 |
| 270 } // namespace shell | 274 } // namespace shell |
| 271 } // namespace mojo | 275 } // namespace mojo |
| OLD | NEW |