Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_SHELL_APP_CONTAINER_H_ | 5 #ifndef MOJO_SHELL_APP_CONTAINER_H_ |
| 6 #define MOJO_SHELL_APP_CONTAINER_H_ | 6 #define MOJO_SHELL_APP_CONTAINER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "base/threading/simple_thread.h" | |
| 12 #include "mojo/examples/hello_world_service/hello_world_service_impl.h" | |
| 11 #include "mojo/public/system/core.h" | 13 #include "mojo/public/system/core.h" |
| 12 #include "mojo/shell/loader.h" | 14 #include "mojo/shell/loader.h" |
| 13 | 15 |
| 14 namespace base { | 16 namespace base { |
| 15 class FilePath; | 17 class FilePath; |
| 16 class Thread; | 18 class PlatformThreadHandle; |
| 17 } | 19 } |
| 18 | 20 |
| 19 namespace mojo { | 21 namespace mojo { |
| 20 namespace services { | 22 namespace services { |
| 21 class NativeViewportController; | 23 class NativeViewportController; |
| 22 } | 24 } |
| 23 namespace shell { | 25 namespace shell { |
| 24 | 26 |
| 25 class Context; | 27 class Context; |
| 26 | 28 |
| 27 // A container class that runs an app on its own thread. | 29 // A container class that runs an app on its own thread. |
| 28 class AppContainer : public Loader::Delegate { | 30 class AppContainer |
| 31 : public Loader::Delegate, | |
| 32 public base::DelegateSimpleThread::Delegate { | |
| 29 public: | 33 public: |
| 30 explicit AppContainer(Context* context); | 34 explicit AppContainer(Context* context); |
| 31 virtual ~AppContainer(); | 35 virtual ~AppContainer(); |
| 32 | 36 |
| 33 void Load(const GURL& app_url); | 37 void Load(const GURL& app_url); |
| 34 | 38 |
| 35 private: | 39 private: |
| 36 // From Loader::Delegate | 40 // From Loader::Delegate. |
| 37 virtual void DidCompleteLoad(const GURL& app_url, | 41 virtual void DidCompleteLoad(const GURL& app_url, |
| 38 const base::FilePath& app_path) OVERRIDE; | 42 const base::FilePath& app_path) OVERRIDE; |
| 39 | 43 |
| 44 // From base::DelegateSimpleThread::Delegate. | |
| 45 virtual void Run() OVERRIDE; | |
|
sky
2013/11/15 17:11:56
In hopes of making code easier to maintain and rea
DaveMoore
2013/11/15 17:15:24
As said in comment, this is a WIP. When we make it
| |
| 46 | |
| 40 void AppCompleted(); | 47 void AppCompleted(); |
| 41 | 48 |
| 42 Context* context_; | 49 Context* context_; |
| 50 base::FilePath app_path_; | |
| 51 Handle app_handle_raw_; | |
| 52 base::Closure ack_closure_; | |
| 43 scoped_ptr<Loader::Job> request_; | 53 scoped_ptr<Loader::Job> request_; |
| 44 scoped_ptr<base::Thread> thread_; | 54 scoped_ptr<base::DelegateSimpleThread> thread_; |
| 55 scoped_ptr<examples::HelloWorldServiceImpl> hello_world_service_; | |
|
sky
2013/11/15 17:11:56
How come the appcontainer is depending upon an exa
abarth-chromium
2013/11/15 17:14:34
It's just temporary while we bring up the service
DaveMoore
2013/11/15 17:15:24
WIP. Next we will generalize and no longer have th
| |
| 45 scoped_ptr<services::NativeViewportController> native_viewport_controller_; | 56 scoped_ptr<services::NativeViewportController> native_viewport_controller_; |
| 46 | 57 |
| 47 // Following members are valid only on app thread. | |
| 48 Handle shell_handle_; | |
| 49 | |
| 50 base::WeakPtrFactory<AppContainer> weak_factory_; | 58 base::WeakPtrFactory<AppContainer> weak_factory_; |
| 51 | 59 |
| 52 DISALLOW_COPY_AND_ASSIGN(AppContainer); | 60 DISALLOW_COPY_AND_ASSIGN(AppContainer); |
| 53 }; | 61 }; |
| 54 | 62 |
| 55 } // namespace shell | 63 } // namespace shell |
| 56 } // namespace mojo | 64 } // namespace mojo |
| 57 | 65 |
| 58 #endif // MOJO_SHELL_APP_CONTAINER_H_ | 66 #endif // MOJO_SHELL_APP_CONTAINER_H_ |
| OLD | NEW |