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

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

Issue 1679573002: Move shell interfaces into the shell.mojom namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@delegate
Patch Set: . Created 4 years, 10 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 "mojo/shell/standalone/android/background_application_loader.h" 5 #include "mojo/shell/standalone/android/background_application_loader.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 11 matching lines...) Expand all
22 thread_name_(thread_name), 22 thread_name_(thread_name),
23 message_loop_created_(true, false) {} 23 message_loop_created_(true, false) {}
24 24
25 BackgroundApplicationLoader::~BackgroundApplicationLoader() { 25 BackgroundApplicationLoader::~BackgroundApplicationLoader() {
26 if (thread_) 26 if (thread_)
27 thread_->Join(); 27 thread_->Join();
28 } 28 }
29 29
30 void BackgroundApplicationLoader::Load( 30 void BackgroundApplicationLoader::Load(
31 const GURL& url, 31 const GURL& url,
32 InterfaceRequest<Application> application_request) { 32 InterfaceRequest<mojom::Application> application_request) {
33 DCHECK(application_request.is_pending()); 33 DCHECK(application_request.is_pending());
34 if (!thread_) { 34 if (!thread_) {
35 // TODO(tim): It'd be nice if we could just have each Load call 35 // TODO(tim): It'd be nice if we could just have each Load call
36 // result in a new thread like DynamicService{Loader, Runner}. But some 36 // result in a new thread like DynamicService{Loader, Runner}. But some
37 // loaders are creating multiple ApplicationImpls (NetworkApplicationLoader) 37 // loaders are creating multiple ApplicationImpls (NetworkApplicationLoader)
38 // sharing a delegate (etc). So we have to keep it single threaded, wait 38 // sharing a delegate (etc). So we have to keep it single threaded, wait
39 // for the thread to initialize, and post to the TaskRunner for subsequent 39 // for the thread to initialize, and post to the TaskRunner for subsequent
40 // Load calls for now. 40 // Load calls for now.
41 thread_.reset(new base::DelegateSimpleThread(this, thread_name_)); 41 thread_.reset(new base::DelegateSimpleThread(this, thread_name_));
42 thread_->Start(); 42 thread_->Start();
(...skipping 15 matching lines...) Expand all
58 quit_closure_ = loop.QuitClosure(); 58 quit_closure_ = loop.QuitClosure();
59 message_loop_created_.Signal(); 59 message_loop_created_.Signal();
60 loop.Run(); 60 loop.Run();
61 61
62 // Destroy |loader_| on the thread it's actually used on. 62 // Destroy |loader_| on the thread it's actually used on.
63 loader_.reset(); 63 loader_.reset();
64 } 64 }
65 65
66 void BackgroundApplicationLoader::LoadOnBackgroundThread( 66 void BackgroundApplicationLoader::LoadOnBackgroundThread(
67 const GURL& url, 67 const GURL& url,
68 InterfaceRequest<Application> application_request) { 68 InterfaceRequest<mojom::Application> application_request) {
69 DCHECK(task_runner_->RunsTasksOnCurrentThread()); 69 DCHECK(task_runner_->RunsTasksOnCurrentThread());
70 loader_->Load(url, std::move(application_request)); 70 loader_->Load(url, std::move(application_request));
71 } 71 }
72 72
73 } // namespace shell 73 } // namespace shell
74 } // namespace mojo 74 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698