| 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 | |
| 41 private: | 35 private: |
| 42 class BackgroundLoader; | 36 class BackgroundLoader; |
| 43 | 37 |
| 44 // |base::DelegateSimpleThread::Delegate| method: | 38 // |base::DelegateSimpleThread::Delegate| method: |
| 45 virtual void Run() OVERRIDE; | 39 virtual void Run() OVERRIDE; |
| 46 | 40 |
| 47 // These functions are exected on the background thread. They call through | 41 // These functions are exected on the background thread. They call through |
| 48 // to |background_loader_| to do the actual loading. | 42 // to |background_loader_| to do the actual loading. |
| 49 // TODO: having this code take a |manager| is fragile (as ServiceManager isn't | 43 // TODO: having this code take a |manager| is fragile (as ServiceManager isn't |
| 50 // thread safe). | 44 // thread safe). |
| (...skipping 23 matching lines...) Expand all Loading... |
| 74 | 68 |
| 75 // Lives on |thread_|. Trivial interface that calls through to |loader_|. | 69 // Lives on |thread_|. Trivial interface that calls through to |loader_|. |
| 76 BackgroundLoader* background_loader_; | 70 BackgroundLoader* background_loader_; |
| 77 | 71 |
| 78 DISALLOW_COPY_AND_ASSIGN(BackgroundShellServiceLoader); | 72 DISALLOW_COPY_AND_ASSIGN(BackgroundShellServiceLoader); |
| 79 }; | 73 }; |
| 80 | 74 |
| 81 } // namespace mojo | 75 } // namespace mojo |
| 82 | 76 |
| 83 #endif // MOJO_SERVICE_MANAGER_BACKGROUND_SHELL_SERVICE_LOADER_H_ | 77 #endif // MOJO_SERVICE_MANAGER_BACKGROUND_SHELL_SERVICE_LOADER_H_ |
| OLD | NEW |