Commit de3d0b0a authored by abarth@chromium.org's avatar abarth@chromium.org

[Mojo] Move JS bindings out of public

This CL moves the implementation of Mojo's JavaScript bindings out of the
"public" directory. The public directory is intended to be free of dependencies
on other parts of Chromium, but the JavaScript bindings depend on V8 and base.
Now, the bindings are just a subdirectory of mojo/apps/js, which is their only
client. This makes mojo.js more of a self-contained app.

R=darin@chromium.org

Review URL: https://codereview.chromium.org/100573003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238476 0039d316-1c4b-4281-b951-d872f2087c98
parent 58775bc4
......@@ -4,7 +4,7 @@
define([
"gin/test/expect",
"mojo/public/bindings/js/codec",
"mojo/apps/js/bindings/codec",
"mojom/sample_service",
], function(expect, codec, sample) {
testBar();
......
......@@ -3,9 +3,9 @@
// found in the LICENSE file.
define([
"mojo/public/bindings/js/codec",
"mojo/public/bindings/js/core",
"mojo/public/bindings/js/support",
"mojo/apps/js/bindings/codec",
"mojo/apps/js/bindings/core",
"mojo/apps/js/bindings/support",
], function(codec, core, support) {
function Connector(handle) {
......
......@@ -3,7 +3,7 @@
// found in the LICENSE file.
// Mock out the support module to avoid depending on the message loop.
define("mojo/public/bindings/js/support", function() {
define("mojo/apps/js/bindings/support", function() {
var waitingCallbacks = [];
function WaitCookie(id) {
......@@ -46,9 +46,9 @@ define("mojo/public/bindings/js/support", function() {
define([
"gin/test/expect",
"mojo/public/bindings/js/support",
"mojo/public/bindings/js/core",
"mojo/public/bindings/js/connector",
"mojo/apps/js/bindings/support",
"mojo/apps/js/bindings/core",
"mojo/apps/js/bindings/connector",
"mojom/sample_service",
], function(expect, mockSupport, core, connector, sample) {
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "mojo/public/bindings/js/core.h"
#include "mojo/apps/js/bindings/core.h"
#include "base/bind.h"
#include "base/logging.h"
......@@ -14,7 +14,7 @@
#include "gin/object_template_builder.h"
#include "gin/per_isolate_data.h"
#include "gin/public/wrapper_info.h"
#include "mojo/public/bindings/js/handle.h"
#include "mojo/apps/js/bindings/handle.h"
namespace mojo {
namespace js {
......@@ -86,7 +86,7 @@ gin::WrapperInfo g_wrapper_info = { gin::kEmbedderNativeGin };
} // namespace
const char Core::kModuleName[] = "mojo/public/bindings/js/core";
const char Core::kModuleName[] = "mojo/apps/js/bindings/core";
v8::Local<v8::ObjectTemplate> Core::GetTemplate(v8::Isolate* isolate) {
gin::PerIsolateData* data = gin::PerIsolateData::From(isolate);
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MOJO_PUBLIC_BINDINGS_JS_CORE_H_
#define MOJO_PUBLIC_BINDINGS_JS_CORE_H_
#ifndef MOJO_APPS_JS_BINDINGS_CORE_H_
#define MOJO_APPS_JS_BINDINGS_CORE_H_
#include "v8/include/v8.h"
......@@ -19,4 +19,4 @@ class Core {
} // namespace js
} // namespace mojo
#endif // MOJO_PUBLIC_BINDINGS_JS_CORE_H_
#endif // MOJO_APPS_JS_BINDINGS_CORE_H_
......@@ -4,7 +4,7 @@
define([
"gin/test/expect",
"mojo/public/bindings/js/core",
"mojo/apps/js/bindings/core",
], function(expect, core) {
runWithPipe(testNop);
runWithPipe(testReadAndWriteMessage);
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "mojo/public/bindings/js/handle.h"
#include "mojo/apps/js/bindings/handle.h"
namespace gin {
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MOJO_PUBLIC_BINDINGS_JS_HANDLE_H_
#define MOJO_PUBLIC_BINDINGS_JS_HANDLE_H_
#ifndef MOJO_APPS_JS_BINDINGS_HANDLE_H_
#define MOJO_APPS_JS_BINDINGS_HANDLE_H_
#include "gin/converter.h"
#include "mojo/public/system/core_cpp.h"
......@@ -20,4 +20,4 @@ struct Converter<mojo::Handle> {
} // namespace gin
#endif // MOJO_PUBLIC_BINDINGS_JS_HANDLE_H_
#endif // MOJO_APPS_JS_BINDINGS_HANDLE_H_
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "mojo/public/bindings/js/support.h"
#include "mojo/apps/js/bindings/support.h"
#include "base/bind.h"
#include "gin/arguments.h"
......@@ -12,8 +12,8 @@
#include "gin/per_isolate_data.h"
#include "gin/public/wrapper_info.h"
#include "gin/wrappable.h"
#include "mojo/public/bindings/js/handle.h"
#include "mojo/public/bindings/js/waiting_callback.h"
#include "mojo/apps/js/bindings/handle.h"
#include "mojo/apps/js/bindings/waiting_callback.h"
#include "mojo/public/bindings/lib/bindings_support.h"
namespace mojo {
......@@ -46,7 +46,7 @@ gin::WrapperInfo g_wrapper_info = { gin::kEmbedderNativeGin };
} // namespace
const char Support::kModuleName[] = "mojo/public/bindings/js/support";
const char Support::kModuleName[] = "mojo/apps/js/bindings/support";
v8::Local<v8::ObjectTemplate> Support::GetTemplate(v8::Isolate* isolate) {
gin::PerIsolateData* data = gin::PerIsolateData::From(isolate);
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MOJO_PUBLIC_BINDINGS_JS_SUPPORT_H_
#define MOJO_PUBLIC_BINDINGS_JS_SUPPORT_H_
#ifndef MOJO_APPS_JS_BINDINGS_SUPPORT_H_
#define MOJO_APPS_JS_BINDINGS_SUPPORT_H_
#include "v8/include/v8.h"
......@@ -19,4 +19,4 @@ class Support {
} // namespace js
} // namespace mojo
#endif // MOJO_PUBLIC_BINDINGS_JS_SUPPORT_H_
#endif // MOJO_APPS_JS_BINDINGS_SUPPORT_H_
......@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "mojo/apps/js/threading.h"
#include "mojo/apps/js/bindings/threading.h"
#include "base/bind.h"
#include "base/message_loop/message_loop.h"
#include "gin/function_template.h"
#include "gin/object_template_builder.h"
#include "gin/per_isolate_data.h"
#include "mojo/public/bindings/js/handle.h"
#include "mojo/apps/js/bindings/handle.h"
namespace mojo {
namespace apps {
......@@ -24,7 +24,7 @@ gin::WrapperInfo g_wrapper_info = { gin::kEmbedderNativeGin };
} // namespace
const char Threading::kModuleName[] = "mojo/apps/js/threading";
const char Threading::kModuleName[] = "mojo/apps/js/bindings/threading";
v8::Local<v8::ObjectTemplate> Threading::GetTemplate(v8::Isolate* isolate) {
gin::PerIsolateData* data = gin::PerIsolateData::From(isolate);
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "mojo/public/bindings/js/waiting_callback.h"
#include "mojo/apps/js/bindings/waiting_callback.h"
#include "gin/per_context_data.h"
#include "gin/per_isolate_data.h"
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MOJO_PUBLIC_BINDINGS_JS_WAITING_CALLBACK_H_
#define MOJO_PUBLIC_BINDINGS_JS_WAITING_CALLBACK_H_
#ifndef MOJO_APPS_JS_BINDINGS_WAITING_CALLBACK_H_
#define MOJO_APPS_JS_BINDINGS_WAITING_CALLBACK_H_
#include "gin/runner.h"
#include "gin/wrappable.h"
......@@ -53,4 +53,4 @@ struct Converter<mojo::js::WaitingCallback*>
} // namespace gin
#endif // MOJO_PUBLIC_BINDINGS_JS_WAITING_CALLBACK_H_
#endif // MOJO_APPS_JS_BINDINGS_WAITING_CALLBACK_H_
......@@ -4,10 +4,10 @@
define([
"console",
"mojo/apps/js/threading",
"mojo/public/bindings/js/connector",
"mojo/apps/js/bindings/connector",
"mojo/apps/js/bindings/threading",
"mojom/hello_world_service",
], function(console, threading, connector, hello) {
], function(console, connector, threading, hello) {
function HelloWorldClientImpl() {
}
......
......@@ -10,9 +10,9 @@
#include "gin/modules/console.h"
#include "gin/modules/module_registry.h"
#include "gin/try_catch.h"
#include "mojo/apps/js/threading.h"
#include "mojo/public/bindings/js/core.h"
#include "mojo/public/bindings/js/support.h"
#include "mojo/apps/js/bindings/core.h"
#include "mojo/apps/js/bindings/support.h"
#include "mojo/apps/js/bindings/threading.h"
namespace mojo {
namespace apps {
......
......@@ -7,7 +7,7 @@
#include "gin/modules/module_registry.h"
#include "gin/test/file_runner.h"
#include "gin/test/gtest.h"
#include "mojo/public/bindings/js/core.h"
#include "mojo/apps/js/bindings/core.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace mojo {
......@@ -28,9 +28,9 @@ void RunTest(std::string test) {
base::FilePath path;
PathService::Get(base::DIR_SOURCE_ROOT, &path);
path = path.AppendASCII("mojo")
.AppendASCII("public")
.AppendASCII("bindings")
.AppendASCII("apps")
.AppendASCII("js")
.AppendASCII("bindings")
.AppendASCII(test);
TestRunnerDelegate delegate;
gin::RunTestFromFile(path, &delegate);
......
......@@ -7,6 +7,7 @@
'chromium_code': 1,
},
'includes': [
'mojo_apps.gypi',
'mojo_examples.gypi',
'mojo_public.gypi',
'mojo_services.gypi',
......@@ -22,8 +23,7 @@
'mojo_common_lib',
'mojo_common_unittests',
'mojo_js',
'mojo_js_bindings',
'mojo_js_bindings_unittests',
'mojo_js_unittests',
'mojo_public_perftests',
'mojo_public_test_support',
'mojo_public_unittests',
......@@ -262,25 +262,6 @@
}],
],
},
{
'target_name': 'mojo_js',
'type': 'shared_library',
'dependencies': [
'../base/base.gyp:base',
'../gin/gin.gyp:gin',
'hello_world_service',
'mojo_common_lib',
'mojo_js_bindings',
'mojo_system',
],
'sources': [
'apps/js/main.cc',
'apps/js/mojo_runner_delegate.cc',
'apps/js/mojo_runner_delegate.h',
'apps/js/threading.cc',
'apps/js/threading.h',
],
},
],
'conditions': [
['OS=="android"', {
......
{
'targets': [
{
'target_name': 'mojo_js_lib',
'type': 'static_library',
'dependencies': [
'../base/base.gyp:base',
'../gin/gin.gyp:gin',
'hello_world_service',
'mojo_common_lib',
'mojo_system',
],
'export_dependent_settings': [
'../base/base.gyp:base',
'../gin/gin.gyp:gin',
'hello_world_service',
'mojo_common_lib',
'mojo_system',
],
'sources': [
'apps/js/mojo_runner_delegate.cc',
'apps/js/mojo_runner_delegate.h',
'apps/js/bindings/threading.cc',
'apps/js/bindings/threading.h',
'apps/js/bindings/core.cc',
'apps/js/bindings/core.h',
'apps/js/bindings/handle.cc',
'apps/js/bindings/handle.h',
'apps/js/bindings/support.cc',
'apps/js/bindings/support.h',
'apps/js/bindings/waiting_callback.cc',
'apps/js/bindings/waiting_callback.h',
],
},
{
'target_name': 'mojo_js_unittests',
'type': 'executable',
'dependencies': [
'../gin/gin.gyp:gin_test',
'mojo_js_lib',
'mojo_run_all_unittests',
'sample_service',
],
'sources': [
'apps/js/test/run_js_tests.cc',
],
},
{
'target_name': 'mojo_js',
'type': 'shared_library',
'dependencies': [
'mojo_js_lib',
],
'sources': [
'apps/js/main.cc',
],
},
],
}
......@@ -77,30 +77,6 @@
'public/bindings/lib/message_queue.h',
],
},
{
'target_name': 'mojo_js_bindings',
'type': 'static_library',
'include_dirs': [
'..'
],
'dependencies': [
'../gin/gin.gyp:gin',
'mojo_system',
],
'export_dependent_settings': [
'../gin/gin.gyp:gin',
],
'sources': [
'public/bindings/js/core.cc',
'public/bindings/js/core.h',
'public/bindings/js/handle.cc',
'public/bindings/js/handle.h',
'public/bindings/js/support.cc',
'public/bindings/js/support.h',
'public/bindings/js/waiting_callback.cc',
'public/bindings/js/waiting_callback.h',
],
},
{
'target_name': 'sample_service',
'type': 'static_library',
......@@ -126,19 +102,6 @@
'sample_service',
],
},
{
'target_name': 'mojo_js_bindings_unittests',
'type': 'executable',
'dependencies': [
'../gin/gin.gyp:gin_test',
'mojo_js_bindings',
'mojo_run_all_unittests',
'sample_service',
],
'sources': [
'public/bindings/js/test/run_js_tests.cc',
],
},
{
'target_name': 'gles2_client_impl',
'type': 'static_library',
......
......@@ -3,8 +3,8 @@
// found in the LICENSE file.
define([
"mojo/public/bindings/js/core",
"mojo/public/bindings/js/codec",
"mojo/apps/js/bindings/core",
"mojo/apps/js/bindings/codec",
], function(core, codec) {
{%- for struct in structs %}
......
include_rules = [
"+base",
"+gin",
"+testing",
"+v8",
]
......@@ -4,7 +4,7 @@
define([
"console",
"mojo/public/bindings/js/test/hexdump",
"mojo/apps/js/test/hexdump",
"gin/test/expect",
"mojom/sample_service"
], function(console, hexdump, expect, sample) {
......
......@@ -50,7 +50,7 @@ do_unittests() {
"out/$1/mojo_system_unittests" || exit 1
"out/$1/mojo_public_unittests" || exit 1
"out/$1/mojo_bindings_unittests" || exit 1
"out/$1/mojo_js_bindings_unittests" || exit 1
"out/$1/mojo_js_unittests" || exit 1
"out/$1/mojo_common_unittests" || exit 1
"out/$1/mojo_shell_unittests" || exit 1
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment