OLD | NEW |
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 #ifndef MOJO_APPLICATION_MANAGER_BACKGROUND_SHELL_APPLICATION_LOADER_H_ | 5 #ifndef SHELL_ANDROID_BACKGROUND_APPLICATION_LOADER_H_ |
6 #define MOJO_APPLICATION_MANAGER_BACKGROUND_SHELL_APPLICATION_LOADER_H_ | 6 #define SHELL_ANDROID_BACKGROUND_APPLICATION_LOADER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
11 #include "base/synchronization/waitable_event.h" | 11 #include "base/synchronization/waitable_event.h" |
12 #include "base/threading/simple_thread.h" | 12 #include "base/threading/simple_thread.h" |
13 #include "mojo/application_manager/application_loader.h" | 13 #include "mojo/application_manager/application_loader.h" |
14 | 14 |
15 namespace mojo { | 15 namespace mojo { |
16 | 16 |
17 // TODO(tim): Eventually this should be Android-only to support services | 17 class MOJO_APPLICATION_MANAGER_EXPORT BackgroundApplicationLoader |
18 // that we need to bundle with the shell (such as NetworkService). Perhaps | |
19 // we should move it to shell/ as well. | |
20 class MOJO_APPLICATION_MANAGER_EXPORT BackgroundShellApplicationLoader | |
21 : public ApplicationLoader, | 18 : public ApplicationLoader, |
22 public base::DelegateSimpleThread::Delegate { | 19 public base::DelegateSimpleThread::Delegate { |
23 public: | 20 public: |
24 BackgroundShellApplicationLoader(scoped_ptr<ApplicationLoader> real_loader, | 21 BackgroundApplicationLoader(scoped_ptr<ApplicationLoader> real_loader, |
25 const std::string& thread_name, | 22 const std::string& thread_name, |
26 base::MessageLoop::Type message_loop_type); | 23 base::MessageLoop::Type message_loop_type); |
27 ~BackgroundShellApplicationLoader() override; | 24 ~BackgroundApplicationLoader() override; |
28 | 25 |
29 // ApplicationLoader overrides: | 26 // ApplicationLoader overrides: |
30 void Load(ApplicationManager* manager, | 27 void Load(ApplicationManager* manager, |
31 const GURL& url, | 28 const GURL& url, |
32 ScopedMessagePipeHandle shell_handle, | 29 ScopedMessagePipeHandle shell_handle, |
33 LoadCallback callback) override; | 30 LoadCallback callback) override; |
34 void OnApplicationError(ApplicationManager* manager, | 31 void OnApplicationError(ApplicationManager* manager, |
35 const GURL& url) override; | 32 const GURL& url) override; |
36 | 33 |
37 private: | 34 private: |
(...skipping 20 matching lines...) Expand all Loading... |
58 // use-after-free by holding a reference to the thread-safe object. Note | 55 // use-after-free by holding a reference to the thread-safe object. Note |
59 // that holding a reference won't hold |thread_| from exiting. | 56 // that holding a reference won't hold |thread_| from exiting. |
60 scoped_refptr<base::TaskRunner> task_runner_; | 57 scoped_refptr<base::TaskRunner> task_runner_; |
61 base::WaitableEvent message_loop_created_; | 58 base::WaitableEvent message_loop_created_; |
62 | 59 |
63 // Lives on |thread_|. | 60 // Lives on |thread_|. |
64 base::Closure quit_closure_; | 61 base::Closure quit_closure_; |
65 | 62 |
66 scoped_ptr<base::DelegateSimpleThread> thread_; | 63 scoped_ptr<base::DelegateSimpleThread> thread_; |
67 | 64 |
68 DISALLOW_COPY_AND_ASSIGN(BackgroundShellApplicationLoader); | 65 DISALLOW_COPY_AND_ASSIGN(BackgroundApplicationLoader); |
69 }; | 66 }; |
70 | 67 |
71 } // namespace mojo | 68 } // namespace mojo |
72 | 69 |
73 #endif // MOJO_APPLICATION_MANAGER_BACKGROUND_SHELL_APPLICATION_LOADER_H_ | 70 #endif // SHELL_ANDROID_BACKGROUND_APPLICATION_LOADER_H_ |
OLD | NEW |