| Index: mojo/shell/in_thread_application_loader.h
|
| diff --git a/mojo/shell/static_application_loader.h b/mojo/shell/in_thread_application_loader.h
|
| similarity index 54%
|
| copy from mojo/shell/static_application_loader.h
|
| copy to mojo/shell/in_thread_application_loader.h
|
| index cbf611a0dac337cbb86cee8dda725e6481b62a6e..42c262afca182c2e576064216ba1afacd8147bf0 100644
|
| --- a/mojo/shell/static_application_loader.h
|
| +++ b/mojo/shell/in_thread_application_loader.h
|
| @@ -2,22 +2,18 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#ifndef MOJO_SHELL_STATIC_APPLICATION_LOADER_H_
|
| -#define MOJO_SHELL_STATIC_APPLICATION_LOADER_H_
|
| -
|
| -#include <list>
|
| +#ifndef MOJO_SHELL_IN_THREAD_APPLICATION_LOADER_H_
|
| +#define MOJO_SHELL_IN_THREAD_APPLICATION_LOADER_H_
|
|
|
| #include "base/callback.h"
|
| #include "base/macros.h"
|
| +#include "base/memory/scoped_ptr.h"
|
| #include "base/memory/weak_ptr.h"
|
| #include "mojo/shell/application_loader.h"
|
|
|
| -namespace base {
|
| -class SimpleThread;
|
| -}
|
| -
|
| namespace mojo {
|
| class ApplicationDelegate;
|
| +class ApplicationImpl;
|
| }
|
|
|
| namespace mojo {
|
| @@ -25,45 +21,44 @@ namespace shell {
|
|
|
| // An ApplicationLoader which loads a single type of app from a given
|
| // ApplicationDelegate factory. A Load() request is fulfilled by creating an
|
| -// instance of the app on a new thread. Only one instance of the app will run at
|
| -// a time. Any Load requests received while the app is running will be dropped.
|
| -class StaticApplicationLoader : public mojo::shell::ApplicationLoader {
|
| +// instance of the app on an existing thread. Only one instance of the app will
|
| +// run at a time. Any Load requests received while the app is running will be
|
| +// dropped.
|
| +class InThreadApplicationLoader : public mojo::shell::ApplicationLoader {
|
| public:
|
| using ApplicationFactory =
|
| base::Callback<scoped_ptr<mojo::ApplicationDelegate>()>;
|
|
|
| // Constructs a static loader for |factory|.
|
| - explicit StaticApplicationLoader(const ApplicationFactory& factory);
|
| + explicit InThreadApplicationLoader(const ApplicationFactory& factory);
|
|
|
| // Constructs a static loader for |factory| with a closure that will be called
|
| // when the loaded application quits.
|
| - StaticApplicationLoader(const ApplicationFactory& factory,
|
| - const base::Closure& quit_callback);
|
| + InThreadApplicationLoader(const ApplicationFactory& factory,
|
| + const base::Closure& termination_closure);
|
|
|
| - ~StaticApplicationLoader() override;
|
| + ~InThreadApplicationLoader() override;
|
|
|
| // mojo::shell::ApplicationLoader:
|
| void Load(const GURL& url,
|
| mojo::InterfaceRequest<mojo::Application> request) override;
|
|
|
| private:
|
| - void StopAppThread();
|
| -
|
| // The factory used t create new instances of the application delegate.
|
| ApplicationFactory factory_;
|
|
|
| // If not null, this is run when the loaded application quits.
|
| - base::Closure quit_callback_;
|
| + base::Closure termination_closure_;
|
|
|
| - // Thread for the application if currently running.
|
| - scoped_ptr<base::SimpleThread> thread_;
|
| + scoped_ptr<mojo::ApplicationDelegate> application_delegate_;
|
| + scoped_ptr<mojo::ApplicationImpl> application_impl_;
|
|
|
| - base::WeakPtrFactory<StaticApplicationLoader> weak_factory_;
|
| + base::WeakPtrFactory<InThreadApplicationLoader> weak_factory_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(StaticApplicationLoader);
|
| + DISALLOW_COPY_AND_ASSIGN(InThreadApplicationLoader);
|
| };
|
|
|
| } // namespace shell
|
| } // namespace mojo
|
|
|
| -#endif // MOJO_SHELL_STATIC_APPLICATION_LOADER_H_
|
| +#endif // MOJO_SHELL_IN_THREAD_APPLICATION_LOADER_H_
|
|
|