| 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_SERVICE_MANAGER_BACKGROUND_SHELL_SERVICE_LOADER_H_ | 5 #ifndef MOJO_SERVICE_MANAGER_BACKGROUND_SHELL_SERVICE_LOADER_H_ |
| 6 #define MOJO_SERVICE_MANAGER_BACKGROUND_SHELL_SERVICE_LOADER_H_ | 6 #define MOJO_SERVICE_MANAGER_BACKGROUND_SHELL_SERVICE_LOADER_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 base::MessageLoop::Type message_loop_type); | 25 base::MessageLoop::Type message_loop_type); |
| 26 virtual ~BackgroundShellServiceLoader(); | 26 virtual ~BackgroundShellServiceLoader(); |
| 27 | 27 |
| 28 // ServiceLoader overrides: | 28 // ServiceLoader overrides: |
| 29 virtual void LoadService(ServiceManager* manager, | 29 virtual void LoadService(ServiceManager* manager, |
| 30 const GURL& url, | 30 const GURL& url, |
| 31 ScopedMessagePipeHandle shell_handle) OVERRIDE; | 31 ScopedMessagePipeHandle shell_handle) OVERRIDE; |
| 32 virtual void OnServiceError(ServiceManager* manager, | 32 virtual void OnServiceError(ServiceManager* manager, |
| 33 const GURL& url) OVERRIDE; | 33 const GURL& url) OVERRIDE; |
| 34 | 34 |
| 35 // Post a task to quit the MessageLoop we are running for the app when we |
| 36 // are destroyed. Most apps should quit themselves and not need this. |
| 37 // TODO(tim): Remove this method once applications are smart enough |
| 38 // to quit themselves. Bug 394477. |
| 39 void set_quit_on_shutdown() { quit_on_shutdown_ = true; } |
| 40 |
| 35 private: | 41 private: |
| 36 class BackgroundLoader; | 42 class BackgroundLoader; |
| 37 | 43 |
| 38 // |base::DelegateSimpleThread::Delegate| method: | 44 // |base::DelegateSimpleThread::Delegate| method: |
| 39 virtual void Run() OVERRIDE; | 45 virtual void Run() OVERRIDE; |
| 40 | 46 |
| 41 // These functions are exected on the background thread. They call through | 47 // These functions are exected on the background thread. They call through |
| 42 // to |background_loader_| to do the actual loading. | 48 // to |background_loader_| to do the actual loading. |
| 43 // TODO: having this code take a |manager| is fragile (as ServiceManager isn't | 49 // TODO: having this code take a |manager| is fragile (as ServiceManager isn't |
| 44 // thread safe). | 50 // thread safe). |
| (...skipping 23 matching lines...) Expand all Loading... |
| 68 | 74 |
| 69 // Lives on |thread_|. Trivial interface that calls through to |loader_|. | 75 // Lives on |thread_|. Trivial interface that calls through to |loader_|. |
| 70 BackgroundLoader* background_loader_; | 76 BackgroundLoader* background_loader_; |
| 71 | 77 |
| 72 DISALLOW_COPY_AND_ASSIGN(BackgroundShellServiceLoader); | 78 DISALLOW_COPY_AND_ASSIGN(BackgroundShellServiceLoader); |
| 73 }; | 79 }; |
| 74 | 80 |
| 75 } // namespace mojo | 81 } // namespace mojo |
| 76 | 82 |
| 77 #endif // MOJO_SERVICE_MANAGER_BACKGROUND_SHELL_SERVICE_LOADER_H_ | 83 #endif // MOJO_SERVICE_MANAGER_BACKGROUND_SHELL_SERVICE_LOADER_H_ |
| OLD | NEW |