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 MOJO_APPLICATION_MANAGER_BACKGROUND_SHELL_APPLICATION_LOADER_H_ |
6 #define MOJO_APPLICATION_MANAGER_BACKGROUND_SHELL_APPLICATION_LOADER_H_ | 6 #define MOJO_APPLICATION_MANAGER_BACKGROUND_SHELL_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" |
(...skipping 11 matching lines...) Expand all Loading... | |
22 public base::DelegateSimpleThread::Delegate { | 22 public base::DelegateSimpleThread::Delegate { |
23 public: | 23 public: |
24 BackgroundShellApplicationLoader(scoped_ptr<ApplicationLoader> real_loader, | 24 BackgroundShellApplicationLoader(scoped_ptr<ApplicationLoader> real_loader, |
25 const std::string& thread_name, | 25 const std::string& thread_name, |
26 base::MessageLoop::Type message_loop_type); | 26 base::MessageLoop::Type message_loop_type); |
27 ~BackgroundShellApplicationLoader() override; | 27 ~BackgroundShellApplicationLoader() override; |
28 | 28 |
29 // ApplicationLoader overrides: | 29 // ApplicationLoader overrides: |
30 void Load(ApplicationManager* manager, | 30 void Load(ApplicationManager* manager, |
31 const GURL& url, | 31 const GURL& url, |
32 ScopedMessagePipeHandle shell_handle, | |
32 scoped_refptr<LoadCallbacks> callbacks) override; | 33 scoped_refptr<LoadCallbacks> callbacks) override; |
33 void OnApplicationError(ApplicationManager* manager, | 34 void OnApplicationError(ApplicationManager* manager, |
34 const GURL& url) override; | 35 const GURL& url) override; |
35 | 36 |
36 private: | 37 private: |
37 class BackgroundLoader; | 38 class BackgroundLoader; |
Aaron Boodman
2014/11/18 23:46:15
This is dead now.
qsr
2014/11/19 13:42:37
Done.
| |
38 | 39 |
39 // |base::DelegateSimpleThread::Delegate| method: | 40 // |base::DelegateSimpleThread::Delegate| method: |
40 void Run() override; | 41 void Run() override; |
41 | 42 |
42 // These functions are exected on the background thread. They call through | 43 // These functions are exected on the background thread. They call through |
43 // to |background_loader_| to do the actual loading. | 44 // to |background_loader_| to do the actual loading. |
44 // TODO: having this code take a |manager| is fragile (as ApplicationManager | 45 // TODO: having this code take a |manager| is fragile (as ApplicationManager |
45 // isn't thread safe). | 46 // isn't thread safe). |
46 void LoadOnBackgroundThread(ApplicationManager* manager, | 47 void LoadOnBackgroundThread(ApplicationManager* manager, |
47 const GURL& url, | 48 const GURL& url, |
48 ScopedMessagePipeHandle* shell_handle); | 49 ScopedMessagePipeHandle shell_handle); |
49 void OnApplicationErrorOnBackgroundThread(ApplicationManager* manager, | 50 void OnApplicationErrorOnBackgroundThread(ApplicationManager* manager, |
50 const GURL& url); | 51 const GURL& url); |
51 bool quit_on_shutdown_; | 52 bool quit_on_shutdown_; |
52 scoped_ptr<ApplicationLoader> loader_; | 53 scoped_ptr<ApplicationLoader> loader_; |
53 | 54 |
54 const base::MessageLoop::Type message_loop_type_; | 55 const base::MessageLoop::Type message_loop_type_; |
55 const std::string thread_name_; | 56 const std::string thread_name_; |
56 | 57 |
57 // Created on |thread_| during construction of |this|. Protected against | 58 // Created on |thread_| during construction of |this|. Protected against |
58 // uninitialized use by |message_loop_created_|, and protected against | 59 // uninitialized use by |message_loop_created_|, and protected against |
59 // use-after-free by holding a reference to the thread-safe object. Note | 60 // use-after-free by holding a reference to the thread-safe object. Note |
60 // that holding a reference won't hold |thread_| from exiting. | 61 // that holding a reference won't hold |thread_| from exiting. |
61 scoped_refptr<base::TaskRunner> task_runner_; | 62 scoped_refptr<base::TaskRunner> task_runner_; |
62 base::WaitableEvent message_loop_created_; | 63 base::WaitableEvent message_loop_created_; |
63 | 64 |
64 // Lives on |thread_|. | 65 // Lives on |thread_|. |
65 base::Closure quit_closure_; | 66 base::Closure quit_closure_; |
66 | 67 |
67 scoped_ptr<base::DelegateSimpleThread> thread_; | 68 scoped_ptr<base::DelegateSimpleThread> thread_; |
68 | 69 |
69 // Lives on |thread_|. Trivial interface that calls through to |loader_|. | |
70 BackgroundLoader* background_loader_; | |
71 | |
72 DISALLOW_COPY_AND_ASSIGN(BackgroundShellApplicationLoader); | 70 DISALLOW_COPY_AND_ASSIGN(BackgroundShellApplicationLoader); |
73 }; | 71 }; |
74 | 72 |
75 } // namespace mojo | 73 } // namespace mojo |
76 | 74 |
77 #endif // MOJO_APPLICATION_MANAGER_BACKGROUND_SHELL_APPLICATION_LOADER_H_ | 75 #endif // MOJO_APPLICATION_MANAGER_BACKGROUND_SHELL_APPLICATION_LOADER_H_ |
OLD | NEW |