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

Side by Side Diff: shell/android/background_application_loader.cc

Issue 1067173003: Remove mojo:: part of mojo::shell:: nested namespace in //shell. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 8 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "shell/android/background_application_loader.h" 5 #include "shell/android/background_application_loader.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "shell/application_manager/application_manager.h" 9 #include "shell/application_manager/application_manager.h"
10 10
11 namespace mojo {
12 namespace shell { 11 namespace shell {
13 12
14 BackgroundApplicationLoader::BackgroundApplicationLoader( 13 BackgroundApplicationLoader::BackgroundApplicationLoader(
15 scoped_ptr<ApplicationLoader> real_loader, 14 scoped_ptr<ApplicationLoader> real_loader,
16 const std::string& thread_name, 15 const std::string& thread_name,
17 base::MessageLoop::Type message_loop_type) 16 base::MessageLoop::Type message_loop_type)
18 : loader_(real_loader.Pass()), 17 : loader_(real_loader.Pass()),
19 message_loop_type_(message_loop_type), 18 message_loop_type_(message_loop_type),
20 thread_name_(thread_name), 19 thread_name_(thread_name),
21 message_loop_created_(true, false) { 20 message_loop_created_(true, false) {
22 } 21 }
23 22
24 BackgroundApplicationLoader::~BackgroundApplicationLoader() { 23 BackgroundApplicationLoader::~BackgroundApplicationLoader() {
25 if (thread_) 24 if (thread_)
26 thread_->Join(); 25 thread_->Join();
27 } 26 }
28 27
29 void BackgroundApplicationLoader::Load( 28 void BackgroundApplicationLoader::Load(
30 const GURL& url, 29 const GURL& url,
31 InterfaceRequest<Application> application_request) { 30 mojo::InterfaceRequest<mojo::Application> application_request) {
32 DCHECK(application_request.is_pending()); 31 DCHECK(application_request.is_pending());
33 if (!thread_) { 32 if (!thread_) {
34 // TODO(tim): It'd be nice if we could just have each Load call 33 // TODO(tim): It'd be nice if we could just have each Load call
35 // result in a new thread like DynamicService{Loader, Runner}. But some 34 // result in a new thread like DynamicService{Loader, Runner}. But some
36 // loaders are creating multiple ApplicationImpls (NetworkApplicationLoader) 35 // loaders are creating multiple ApplicationImpls (NetworkApplicationLoader)
37 // sharing a delegate (etc). So we have to keep it single threaded, wait 36 // sharing a delegate (etc). So we have to keep it single threaded, wait
38 // for the thread to initialize, and post to the TaskRunner for subsequent 37 // for the thread to initialize, and post to the TaskRunner for subsequent
39 // Load calls for now. 38 // Load calls for now.
40 thread_.reset(new base::DelegateSimpleThread(this, thread_name_)); 39 thread_.reset(new base::DelegateSimpleThread(this, thread_name_));
41 thread_->Start(); 40 thread_->Start();
(...skipping 15 matching lines...) Expand all
57 quit_closure_ = loop.QuitClosure(); 56 quit_closure_ = loop.QuitClosure();
58 message_loop_created_.Signal(); 57 message_loop_created_.Signal();
59 loop.Run(); 58 loop.Run();
60 59
61 // Destroy |loader_| on the thread it's actually used on. 60 // Destroy |loader_| on the thread it's actually used on.
62 loader_.reset(); 61 loader_.reset();
63 } 62 }
64 63
65 void BackgroundApplicationLoader::LoadOnBackgroundThread( 64 void BackgroundApplicationLoader::LoadOnBackgroundThread(
66 const GURL& url, 65 const GURL& url,
67 InterfaceRequest<Application> application_request) { 66 mojo::InterfaceRequest<mojo::Application> application_request) {
68 DCHECK(task_runner_->RunsTasksOnCurrentThread()); 67 DCHECK(task_runner_->RunsTasksOnCurrentThread());
69 loader_->Load(url, application_request.Pass()); 68 loader_->Load(url, application_request.Pass());
70 } 69 }
71 70
72 } // namespace shell 71 } // namespace shell
73 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698