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_SERVICE_LOADER_H_ | 5 #ifndef MOJO_SERVICE_MANAGER_BACKGROUND_SERVICE_LOADER_H_ |
6 #define MOJO_SERVICE_MANAGER_BACKGROUND_SERVICE_LOADER_H_ | 6 #define MOJO_SERVICE_MANAGER_BACKGROUND_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/threading/thread.h" | 10 #include "base/threading/thread.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 virtual void OnServiceError(ServiceManager* manager, | 31 virtual void OnServiceError(ServiceManager* manager, |
32 const GURL& url) OVERRIDE; | 32 const GURL& url) OVERRIDE; |
33 | 33 |
34 private: | 34 private: |
35 class BackgroundLoader; | 35 class BackgroundLoader; |
36 | 36 |
37 // These functions are exected on the background thread. They call through | 37 // These functions are exected on the background thread. They call through |
38 // to |background_loader_| to do the actual loading. | 38 // to |background_loader_| to do the actual loading. |
39 // TODO: having this code take a |manager| is fragile (as ServiceManager isn't | 39 // TODO: having this code take a |manager| is fragile (as ServiceManager isn't |
40 // thread safe). | 40 // thread safe). |
41 void LoadServiceOnBackgroundThread( | 41 void LoadServiceOnBackgroundThread(ServiceManager* manager, |
42 ServiceManager* manager, | 42 const GURL& url, |
43 const GURL& url, | 43 ScopedMessagePipeHandle* shell_handle); |
44 ScopedMessagePipeHandle* service_provider_handle); | |
45 void OnServiceErrorOnBackgroundThread(ServiceManager* manager, | 44 void OnServiceErrorOnBackgroundThread(ServiceManager* manager, |
46 const GURL& url); | 45 const GURL& url); |
47 void ShutdownOnBackgroundThread(); | 46 void ShutdownOnBackgroundThread(); |
48 | 47 |
49 scoped_ptr<ServiceLoader> loader_; | 48 scoped_ptr<ServiceLoader> loader_; |
50 base::Thread thread_; | 49 base::Thread thread_; |
51 base::MessageLoop::Type message_loop_type_; | 50 base::MessageLoop::Type message_loop_type_; |
52 | 51 |
53 // Lives on |thread_|. Trivial interface that calls through to |loader_|. | 52 // Lives on |thread_|. Trivial interface that calls through to |loader_|. |
54 BackgroundLoader* background_loader_; | 53 BackgroundLoader* background_loader_; |
55 | 54 |
56 DISALLOW_COPY_AND_ASSIGN(BackgroundServiceLoader); | 55 DISALLOW_COPY_AND_ASSIGN(BackgroundServiceLoader); |
57 }; | 56 }; |
58 | 57 |
59 } // namespace mojo | 58 } // namespace mojo |
60 | 59 |
61 #endif // MOJO_SERVICE_MANAGER_BACKGROUND_SERVICE_LOADER_H_ | 60 #endif // MOJO_SERVICE_MANAGER_BACKGROUND_SERVICE_LOADER_H_ |
OLD | NEW |