Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Unified Diff: mojo/apps/js/js_app.h

Issue 467263006: JavaScript Content Handler Version 0.0 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Working and relatively complete Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: mojo/apps/js/js_app.h
diff --git a/mojo/apps/js/js_app.h b/mojo/apps/js/js_app.h
new file mode 100644
index 0000000000000000000000000000000000000000..5dd7ea3367d2cbe2cce56f98120c1472a7211aa3
--- /dev/null
+++ b/mojo/apps/js/js_app.h
@@ -0,0 +1,64 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef JS_APP_H_
+#define 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"
+#include "mojo/apps/js/mojo_runner_delegate.h"
+#include "mojo/services/public/interfaces/content_handler/content_handler.mojom.h"
+
+namespace mojo {
+namespace apps {
+
+class JSContentHandlerApp;
+
+class JSAppRunnerDelegate : public MojoRunnerDelegate {
+ public:
+ JSAppRunnerDelegate();
+};
+
+class JSApp : public base::RefCountedThreadSafe<JSApp> {
Aaron Boodman 2014/09/10 02:22:09 In general it is preferred that every class have a
Aaron Boodman 2014/09/10 02:22:09 RefCounting can make understanding code harder bec
hansmuller 2014/09/11 00:26:17 OK
+ public:
+ JSApp(JSContentHandlerApp* content_handler_app,
+ const std::string& url,
+ URLResponsePtr content);
+
+ static JSApp* From(v8::Isolate* isolate);
+
+ ScopedMessagePipeHandle ConnectToService(
+ const std::string& application_url, const std::string& interface_name);
+
+ bool Start();
+ void Quit();
+
+ private:
+ JSContentHandlerApp* content_handler_app_;
+ std::string url_;
+ URLResponsePtr content_;
+ base::Thread thread_;
+ scoped_refptr<base::SingleThreadTaskRunner> content_handler_task_runner_;
+ scoped_refptr<base::SingleThreadTaskRunner> js_app_task_runner_;
+ JSAppRunnerDelegate runner_delegate_;
+ scoped_ptr<gin::IsolateHolder> isolate_holder_;
+ scoped_ptr<gin::ShellRunner> shell_runner_;
+
+ void Run();
+ void Terminate();
+ bool on_content_handler_thread() const;
+ bool on_js_app_thread() const;
+
+ ~JSApp();
+ friend class base::RefCountedThreadSafe<JSApp>;
Aaron Boodman 2014/09/10 02:22:09 decl order is incorrect -- see reference to styleg
hansmuller 2014/09/11 00:26:16 I've removed the RefCountedThreadSafe boilerplate
+ DISALLOW_COPY_AND_ASSIGN(JSApp);
+};
+
+} // namespace apps
+} // namespace mojo
+
+#endif // JS_APP_H_
« no previous file with comments | « gin/public/gin_embedders.h ('k') | mojo/apps/js/js_app.cc » ('j') | mojo/apps/js/js_app.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698