| Index: mojo/apps/js/js_app.h
|
| diff --git a/mojo/apps/js/js_app.h b/mojo/apps/js/js_app.h
|
| index 866261922ec28aab3a26fdd3d44d267b6e761efb..6bbaed4292fe5b1d99ad060eb2c67b300eb69876 100644
|
| --- a/mojo/apps/js/js_app.h
|
| +++ b/mojo/apps/js/js_app.h
|
| @@ -6,7 +6,6 @@
|
| #define MOJO_APPS_JS_JS_APP_H_
|
|
|
| #include "base/memory/ref_counted.h"
|
| -#include "base/single_thread_task_runner.h"
|
| #include "base/threading/thread.h"
|
| #include "gin/public/isolate_holder.h"
|
| #include "gin/shell_runner.h"
|
| @@ -21,19 +20,26 @@ class ApplicationDelegateImpl;
|
|
|
| // Each JavaScript app started by content handler runs on its own thread and
|
| // in its own V8 isolate. This class represents one running JS app.
|
| -//
|
| -// The lifetime of this class is defined by the content handler's internal
|
| -// "app_vector" list.
|
|
|
| class JSApp {
|
| public:
|
| - JSApp(ApplicationDelegateImpl* content_handler_app,
|
| - const std::string& url,
|
| - URLResponsePtr content);
|
| - ~JSApp();
|
| + JSApp(ApplicationDelegateImpl* app_delegate_impl);
|
| + virtual ~JSApp();
|
|
|
| + // Launch this app on a new thread. This method can be called on any thread.
|
| + // This method causes Load() and then Run() to run on a new thread.
|
| bool Start();
|
| +
|
| +
|
| + // Subclasses must return the JS source code for this app's main script and
|
| + // the filename or URL that identifies the script's origin. This method will
|
| + // be called from this app's thread.
|
| + virtual bool Load(std::string* source, std::string* file_name) = 0;
|
| +
|
| + // Called by the JS mojo module to quit this JS app. See mojo_module.cc.
|
| void Quit();
|
| +
|
| + // Called by the JS mojo module to connect to a Mojo service.
|
| Handle ConnectToService(const std::string& application_url,
|
| const std::string& interface_name);
|
|
|
| @@ -42,14 +48,12 @@ class JSApp {
|
| void Terminate();
|
|
|
| // Used to CHECK that we're running on the correct thread.
|
| - bool on_content_handler_thread() const;
|
| + bool on_app_delegate_impl_thread() const;
|
| bool on_js_app_thread() const;
|
|
|
| - ApplicationDelegateImpl* content_handler_app_;
|
| - std::string url_;
|
| - URLResponsePtr content_;
|
| + ApplicationDelegateImpl* app_delegate_impl_;
|
| base::Thread thread_;
|
| - scoped_refptr<base::SingleThreadTaskRunner> content_handler_task_runner_;
|
| + scoped_refptr<base::SingleThreadTaskRunner> app_delegate_impl_task_runner_;
|
| scoped_refptr<base::SingleThreadTaskRunner> js_app_task_runner_;
|
| MojoRunnerDelegate runner_delegate_;
|
| scoped_ptr<gin::IsolateHolder> isolate_holder_;
|
|
|