summaryrefslogtreecommitdiffstats
path: root/mojo/public
diff options
context:
space:
mode:
authorthakis <thakis@chromium.org>2014-11-14 16:04:25 -0800
committerCommit bot <commit-bot@chromium.org>2014-11-15 00:04:49 +0000
commit671db43a735bd2297225b9d74129402e66fdc549 (patch)
treeeeeb2735f56d964bcdd6a6bf8aa206d41a744b6c /mojo/public
parent3ec1799a199d75eda8bfe2040252df4e05e10735 (diff)
downloadchromium_src-671db43a735bd2297225b9d74129402e66fdc549.zip
chromium_src-671db43a735bd2297225b9d74129402e66fdc549.tar.gz
chromium_src-671db43a735bd2297225b9d74129402e66fdc549.tar.bz2
Revert of Update mojo sdk to rev afb4440fd5a10cba980878c326180b7ad7960480 (patchset #3 id:40001 of https://codereview.chromium.org/728553002/)
Reason for revert: Breaks incremental builds, crbug.com/433524 Original issue's description: > Update mojo sdk to rev afb4440fd5a10cba980878c326180b7ad7960480 > > TBR=jam@chromium.org > > Committed: https://crrev.com/184f354ddeff66784515ddbbee9c46355cadab6a > Cr-Commit-Position: refs/heads/master@{#304114} TBR=jam@chromium.org,jamesr@chromium.org NOTREECHECKS=true NOTRY=true Review URL: https://codereview.chromium.org/728043002 Cr-Commit-Position: refs/heads/master@{#304305}
Diffstat (limited to 'mojo/public')
-rw-r--r--mojo/public/VERSION2
-rw-r--r--mojo/public/cpp/application/BUILD.gn8
-rw-r--r--mojo/public/cpp/application/lib/DEPS8
-rw-r--r--mojo/public/cpp/application/lib/application_test_main.cc7
-rw-r--r--mojo/public/cpp/bindings/BUILD.gn2
-rw-r--r--mojo/public/cpp/bindings/binding.h136
-rw-r--r--mojo/public/cpp/bindings/interface_impl.h86
-rw-r--r--mojo/public/cpp/bindings/lib/interface_impl_internal.h128
-rw-r--r--mojo/public/cpp/bindings/strong_binding.h88
-rw-r--r--mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc168
-rw-r--r--mojo/public/cpp/bindings/tests/validation_unittest.cc2
-rw-r--r--mojo/public/cpp/utility/tests/BUILD.gn10
-rw-r--r--mojo/public/dart/BUILD.gn46
-rw-r--r--mojo/public/dart/DEPS4
-rw-r--r--mojo/public/dart/README14
-rw-r--r--mojo/public/dart/core.dart19
-rw-r--r--mojo/public/dart/mojo_init.dart16
-rw-r--r--mojo/public/dart/src/buffer.dart107
-rw-r--r--mojo/public/dart/src/data_pipe.dart191
-rw-r--r--mojo/public/dart/src/handle.dart68
-rw-r--r--mojo/public/dart/src/message_pipe.dart155
-rw-r--r--mojo/public/dart/src/mojo_dart_core.cc659
-rw-r--r--mojo/public/dart/src/types.dart116
-rw-r--r--mojo/public/go/system/impl/mojo_types.go1
-rw-r--r--mojo/public/java/bindings/src/org/chromium/mojo/bindings/Decoder.java10
-rw-r--r--mojo/public/java/bindings/src/org/chromium/mojo/bindings/Encoder.java18
-rw-r--r--mojo/public/java/bindings/src/org/chromium/mojo/bindings/ServiceMessage.java2
-rw-r--r--mojo/public/java/system/src/org/chromium/mojo/system/DataPipe.java15
-rw-r--r--mojo/public/js/core.js1
-rw-r--r--mojo/public/js/core_unittests.js25
-rw-r--r--mojo/public/js/threading.js21
-rw-r--r--mojo/public/mojo_public.gyp61
-rw-r--r--mojo/public/python/mojo/bindings/descriptor.py2
-rw-r--r--mojo/public/python/mojo/bindings/messaging.py4
-rw-r--r--mojo/public/python/mojo/bindings/serialization.py4
-rw-r--r--mojo/public/python/mojo/c_core.pxd1
-rw-r--r--mojo/public/python/mojo/system.pyx1
-rw-r--r--mojo/public/tools/bindings/mojom_bindings_generator.gypi63
-rw-r--r--mojo/public/tools/bindings/mojom_bindings_generator_explicit.gypi69
-rw-r--r--mojo/public/tools/bindings/mojom_bindings_generator_variables.gypi67
-rwxr-xr-xmojo/public/tools/bindings/mojom_list_outputs.py34
41 files changed, 307 insertions, 2132 deletions
diff --git a/mojo/public/VERSION b/mojo/public/VERSION
index f700f55..1156739 100644
--- a/mojo/public/VERSION
+++ b/mojo/public/VERSION
@@ -1 +1 @@
-afb4440fd5a10cba980878c326180b7ad7960480 \ No newline at end of file
+04a510fb37db10642e156957f9b2c11c2f6442ac \ No newline at end of file
diff --git a/mojo/public/cpp/application/BUILD.gn b/mojo/public/cpp/application/BUILD.gn
index ad46086..1eacdc6 100644
--- a/mojo/public/cpp/application/BUILD.gn
+++ b/mojo/public/cpp/application/BUILD.gn
@@ -64,13 +64,11 @@ source_set("test_support") {
source_set("test_support_standalone") {
testonly = true
- sources = [ "lib/application_test_main.cc" ]
-
- public_deps = [ ":test_support" ]
+ sources = [ "lib/application_test_main.cc", ]
+ public_deps = [ ":test_support", ]
deps = [
- ":application",
"//mojo/public/cpp/environment:standalone",
+ "//mojo/public/cpp/application",
"//mojo/public/cpp/system",
- "//mojo/public/cpp/utility",
]
}
diff --git a/mojo/public/cpp/application/lib/DEPS b/mojo/public/cpp/application/lib/DEPS
index a04ed0f..a49df6a 100644
--- a/mojo/public/cpp/application/lib/DEPS
+++ b/mojo/public/cpp/application/lib/DEPS
@@ -1,3 +1,5 @@
-include_rules = [
- "+mojo/public/cpp/utility",
-]
+specific_include_rules = {
+ r"application_runner\.cc": [
+ "+mojo/public/cpp/utility",
+ ],
+}
diff --git a/mojo/public/cpp/application/lib/application_test_main.cc b/mojo/public/cpp/application/lib/application_test_main.cc
index 6cdfb0d..9b76dad1 100644
--- a/mojo/public/cpp/application/lib/application_test_main.cc
+++ b/mojo/public/cpp/application/lib/application_test_main.cc
@@ -6,18 +6,16 @@
#include "mojo/public/cpp/application/application_delegate.h"
#include "mojo/public/cpp/application/application_impl.h"
#include "mojo/public/cpp/application/application_test_base.h"
-#include "mojo/public/cpp/environment/environment.h"
#include "mojo/public/cpp/environment/logging.h"
#include "mojo/public/cpp/system/message_pipe.h"
-#include "mojo/public/cpp/utility/run_loop.h"
MojoResult MojoMain(MojoHandle shell_handle) {
// An Environment instance is needed to construct run loops.
mojo::Environment environment;
{
- // This loop is used for init, and then destroyed before running tests.
- mojo::RunLoop run_loop;
+ // This RunLoop is used for init, and then destroyed before running tests.
+ mojo::Environment::InstantiateDefaultRunLoop();
// Construct an ApplicationImpl just for the GTEST commandline arguments.
// GTEST command line arguments are supported amid application arguments:
@@ -40,6 +38,7 @@ MojoResult MojoMain(MojoHandle shell_handle) {
testing::InitGoogleTest(&argc, const_cast<char**>(&(argv[0])));
mojo::test::SetShellHandle(app.UnbindShell());
+ mojo::Environment::DestroyDefaultRunLoop();
}
int result = RUN_ALL_TESTS();
diff --git a/mojo/public/cpp/bindings/BUILD.gn b/mojo/public/cpp/bindings/BUILD.gn
index 143ab83..86ccae0 100644
--- a/mojo/public/cpp/bindings/BUILD.gn
+++ b/mojo/public/cpp/bindings/BUILD.gn
@@ -5,14 +5,12 @@
source_set("bindings") {
sources = [
"array.h",
- "binding.h",
"error_handler.h",
"interface_ptr.h",
"map.h",
"message.h",
"message_filter.h",
"no_interface.h",
- "strong_binding.h",
"string.h",
"struct_ptr.h",
"type_converter.h",
diff --git a/mojo/public/cpp/bindings/binding.h b/mojo/public/cpp/bindings/binding.h
deleted file mode 100644
index 2c4c9ce..0000000
--- a/mojo/public/cpp/bindings/binding.h
+++ /dev/null
@@ -1,136 +0,0 @@
-// 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 MOJO_PUBLIC_CPP_BINDINGS_BINDING_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_BINDING_H_
-
-#include "mojo/public/c/environment/async_waiter.h"
-#include "mojo/public/cpp/bindings/error_handler.h"
-#include "mojo/public/cpp/bindings/interface_ptr.h"
-#include "mojo/public/cpp/bindings/interface_request.h"
-#include "mojo/public/cpp/bindings/lib/filter_chain.h"
-#include "mojo/public/cpp/bindings/lib/message_header_validator.h"
-#include "mojo/public/cpp/bindings/lib/router.h"
-#include "mojo/public/cpp/environment/logging.h"
-#include "mojo/public/cpp/system/core.h"
-
-namespace mojo {
-
-// This binds an interface implementation a pipe. Deleting the binding closes
-// the pipe.
-//
-// Example:
-//
-// #include "foo.mojom.h"
-//
-// class FooImpl : public Foo {
-// public:
-// explicit FooImpl(ScopedMessagePipeHandle handle)
-// : binding_(this, handle.Pass()) {}
-//
-// // Foo implementation here.
-//
-// private:
-// Binding<Foo> binding_;
-// };
-//
-template <typename Interface>
-class Binding : public ErrorHandler {
- public:
- using Client = typename Interface::Client;
-
- explicit Binding(Interface* impl) : impl_(impl) { stub_.set_sink(impl_); }
-
- Binding(Interface* impl,
- ScopedMessagePipeHandle handle,
- const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter())
- : Binding(impl) {
- Bind(handle.Pass(), waiter);
- }
-
- Binding(Interface* impl,
- InterfacePtr<Interface>* ptr,
- const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter())
- : Binding(impl) {
- Bind(ptr, waiter);
- }
-
- Binding(Interface* impl,
- InterfaceRequest<Interface> request,
- const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter())
- : Binding(impl) {
- Bind(request.PassMessagePipe(), waiter);
- }
-
- ~Binding() override {
- delete proxy_;
- if (internal_router_) {
- internal_router_->set_error_handler(nullptr);
- delete internal_router_;
- }
- }
-
- void Bind(
- ScopedMessagePipeHandle handle,
- const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) {
- internal::FilterChain filters;
- filters.Append<internal::MessageHeaderValidator>();
- filters.Append<typename Interface::RequestValidator_>();
- filters.Append<typename Client::ResponseValidator_>();
-
- internal_router_ =
- new internal::Router(handle.Pass(), filters.Pass(), waiter);
- internal_router_->set_incoming_receiver(&stub_);
- internal_router_->set_error_handler(this);
-
- proxy_ = new typename Client::Proxy_(internal_router_);
- }
-
- void Bind(
- InterfacePtr<Interface>* ptr,
- const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) {
- MessagePipe pipe;
- ptr->Bind(pipe.handle0.Pass(), waiter);
- Bind(pipe.handle1.Pass(), waiter);
- }
-
- void Bind(
- InterfaceRequest<Interface> request,
- const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) {
- Bind(request.PassMessagePipe(), waiter);
- }
-
- bool WaitForIncomingMethodCall() {
- MOJO_DCHECK(internal_router_);
- return internal_router_->WaitForIncomingMessage();
- }
-
- void set_error_handler(ErrorHandler* error_handler) {
- error_handler_ = error_handler;
- }
-
- // ErrorHandler implementation
- void OnConnectionError() override {
- if (error_handler_)
- error_handler_->OnConnectionError();
- }
-
- Interface* impl() { return impl_; }
- Client* client() { return proxy_; }
- // Exposed for testing, should not generally be used.
- internal::Router* internal_router() { return internal_router_; }
-
- private:
- internal::Router* internal_router_ = nullptr;
- typename Client::Proxy_* proxy_ = nullptr;
- typename Interface::Stub_ stub_;
- Interface* impl_;
- ErrorHandler* error_handler_ = nullptr;
-
- MOJO_DISALLOW_COPY_AND_ASSIGN(Binding);
-};
-
-} // namespace mojo
-
-#endif // MOJO_PUBLIC_CPP_BINDINGS_BINDING_H_
diff --git a/mojo/public/cpp/bindings/interface_impl.h b/mojo/public/cpp/bindings/interface_impl.h
index 0917103..da1055d 100644
--- a/mojo/public/cpp/bindings/interface_impl.h
+++ b/mojo/public/cpp/bindings/interface_impl.h
@@ -5,41 +5,40 @@
#ifndef MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_IMPL_H_
#define MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_IMPL_H_
-#include "mojo/public/cpp/bindings/binding.h"
#include "mojo/public/cpp/bindings/interface_request.h"
+#include "mojo/public/cpp/bindings/lib/interface_impl_internal.h"
#include "mojo/public/cpp/environment/environment.h"
#include "mojo/public/cpp/system/macros.h"
namespace mojo {
-// DEPRECATED! Please use mojo::Binding instead of InterfaceImpl<> in new code.
-//
// InterfaceImpl<..> is designed to be the base class of an interface
// implementation. It may be bound to a pipe or a proxy, see BindToPipe and
// BindToProxy.
template <typename Interface>
-class InterfaceImpl : public Interface, public ErrorHandler {
+class InterfaceImpl : public internal::InterfaceImplBase<Interface> {
public:
- using ImplementedInterface = Interface;
- using Client = typename Interface::Client;
+ typedef typename Interface::Client Client;
+ typedef Interface ImplementedInterface;
- InterfaceImpl() : binding_(this), error_handler_impl_(this) {
- binding_.set_error_handler(&error_handler_impl_);
- }
+ InterfaceImpl() : internal_state_(this) {}
virtual ~InterfaceImpl() {}
- void BindToHandle(
- ScopedMessagePipeHandle handle,
- const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) {
- binding_.Bind(handle.Pass(), waiter);
- }
+ // Returns a proxy to the client interface. This is null upon construction,
+ // and becomes non-null after OnClientConnected. NOTE: It remains non-null
+ // until this instance is deleted.
+ Client* client() { return internal_state_.client(); }
+ // Blocks the current thread for the first incoming method call, i.e., either
+ // a call to a method or a client callback method. Returns |true| if a method
+ // has been called, |false| in case of error. It must only be called on a
+ // bound object.
bool WaitForIncomingMethodCall() {
- return binding_.WaitForIncomingMethodCall();
+ return internal_state_.WaitForIncomingMethodCall();
}
- Client* client() { return binding_.client(); }
- internal::Router* internal_router() { return binding_.internal_router(); }
+ // Called when the client has connected to this instance.
+ virtual void OnConnectionEstablished() {}
// Called when the client is no longer connected to this instance. NOTE: The
// client() method continues to return a non-null pointer after this method
@@ -47,42 +46,13 @@ class InterfaceImpl : public Interface, public ErrorHandler {
// will be silently ignored.
virtual void OnConnectionError() {}
- void set_delete_on_error(bool delete_on_error) {
- error_handler_impl_.set_delete_on_error(delete_on_error);
+ // DO NOT USE. Exposed only for internal use and for testing.
+ internal::InterfaceImplState<Interface>* internal_state() {
+ return &internal_state_;
}
private:
- class ErrorHandlerImpl : public ErrorHandler {
- public:
- explicit ErrorHandlerImpl(InterfaceImpl* impl) : impl_(impl) {}
- ~ErrorHandlerImpl() override {}
-
- // ErrorHandler implementation:
- void OnConnectionError() override {
- // If the the instance is not bound to the pipe, the instance might choose
- // to delete the binding in the OnConnectionError handler, which would in
- // turn delete |this|. Save the error behavior before invoking the error
- // handler so we can correctly decide what to do.
- bool delete_on_error = delete_on_error_;
- impl_->OnConnectionError();
- if (delete_on_error)
- delete impl_;
- }
-
- void set_delete_on_error(bool delete_on_error) {
- delete_on_error_ = delete_on_error;
- }
-
- private:
- InterfaceImpl* impl_;
- bool delete_on_error_ = false;
-
- MOJO_DISALLOW_COPY_AND_ASSIGN(ErrorHandlerImpl);
- };
-
- Binding<Interface> binding_;
- ErrorHandlerImpl error_handler_impl_;
-
+ internal::InterfaceImplState<Interface> internal_state_;
MOJO_DISALLOW_COPY_AND_ASSIGN(InterfaceImpl);
};
@@ -97,13 +67,14 @@ class InterfaceImpl : public Interface, public ErrorHandler {
// called on the current thread, and if the current thread exits, then the end
// point of the pipe will be closed and the error handler's OnConnectionError
// method will be called.
+//
+// Before returning, the instance's OnConnectionEstablished method is called.
template <typename Impl>
Impl* BindToPipe(
Impl* instance,
ScopedMessagePipeHandle handle,
const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) {
- instance->set_delete_on_error(true);
- instance->BindToHandle(handle.Pass(), waiter);
+ instance->internal_state()->Bind(handle.Pass(), true, waiter);
return instance;
}
@@ -113,7 +84,7 @@ Impl* WeakBindToPipe(
Impl* instance,
ScopedMessagePipeHandle handle,
const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) {
- instance->BindToHandle(handle.Pass(), waiter);
+ instance->internal_state()->Bind(handle.Pass(), false, waiter);
return instance;
}
@@ -126,13 +97,14 @@ Impl* WeakBindToPipe(
// The instance is also bound to the current thread. Its methods will only be
// called on the current thread, and if the current thread exits, then it will
// also be deleted, and along with it, its end point of the pipe will be closed.
+//
+// Before returning, the instance's OnConnectionEstablished method is called.
template <typename Impl, typename Interface>
Impl* BindToProxy(
Impl* instance,
InterfacePtr<Interface>* ptr,
const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) {
- instance->set_delete_on_error(true);
- WeakBindToProxy(instance, ptr, waiter);
+ instance->internal_state()->BindProxy(ptr, true, waiter);
return instance;
}
@@ -142,9 +114,7 @@ Impl* WeakBindToProxy(
Impl* instance,
InterfacePtr<Interface>* ptr,
const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) {
- MessagePipe pipe;
- ptr->Bind(pipe.handle0.Pass(), waiter);
- instance->BindToHandle(pipe.handle1.Pass(), waiter);
+ instance->internal_state()->BindProxy(ptr, false, waiter);
return instance;
}
diff --git a/mojo/public/cpp/bindings/lib/interface_impl_internal.h b/mojo/public/cpp/bindings/lib/interface_impl_internal.h
new file mode 100644
index 0000000..492b182
--- /dev/null
+++ b/mojo/public/cpp/bindings/lib/interface_impl_internal.h
@@ -0,0 +1,128 @@
+// 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 MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_IMPL_INTERNAL_H_
+#define MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_IMPL_INTERNAL_H_
+
+#include "mojo/public/cpp/bindings/error_handler.h"
+#include "mojo/public/cpp/bindings/interface_ptr.h"
+#include "mojo/public/cpp/bindings/lib/filter_chain.h"
+#include "mojo/public/cpp/bindings/lib/message_header_validator.h"
+#include "mojo/public/cpp/environment/environment.h"
+#include "mojo/public/cpp/environment/logging.h"
+#include "mojo/public/cpp/system/macros.h"
+
+namespace mojo {
+namespace internal {
+
+template <typename Interface>
+class InterfaceImplBase : public Interface {
+ public:
+ virtual ~InterfaceImplBase() {}
+ virtual void OnConnectionEstablished() = 0;
+ virtual void OnConnectionError() = 0;
+};
+
+template <typename Interface>
+class InterfaceImplState : public ErrorHandler {
+ public:
+ typedef typename Interface::Client Client;
+
+ explicit InterfaceImplState(InterfaceImplBase<Interface>* instance)
+ : router_(nullptr),
+ proxy_(nullptr),
+ instance_bound_to_pipe_(false)
+#ifndef NDEBUG
+ ,
+ deleting_instance_due_to_error_(false)
+#endif
+ {
+ MOJO_DCHECK(instance);
+ stub_.set_sink(instance);
+ }
+
+ virtual ~InterfaceImplState() {
+#ifndef NDEBUG
+ MOJO_DCHECK(!instance_bound_to_pipe_ || deleting_instance_due_to_error_);
+#endif
+ delete proxy_;
+ if (router_) {
+ router_->set_error_handler(nullptr);
+ delete router_;
+ }
+ }
+
+ void BindProxy(
+ InterfacePtr<Interface>* ptr,
+ bool instance_bound_to_pipe,
+ const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) {
+ MessagePipe pipe;
+ ptr->Bind(pipe.handle0.Pass(), waiter);
+ Bind(pipe.handle1.Pass(), instance_bound_to_pipe, waiter);
+ }
+
+ void Bind(ScopedMessagePipeHandle handle,
+ bool instance_bound_to_pipe,
+ const MojoAsyncWaiter* waiter) {
+ MOJO_CHECK(!router_);
+
+ FilterChain filters;
+ filters.Append<MessageHeaderValidator>();
+ filters.Append<typename Interface::RequestValidator_>();
+ filters.Append<typename Interface::Client::ResponseValidator_>();
+
+ router_ = new Router(handle.Pass(), filters.Pass(), waiter);
+ router_->set_incoming_receiver(&stub_);
+ router_->set_error_handler(this);
+
+ proxy_ = new typename Client::Proxy_(router_);
+
+ instance_bound_to_pipe_ = instance_bound_to_pipe;
+
+ instance()->OnConnectionEstablished();
+ }
+
+ bool WaitForIncomingMethodCall() {
+ MOJO_DCHECK(router_);
+ return router_->WaitForIncomingMessage();
+ }
+
+ Router* router() { return router_; }
+ Client* client() { return proxy_; }
+
+ private:
+ InterfaceImplBase<Interface>* instance() {
+ return static_cast<InterfaceImplBase<Interface>*>(stub_.sink());
+ }
+
+ virtual void OnConnectionError() override {
+ // If the the instance is not bound to the pipe, the instance might choose
+ // to delete itself in the OnConnectionError handler, which would in turn
+ // delete this. Save the error behavior before invoking the error handler
+ // so we can correctly decide what to do.
+ bool bound = instance_bound_to_pipe_;
+ instance()->OnConnectionError();
+ if (!bound)
+ return;
+#ifndef NDEBUG
+ deleting_instance_due_to_error_ = true;
+#endif
+ delete instance();
+ }
+
+ Router* router_;
+ typename Client::Proxy_* proxy_;
+ typename Interface::Stub_ stub_;
+ bool instance_bound_to_pipe_;
+#ifndef NDEBUG
+ bool deleting_instance_due_to_error_;
+#endif
+
+ MOJO_DISALLOW_COPY_AND_ASSIGN(InterfaceImplState);
+};
+
+} // namespace internal
+} // namespace mojo
+
+#endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_IMPL_INTERNAL_H_
diff --git a/mojo/public/cpp/bindings/strong_binding.h b/mojo/public/cpp/bindings/strong_binding.h
deleted file mode 100644
index 73966ff..0000000
--- a/mojo/public/cpp/bindings/strong_binding.h
+++ /dev/null
@@ -1,88 +0,0 @@
-// 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 MOJO_PUBLIC_CPP_BINDINGS_STRONG_BINDING_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_STRONG_BINDING_H_
-
-#include "mojo/public/c/environment/async_waiter.h"
-#include "mojo/public/cpp/bindings/binding.h"
-#include "mojo/public/cpp/bindings/error_handler.h"
-#include "mojo/public/cpp/bindings/interface_ptr.h"
-#include "mojo/public/cpp/bindings/interface_request.h"
-#include "mojo/public/cpp/bindings/lib/filter_chain.h"
-#include "mojo/public/cpp/bindings/lib/message_header_validator.h"
-#include "mojo/public/cpp/bindings/lib/router.h"
-#include "mojo/public/cpp/system/core.h"
-
-namespace mojo {
-
-// This connects an interface implementation strongly to a pipe. When a
-// connection error is detected the implementation is deleted. Deleting the
-// connector also closes the pipe.
-//
-// Example of an implementation that is always bound strongly to a pipe
-//
-// class StronglyBound : public Foo {
-// public:
-// explicit StronglyBound(ScopedMessagePipeHandle handle)
-// : binding_(this, handle.Pass()) {}
-//
-// // Foo implementation here
-//
-// private:
-// StrongBinding<Foo> binding_;
-// };
-//
-template <typename Interface>
-class StrongBinding : public ErrorHandler {
- public:
- explicit StrongBinding(Interface* impl) : binding_(impl) {
- binding_.set_error_handler(this);
- }
-
- StrongBinding(
- Interface* impl,
- ScopedMessagePipeHandle handle,
- const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter())
- : StrongBinding(impl) {
- binding_.Bind(handle.Pass(), waiter);
- }
-
- StrongBinding(
- Interface* impl,
- InterfaceRequest<Interface> request,
- const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter())
- : StrongBinding(impl) {
- binding_.Bind(request.Pass(), waiter);
- }
-
- ~StrongBinding() override {}
-
- bool WaitForIncomingMethodCall() {
- return binding_.WaitForIncomingMethodCall();
- }
-
- void set_error_handler(ErrorHandler* error_handler) {
- error_handler_ = error_handler;
- }
-
- typename Interface::Client* client() { return binding_.client(); }
- // Exposed for testing, should not generally be used.
- internal::Router* internal_router() { return binding_.internal_router(); }
-
- // ErrorHandler implementation
- void OnConnectionError() override {
- if (error_handler_)
- error_handler_->OnConnectionError();
- delete binding_.impl();
- }
-
- private:
- ErrorHandler* error_handler_ = nullptr;
- Binding<Interface> binding_;
-};
-
-} // namespace mojo
-
-#endif // MOJO_PUBLIC_CPP_BINDINGS_STRONG_BINDING_H_
diff --git a/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc b/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc
index 91ce84b..0cd5646 100644
--- a/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc
+++ b/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc
@@ -2,9 +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/cpp/bindings/binding.h"
#include "mojo/public/cpp/bindings/error_handler.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
#include "mojo/public/cpp/environment/environment.h"
#include "mojo/public/cpp/utility/run_loop.h"
#include "mojo/public/interfaces/bindings/tests/math_calculator.mojom.h"
@@ -31,7 +29,9 @@ class MathCalculatorImpl : public InterfaceImpl<math::Calculator> {
public:
~MathCalculatorImpl() override {}
- MathCalculatorImpl() : total_(0.0) {}
+ MathCalculatorImpl() : total_(0.0), got_connection_(false) {}
+
+ void OnConnectionEstablished() override { got_connection_ = true; }
void Clear() override { client()->Output(total_); }
@@ -45,8 +45,11 @@ class MathCalculatorImpl : public InterfaceImpl<math::Calculator> {
client()->Output(total_);
}
+ bool got_connection() const { return got_connection_; }
+
private:
double total_;
+ bool got_connection_;
};
class MathCalculatorUIImpl : public math::CalculatorUI {
@@ -120,7 +123,12 @@ class ReentrantServiceImpl : public InterfaceImpl<sample::Service> {
public:
~ReentrantServiceImpl() override {}
- ReentrantServiceImpl() : call_depth_(0), max_call_depth_(0) {}
+ ReentrantServiceImpl()
+ : got_connection_(false), call_depth_(0), max_call_depth_(0) {}
+
+ void OnConnectionEstablished() override { got_connection_ = true; }
+
+ bool got_connection() const { return got_connection_; }
int max_call_depth() { return max_call_depth_; }
@@ -137,6 +145,7 @@ class ReentrantServiceImpl : public InterfaceImpl<sample::Service> {
void GetPort(mojo::InterfaceRequest<sample::Port> port) override {}
private:
+ bool got_connection_;
int call_depth_;
int max_call_depth_;
};
@@ -154,7 +163,8 @@ class InterfacePtrTest : public testing::Test {
TEST_F(InterfacePtrTest, EndToEnd) {
math::CalculatorPtr calc;
- BindToProxy(new MathCalculatorImpl(), &calc);
+ MathCalculatorImpl* impl = BindToProxy(new MathCalculatorImpl(), &calc);
+ EXPECT_TRUE(impl->got_connection());
// Suppose this is instantiated in a process that has pipe1_.
MathCalculatorUIImpl calculator_ui(calc.Pass());
@@ -170,6 +180,7 @@ TEST_F(InterfacePtrTest, EndToEnd) {
TEST_F(InterfacePtrTest, EndToEnd_Synchronous) {
math::CalculatorPtr calc;
MathCalculatorImpl* impl = BindToProxy(new MathCalculatorImpl(), &calc);
+ EXPECT_TRUE(impl->got_connection());
// Suppose this is instantiated in a process that has pipe1_.
MathCalculatorUIImpl calculator_ui(calc.Pass());
@@ -241,7 +252,7 @@ TEST_F(InterfacePtrTest, EncounteredError) {
EXPECT_FALSE(calculator_ui.encountered_error());
// Close the server.
- server->internal_router()->CloseMessagePipe();
+ server->internal_state()->router()->CloseMessagePipe();
// The state change isn't picked up locally yet.
EXPECT_FALSE(calculator_ui.encountered_error());
@@ -270,7 +281,7 @@ TEST_F(InterfacePtrTest, EncounteredErrorCallback) {
EXPECT_FALSE(calculator_ui.encountered_error());
// Close the server.
- server->internal_router()->CloseMessagePipe();
+ server->internal_state()->router()->CloseMessagePipe();
// The state change isn't picked up locally yet.
EXPECT_FALSE(calculator_ui.encountered_error());
@@ -326,6 +337,7 @@ TEST_F(InterfacePtrTest, NestedDestroyInterfacePtrOnClientMethod) {
TEST_F(InterfacePtrTest, ReentrantWaitForIncomingMethodCall) {
sample::ServicePtr proxy;
ReentrantServiceImpl* impl = BindToProxy(new ReentrantServiceImpl(), &proxy);
+ EXPECT_TRUE(impl->got_connection());
proxy->Frobinate(sample::FooPtr(),
sample::Service::BAZ_OPTIONS_REGULAR,
@@ -339,148 +351,6 @@ TEST_F(InterfacePtrTest, ReentrantWaitForIncomingMethodCall) {
EXPECT_EQ(2, impl->max_call_depth());
}
-class StrongMathCalculatorImpl : public math::Calculator, public ErrorHandler {
- public:
- StrongMathCalculatorImpl(ScopedMessagePipeHandle handle,
- bool* error_received,
- bool* destroyed)
- : error_received_(error_received),
- destroyed_(destroyed),
- binding_(this, handle.Pass()) {
- binding_.set_error_handler(this);
- }
- ~StrongMathCalculatorImpl() override { *destroyed_ = true; }
-
- // math::Calculator implementation.
- void Clear() override { binding_.client()->Output(total_); }
-
- void Add(double value) override {
- total_ += value;
- binding_.client()->Output(total_);
- }
-
- void Multiply(double value) override {
- total_ *= value;
- binding_.client()->Output(total_);
- }
-
- // ErrorHandler implementation.
- void OnConnectionError() override { *error_received_ = true; }
-
- private:
- double total_ = 0.0;
- bool* error_received_;
- bool* destroyed_;
-
- StrongBinding<math::Calculator> binding_;
-};
-
-TEST(StrongConnectorTest, Math) {
- Environment env;
- RunLoop loop;
-
- bool error_received = false;
- bool destroyed = false;
- MessagePipe pipe;
- new StrongMathCalculatorImpl(pipe.handle0.Pass(), &error_received,
- &destroyed);
-
- math::CalculatorPtr calc;
- calc.Bind(pipe.handle1.Pass());
-
- {
- // Suppose this is instantiated in a process that has the other end of the
- // message pipe.
- MathCalculatorUIImpl calculator_ui(calc.Pass());
-
- calculator_ui.Add(2.0);
- calculator_ui.Multiply(5.0);
-
- loop.RunUntilIdle();
-
- EXPECT_EQ(10.0, calculator_ui.GetOutput());
- EXPECT_FALSE(error_received);
- EXPECT_FALSE(destroyed);
- }
- // Destroying calculator_ui should close the pipe and generate an error on the
- // other
- // end which will destroy the instance since it is strongly bound.
-
- loop.RunUntilIdle();
- EXPECT_TRUE(error_received);
- EXPECT_TRUE(destroyed);
-}
-
-class WeakMathCalculatorImpl : public math::Calculator, public ErrorHandler {
- public:
- WeakMathCalculatorImpl(ScopedMessagePipeHandle handle,
- bool* error_received,
- bool* destroyed)
- : error_received_(error_received),
- destroyed_(destroyed),
- binding_(this, handle.Pass()) {
- binding_.set_error_handler(this);
- }
- ~WeakMathCalculatorImpl() override { *destroyed_ = true; }
-
- void Clear() override { binding_.client()->Output(total_); }
-
- void Add(double value) override {
- total_ += value;
- binding_.client()->Output(total_);
- }
-
- void Multiply(double value) override {
- total_ *= value;
- binding_.client()->Output(total_);
- }
-
- // ErrorHandler implementation.
- void OnConnectionError() override { *error_received_ = true; }
-
- private:
- double total_ = 0.0;
- bool* error_received_;
- bool* destroyed_;
-
- Binding<math::Calculator> binding_;
-};
-
-TEST(WeakConnectorTest, Math) {
- Environment env;
- RunLoop loop;
-
- bool error_received = false;
- bool destroyed = false;
- MessagePipe pipe;
- WeakMathCalculatorImpl impl(pipe.handle0.Pass(), &error_received, &destroyed);
-
- math::CalculatorPtr calc;
- calc.Bind(pipe.handle1.Pass());
-
- {
- // Suppose this is instantiated in a process that has the other end of the
- // message pipe.
- MathCalculatorUIImpl calculator_ui(calc.Pass());
-
- calculator_ui.Add(2.0);
- calculator_ui.Multiply(5.0);
-
- loop.RunUntilIdle();
-
- EXPECT_EQ(10.0, calculator_ui.GetOutput());
- EXPECT_FALSE(error_received);
- EXPECT_FALSE(destroyed);
- // Destroying calculator_ui should close the pipe and generate an error on
- // the other
- // end which will destroy the instance since it is strongly bound.
- }
-
- loop.RunUntilIdle();
- EXPECT_TRUE(error_received);
- EXPECT_FALSE(destroyed);
-}
-
} // namespace
} // namespace test
} // namespace mojo
diff --git a/mojo/public/cpp/bindings/tests/validation_unittest.cc b/mojo/public/cpp/bindings/tests/validation_unittest.cc
index 6507f21..c7edf19e 100644
--- a/mojo/public/cpp/bindings/tests/validation_unittest.cc
+++ b/mojo/public/cpp/bindings/tests/validation_unittest.cc
@@ -409,7 +409,7 @@ TEST_F(ValidationIntegrationTest, InterfaceImpl) {
// |interface1_impl| will delete itself when the pipe is closed.
IntegrationTestInterface1Impl* interface1_impl =
BindToPipe(new IntegrationTestInterface1Impl(), testee_endpoint().Pass());
- interface1_impl->internal_router()->EnableTestingMode();
+ interface1_impl->internal_state()->router()->EnableTestingMode();
RunValidationTests("integration_", test_message_receiver());
}
diff --git a/mojo/public/cpp/utility/tests/BUILD.gn b/mojo/public/cpp/utility/tests/BUILD.gn
index 67419d4..dd1d154 100644
--- a/mojo/public/cpp/utility/tests/BUILD.gn
+++ b/mojo/public/cpp/utility/tests/BUILD.gn
@@ -13,14 +13,8 @@ test("mojo_public_utility_unittests") {
]
sources = [
+ "mutex_unittest.cc",
"run_loop_unittest.cc",
+ "thread_unittest.cc",
]
-
- # crbug.com/342893
- if (!is_win) {
- sources += [
- "mutex_unittest.cc",
- "thread_unittest.cc",
- ]
- }
}
diff --git a/mojo/public/dart/BUILD.gn b/mojo/public/dart/BUILD.gn
index c2e8f6a..83c5a25 100644
--- a/mojo/public/dart/BUILD.gn
+++ b/mojo/public/dart/BUILD.gn
@@ -3,62 +3,16 @@
# found in the LICENSE file.
group("dart") {
- testonly = true
deps = [
- ":core",
":bindings",
]
}
-group("core") {
- deps = [
- ":mojo_dart_core",
- ":copy_core_library",
- ]
-}
-
-
-shared_library("mojo_dart_core") {
- defines = ["DART_SHARED_LIB"]
- sources = [
- "src/mojo_dart_core.cc",
- ]
- deps = [
- "//mojo/public/c/environment",
- "//mojo/public/c/system:for_shared_library",
- "//mojo/public/cpp/environment:standalone",
- "//mojo/public/cpp/system",
- "//mojo/public/cpp/utility",
- "//mojo/public/cpp/bindings:callback",
- ]
-}
-
-
-copy("copy_core_library") {
- sources = [
- "$root_out_dir/libmojo_dart_core.so",
- ]
- outputs = [
- "$root_out_dir/gen/mojo/public/dart/src/libmojo_dart_core.so"
- ]
- deps =[
- ":mojo_dart_core"
- ]
-}
-
-
copy("bindings") {
sources = [
"bindings.dart",
- "core.dart",
- "mojo_init.dart",
- "src/buffer.dart",
"src/codec.dart",
- "src/data_pipe.dart",
- "src/handle.dart",
- "src/message_pipe.dart",
- "src/types.dart",
]
outputs = [
"{{source_gen_dir}}/{{source_file_part}}"
diff --git a/mojo/public/dart/DEPS b/mojo/public/dart/DEPS
deleted file mode 100644
index 53d0007..0000000
--- a/mojo/public/dart/DEPS
+++ /dev/null
@@ -1,4 +0,0 @@
-include_rules = [
- "+dart",
- "+base",
-] \ No newline at end of file
diff --git a/mojo/public/dart/README b/mojo/public/dart/README
index 5ff7ee3..aadb348 100644
--- a/mojo/public/dart/README
+++ b/mojo/public/dart/README
@@ -39,17 +39,3 @@ e.g. out/ReleaseX64/dart-sdk/bin to your path.
4.) Run Dart tests.
$ ./mojob.sh --release darttest
-
-
-These are instructions for adding a Dart VM source checkout to your client.
-
-1. Edit your .gclient file.
-
- Replace "DEPS" with "DEPS.dart"
-
-2. Run:
-
- $ gclient sync
-
- You should now have a directory //src/dart
-
diff --git a/mojo/public/dart/core.dart b/mojo/public/dart/core.dart
deleted file mode 100644
index 5159440..0000000
--- a/mojo/public/dart/core.dart
+++ /dev/null
@@ -1,19 +0,0 @@
-// 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.
-
-library core;
-
-import 'dart:async';
-import 'dart:core';
-import 'dart:isolate';
-import 'dart:typed_data';
-import 'dart-ext:src/mojo_dart_core';
-
-part 'src/buffer.dart';
-part 'src/data_pipe.dart';
-part 'src/handle.dart';
-part 'src/message_pipe.dart';
-part 'src/types.dart';
-
-void mojoSystemThunksSet(int thunks) native "MojoSystemThunks_Set";
diff --git a/mojo/public/dart/mojo_init.dart b/mojo/public/dart/mojo_init.dart
deleted file mode 100644
index c622f5f..0000000
--- a/mojo/public/dart/mojo_init.dart
+++ /dev/null
@@ -1,16 +0,0 @@
-// 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.
-
-library mojo_init;
-
-import 'core.dart' as core;
-import 'dart-ext:src/mojo_dart_init';
-
-void _init() native "MojoLibrary_Init";
-void _mojoSystemThunksMake(Function fn) native "MojoSystemThunks_Make";
-
-void mojoInit() {
- _init();
- _mojoSystemThunksMake(core.mojoSystemThunksSet);
-}
diff --git a/mojo/public/dart/src/buffer.dart b/mojo/public/dart/src/buffer.dart
deleted file mode 100644
index a00838e..0000000
--- a/mojo/public/dart/src/buffer.dart
+++ /dev/null
@@ -1,107 +0,0 @@
-// 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.
-
-part of core;
-
-class _MojoSharedBufferNatives {
- static List Create(int num_bytes, int flags)
- native "MojoSharedBuffer_Create";
-
- static List Duplicate(int buffer_handle, int flags)
- native "MojoSharedBuffer_Duplicate";
-
- static List Map(int buffer_handle, int offset, int num_bytes, int flags)
- native "MojoSharedBuffer_Map";
-
- static int Unmap(ByteData buffer)
- native "MojoSharedBuffer_Unmap";
-}
-
-
-class MojoSharedBuffer {
- static const int CREATE_FLAG_NONE = 0;
- static const int DUPLICATE_FLAG_NONE = 0;
- static const int MAP_FLAG_NONE = 0;
-
- RawMojoHandle handle;
- MojoResult status;
- ByteData mapping;
-
- MojoSharedBuffer._() {
- handle = null;
- status = MojoResult.OK;
- mapping = null;
- }
-
- factory MojoSharedBuffer(int num_bytes, [int flags = 0]) {
- List result = _MojoSharedBufferNatives.Create(num_bytes, flags);
- if (result == null) {
- return null;
- }
- assert((result is List) && (result.length == 2));
- var r = new MojoResult(result[0]);
- if (!r.isOk) {
- return null;
- }
-
- MojoSharedBuffer buf = new MojoSharedBuffer._();
- buf.status = r;
- buf.handle = new RawMojoHandle(result[1]);
- buf.mapping = null;
- return buf;
- }
-
- factory MojoSharedBuffer.duplicate(MojoSharedBuffer msb, [int flags = 0]) {
- List result = _MojoSharedBufferNatives.Duplicate(msb.handle.h, flags);
- if (result == null) {
- return null;
- }
- assert((result is List) && (result.length == 2));
- var r = new MojoResult(result[0]);
- if(!r.isOk) {
- return null;
- }
-
- MojoSharedBuffer dupe = new MojoSharedBuffer._();
- dupe.status = r;
- dupe.handle = new RawMojoHandle(result[1]);
- dupe.mapping = msb.mapping;
- return dupe;
- }
-
- MojoResult close() {
- if (handle == null) {
- status = MojoResult.INVALID_ARGUMENT;
- return status;
- }
- MojoResult r = handle.close();
- status = r;
- mapping = null;
- return status;
- }
-
- MojoResult map(int offset, int num_bytes, [int flags = 0]) {
- if (handle == null) {
- status = MojoResult.INVALID_ARGUMENT;
- return status;
- }
- List result = _MojoSharedBufferNatives.Map(
- handle.h, offset, num_bytes, flags);
- if (result == null) {
- status = MojoResult.INVALID_ARGUMENT;
- return status;
- }
- assert((result is List) && (result.length == 2));
- status = new MojoResult(result[0]);
- mapping = result[1];
- return status;
- }
-
- MojoResult unmap() {
- int r = _MojoSharedBufferNatives.Unmap(mapping);
- status = new MojoResult(r);
- mapping = null;
- return status;
- }
-}
diff --git a/mojo/public/dart/src/data_pipe.dart b/mojo/public/dart/src/data_pipe.dart
deleted file mode 100644
index 665285d..0000000
--- a/mojo/public/dart/src/data_pipe.dart
+++ /dev/null
@@ -1,191 +0,0 @@
-// 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.
-
-part of core;
-
-
-class _MojoDataPipeNatives {
- static List MojoCreateDataPipe(
- int element_bytes, int capacity_bytes, int flags)
- native "MojoDataPipe_Create";
-
- static List MojoWriteData(int handle, ByteData data, int num_bytes, int flags)
- native "MojoDataPipe_WriteData";
-
- static List MojoBeginWriteData(int handle, int buffer_bytes, int flags)
- native "MojoDataPipe_BeginWriteData";
-
- static int MojoEndWriteData(int handle, int bytes_written)
- native "MojoDataPipe_EndWriteData";
-
- static List MojoReadData(int handle, ByteData data, int num_bytes, int flags)
- native "MojoDataPipe_ReadData";
-
- static List MojoBeginReadData(int handle, int buffer_bytes, int flags)
- native "MojoDataPipe_BeginReadData";
-
- static int MojoEndReadData(int handle, int bytes_read)
- native "MojoDataPipe_EndReadData";
-}
-
-
-class MojoDataPipeProducer {
- static const int FLAG_NONE = 0;
- static const int FLAG_ALL_OR_NONE = 1 << 0;
-
- RawMojoHandle handle;
- MojoResult status;
- final int element_bytes;
-
- MojoDataPipeProducer(this.handle,
- this.status,
- this.element_bytes);
-
- int write(ByteData data, [int num_bytes = -1, int flags = 0]) {
- if (handle == null) {
- status = MojoResult.INVALID_ARGUMENT;
- return status;
- }
-
- int data_num_bytes = (num_bytes == -1) ? data.lengthInBytes : num_bytes;
- List result = _MojoDataPipeNatives.MojoWriteData(
- handle.h, data, data_num_bytes, flags);
- if (result == null) {
- status = MojoResult.INVALID_ARGUMENT;
- return status;
- }
-
- assert((result is List) && (result.length == 2));
- status = new MojoResult(result[0]);
- return result[1];
- }
-
- ByteData beginWrite(int buffer_bytes, [int flags = 0]) {
- if (handle == null) {
- status = MojoResult.INVALID_ARGUMENT;
- return null;
- }
-
- List result = _MojoDataPipeNatives.MojoBeginWriteData(
- handle.h, buffer_bytes, flags);
- if (result == null) {
- status = MojoResult.INVALID_ARGUMENT;
- return null;
- }
-
- assert((result is List) && (result.length == 2));
- status = new MojoResult(result[0]);
- return result[1];
- }
-
- MojoResult endWrite(int bytes_written) {
- if (handle == null) {
- status = MojoResult.INVALID_ARGUMENT;
- return status;
- }
- int result = _MojoDataPipeNatives.MojoEndWriteData(handle.h, bytes_written);
- status = new MojoResult(result);
- return status;
- }
-}
-
-
-class MojoDataPipeConsumer {
- static const int FLAG_NONE = 0;
- static const int FLAG_ALL_OR_NONE = 1 << 0;
- static const int FLAG_MAY_DISCARD = 1 << 1;
- static const int FLAG_QUERY = 1 << 2;
-
- RawMojoHandle handle;
- MojoResult status;
- final int element_bytes;
-
- MojoDataPipeConsumer(this.handle,
- this.status,
- this.element_bytes);
-
- int read(ByteData data, [int num_bytes = -1, int flags = 0]) {
- if (handle == null) {
- status = MojoResult.INVALID_ARGUMENT;
- return status;
- }
-
- int data_num_bytes = (num_bytes == -1) ? data.lengthInBytes : num_bytes;
- List result = _MojoDataPipeNatives.MojoReadData(
- handle.h, data, data_num_bytes, flags);
- if (result == null) {
- status = MojoResult.INVALID_ARGUMENT;
- return status;
- }
- assert((result is List) && (result.length == 2));
- status = new MojoResult(result[0]);
- return result[1];
- }
-
- ByteData beginRead(int buffer_bytes, [int flags = 0]) {
- if (handle == null) {
- status = MojoResult.INVALID_ARGUMENT;
- return null;
- }
-
- List result = _MojoDataPipeNatives.MojoBeginReadData(
- handle.h, buffer_bytes, flags);
- if (result == null) {
- status = MojoResult.INVALID_ARGUMENT;
- return null;
- }
-
- assert((result is List) && (result.length == 2));
- status = new MojoResult(result[0]);
- return result[1];
- }
-
- MojoResult endRead(int bytes_read) {
- if (handle == null) {
- status = MojoResult.INVALID_ARGUMENT;
- return status;
- }
- int result = _MojoDataPipeNatives.MojoEndReadData(handle.h, bytes_read);
- status = new MojoResult(result);
- return status;
- }
-}
-
-
-class MojoDataPipe {
- static const int FLAG_NONE = 0;
- static const int FLAG_MAY_DISCARD = 1 << 0;
- static const int DEFAULT_ELEMENT_SIZE = 1;
- static const int DEFAULT_CAPACITY = 0;
-
- MojoDataPipeProducer producer;
- MojoDataPipeConsumer consumer;
- MojoResult status;
-
- MojoDataPipe._internal() {
- producer = null;
- consumer = null;
- status = MojoResult.OK;
- }
-
- factory MojoDataPipe([int element_bytes = DEFAULT_ELEMENT_SIZE,
- int capacity_bytes = DEFAULT_CAPACITY,
- int flags = FLAG_NONE]) {
- List result = _MojoDataPipeNatives.MojoCreateDataPipe(
- element_bytes, capacity_bytes, flags);
- if (result == null) {
- return null;
- }
- assert((result is List) && (result.length == 3));
- RawMojoHandle producer_handle = new RawMojoHandle(result[1]);
- RawMojoHandle consumer_handle = new RawMojoHandle(result[2]);
- MojoDataPipe pipe = new MojoDataPipe._internal();
- pipe.producer = new MojoDataPipeProducer(
- producer_handle, new MojoResult(result[0]), element_bytes);
- pipe.consumer = new MojoDataPipeConsumer(
- consumer_handle, new MojoResult(result[0]), element_bytes);
- pipe.status = new MojoResult(result[0]);
- return pipe;
- }
-}
diff --git a/mojo/public/dart/src/handle.dart b/mojo/public/dart/src/handle.dart
deleted file mode 100644
index 08a23ae..0000000
--- a/mojo/public/dart/src/handle.dart
+++ /dev/null
@@ -1,68 +0,0 @@
-// 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.
-
-part of core;
-
-
-class _MojoHandleNatives {
- static int close(int handle) native "MojoHandle_Close";
- static int wait(int handle, int signals, int deadline)
- native "MojoHandle_Wait";
- static int waitMany(
- List handles, List signals, int num_handles, int deadline)
- native "MojoHandle_WaitMany";
-}
-
-
-class RawMojoHandle {
- static const int INVALID = 0;
- static const int DEADLINE_INDEFINITE = -1;
-
- RawMojoHandle(this.h);
-
- MojoResult close() {
- int result = _MojoHandleNatives.close(h);
- h = INVALID;
- return new MojoResult(result);
- }
-
- MojoResult wait(int signals, int deadline) {
- int result = _MojoHandleNatives.wait(h, signals, deadline);
- return new MojoResult(result);
- }
-
- bool _ready(int signal) {
- MojoResult res = wait(signal, 0);
- switch (res) {
- case MojoResult.OK:
- return true;
- case MojoResult.DEADLINE_EXCEEDED:
- case MojoResult.CANCELLED:
- case MojoResult.INVALID_ARGUMENT:
- case MojoResult.FAILED_PRECONDITION:
- return false;
- default:
- // Should be unreachable.
- throw new Exception("Unreachable");
- }
- }
-
- bool readyRead() => _ready(MojoHandleSignals.READABLE);
- bool readyWrite() => _ready(MojoHandleSignals.WRITABLE);
-
- static MojoResult waitMany(List<int> handles,
- List<int> signals,
- int deadline) {
- if (handles.length != signals.length) {
- return MojoResult.INVALID_ARGUMENT;
- }
- int result = _MojoHandleNatives.waitMany(
- handles, signals, handles.length, deadline);
- return new MojoResult(result);
- }
-
- static bool isValid(RawMojoHandle h) => (h.h != INVALID);
-
- int h;
-}
diff --git a/mojo/public/dart/src/message_pipe.dart b/mojo/public/dart/src/message_pipe.dart
deleted file mode 100644
index 81d9f28..0000000
--- a/mojo/public/dart/src/message_pipe.dart
+++ /dev/null
@@ -1,155 +0,0 @@
-// 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.
-
-part of core;
-
-
-class _MojoMessagePipeNatives {
- static List MojoCreateMessagePipe(int flags)
- native "MojoMessagePipe_Create";
-
- static int MojoWriteMessage(
- int handle, ByteData data, int num_bytes, List<int> handles, int flags)
- native "MojoMessagePipe_Write";
-
- static List MojoReadMessage(
- int handle, ByteData data, int num_bytes, List<int> handles, int flags)
- native "MojoMessagePipe_Read";
-}
-
-
-class MojoMessagePipeReadResult {
- final MojoResult status;
- final int bytesRead;
- final int handlesRead;
-
- MojoMessagePipeReadResult(this.status, this.bytesRead, this.handlesRead);
- MojoMessagePipeReadResult.fromList(List<int> resultList)
- : this(new MojoResult(resultList[0]), resultList[1], resultList[2]);
-}
-
-
-class MojoMessagePipeEndpoint {
- static const int WRITE_FLAG_NONE = 0;
- static const int READ_FLAG_NONE = 0;
- static const int READ_FLAG_MAY_DISCARD = 0;
-
- RawMojoHandle handle;
- MojoResult status;
-
- MojoMessagePipeEndpoint(this.handle);
-
- MojoResult write(ByteData data,
- [int num_bytes = -1,
- List<RawMojoHandle> handles = null,
- int flags = 0]) {
- if (handle == null) {
- status = MojoResult.INVALID_ARGUMENT;
- return status;
- }
-
- // If num_bytes has the default value, use the full length of the data.
- int data_num_bytes = (num_bytes == -1) ? data.lengthInBytes : num_bytes;
- if (data_num_bytes > data.lengthInBytes) {
- status = MojoResult.INVALID_ARGUMENT;
- return status;
- }
-
- // handles may be null, otherwise convert to ints.
- List<int> mojo_handles =
- (handles != null) ? handles.map((h) => h.h).toList() : null;
-
- // Do the call.
- int result = _MojoMessagePipeNatives.MojoWriteMessage(
- handle.h, data, data_num_bytes, mojo_handles, flags);
-
- status = new MojoResult(result);
- return status;
- }
-
-
- MojoMessagePipeReadResult read(ByteData data,
- [int num_bytes = -1,
- List<RawMojoHandle> handles = null,
- int flags = 0]) {
- if (handle == null) {
- status = MojoResult.INVALID_ARGUMENT;
- return null;
- }
-
- // If num_bytes has the default value, use the full length of the data.
- int data_num_bytes;
- if (data == null) {
- data_num_bytes = 0;
- } else {
- data_num_bytes = (num_bytes == -1) ? data.lengthInBytes : num_bytes;
- }
- if (data_num_bytes > data.lengthInBytes) {
- status = MojoResult.INVALID_ARGUMENT;
- return status;
- }
-
- // handles may be null, otherwise make an int list for the handles.
- List<int> mojo_handles;
- if (handles == null) {
- mojo_handles = null;
- } else {
- mojo_handles = new List<int>(handles.length);
- }
-
- // Do the call.
- List result = _MojoMessagePipeNatives.MojoReadMessage(
- handle.h, data, data_num_bytes, mojo_handles, flags);
-
- if (result == null) {
- status = MojoResult.INVALID_ARGUMENT;
- return null;
- }
-
- assert((result is List) && (result.length == 3));
- var readResult = new MojoMessagePipeReadResult.fromList(result);
-
- // Copy out the handles that were read.
- if (handles != null) {
- for (var i = 0; i < readResult.handlesRead; i++) {
- handles[i].h = mojo_handles[i];
- }
- }
-
- status = readResult.status;
- return readResult;
- }
-
- MojoMessagePipeReadResult query() => read(null);
-}
-
-
-class MojoMessagePipe {
- static const int FLAG_NONE = 0;
-
- List<MojoMessagePipeEndpoint> endpoints;
- MojoResult status;
-
- MojoMessagePipe._() {
- endpoints = null;
- status = MojoResult.OK;
- }
-
- factory MojoMessagePipe([int flags = FLAG_NONE]) {
- List result = _MojoMessagePipeNatives.MojoCreateMessagePipe(flags);
- if (result == null) {
- return null;
- }
- assert((result is List) && (result.length == 3));
-
- RawMojoHandle end1 = new RawMojoHandle(result[1]);
- RawMojoHandle end2 = new RawMojoHandle(result[2]);
- MojoMessagePipe pipe = new MojoMessagePipe._();
- pipe.endpoints = new List(2);
- pipe.endpoints[0] = new MojoMessagePipeEndpoint(end1);
- pipe.endpoints[1] = new MojoMessagePipeEndpoint(end2);
- pipe.status = new MojoResult(result[0]);
- return pipe;
- }
-}
diff --git a/mojo/public/dart/src/mojo_dart_core.cc b/mojo/public/dart/src/mojo_dart_core.cc
deleted file mode 100644
index 7cb50d8..0000000
--- a/mojo/public/dart/src/mojo_dart_core.cc
+++ /dev/null
@@ -1,659 +0,0 @@
-// 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.
-
-#include <stdio.h>
-#include <string.h>
-
-#include "base/memory/scoped_ptr.h"
-#include "dart/runtime/include/dart_api.h"
-#include "mojo/public/c/system/core.h"
-#include "mojo/public/platform/native/system_thunks.h"
-
-
-static Dart_NativeFunction ResolveName(
- Dart_Handle name, int argc, bool* auto_setup_scope);
-
-
-DART_EXPORT Dart_Handle mojo_dart_core_Init(Dart_Handle parent_library) {
- if (Dart_IsError(parent_library)) {
- return parent_library;
- }
-
- Dart_Handle result_code = Dart_SetNativeResolver(
- parent_library, ResolveName, NULL);
- if (Dart_IsError(result_code)) {
- return result_code;
- }
-
- return Dart_Null();
-}
-
-
-static Dart_Handle HandleError(Dart_Handle handle) {
- if (Dart_IsError(handle)) {
- Dart_PropagateError(handle);
- }
- return handle;
-}
-
-
-static void SetNullReturn(Dart_NativeArguments arguments) {
- Dart_SetReturnValue(arguments, Dart_Null());
-}
-
-
-static void SetInvalidArgumentReturn(Dart_NativeArguments arguments) {
- Dart_SetIntegerReturnValue(
- arguments, static_cast<int64_t>(MOJO_RESULT_INVALID_ARGUMENT));
-}
-
-
-#define CHECK_INTEGER_ARGUMENT(args, num, result, failure) \
- { \
- Dart_Handle __status; \
- __status = Dart_GetNativeIntegerArgument(args, num, result); \
- if (Dart_IsError(__status)) { \
- Set##failure##Return(arguments); \
- return; \
- } \
- } \
-
-
-extern "C" {
- extern size_t MojoSetSystemThunks(const MojoSystemThunks* system_thunks);
-}
-
-
-static void MojoSystemThunks_Set(Dart_NativeArguments arguments) {
- int64_t thunks_addr = 0;
- CHECK_INTEGER_ARGUMENT(arguments, 0, &thunks_addr, Null);
-
- MojoSystemThunks* thunks = reinterpret_cast<MojoSystemThunks*>(thunks_addr);
- MojoSetSystemThunks(thunks);
-
- Dart_SetReturnValue(arguments, Dart_Null());
-}
-
-
-static void MojoHandle_Close(Dart_NativeArguments arguments) {
- int64_t handle;
- CHECK_INTEGER_ARGUMENT(arguments, 0, &handle, InvalidArgument);
-
- MojoResult res = MojoClose(static_cast<MojoHandle>(handle));
-
- Dart_SetIntegerReturnValue(arguments, static_cast<int64_t>(res));
-}
-
-
-static void MojoHandle_Wait(Dart_NativeArguments arguments) {
- int64_t handle = 0;
- int64_t signals = 0;
- int64_t deadline = 0;
- CHECK_INTEGER_ARGUMENT(arguments, 0, &handle, InvalidArgument);
- CHECK_INTEGER_ARGUMENT(arguments, 1, &signals, InvalidArgument);
- CHECK_INTEGER_ARGUMENT(arguments, 2, &deadline, InvalidArgument);
-
- MojoResult r = MojoWait(static_cast<MojoHandle>(handle),
- static_cast<MojoHandleSignals>(signals),
- static_cast<MojoDeadline>(deadline));
-
- Dart_SetIntegerReturnValue(arguments, static_cast<int64_t>(r));
-}
-
-
-static void MojoHandle_WaitMany(Dart_NativeArguments arguments) {
- int64_t num_handles = 0;
- int64_t deadline = 0;
- Dart_Handle handles = Dart_GetNativeArgument(arguments, 0);
- Dart_Handle signals = Dart_GetNativeArgument(arguments, 1);
- CHECK_INTEGER_ARGUMENT(arguments, 2, &num_handles, InvalidArgument);
- CHECK_INTEGER_ARGUMENT(arguments, 3, &deadline, InvalidArgument);
-
- if (!Dart_IsList(handles) || !Dart_IsList(signals)) {
- SetInvalidArgumentReturn(arguments);
- return;
- }
-
- intptr_t handles_len = 0;
- intptr_t signals_len = 0;
- Dart_ListLength(handles, &handles_len);
- Dart_ListLength(signals, &signals_len);
- if ((handles_len != num_handles) || (signals_len != num_handles)) {
- SetInvalidArgumentReturn(arguments);
- return;
- }
-
- scoped_ptr<MojoHandle[]> mojo_handles(new MojoHandle[num_handles]);
- scoped_ptr<MojoHandleSignals[]> mojo_signals(
- new MojoHandleSignals[num_handles]);
-
- for (int i = 0; i < num_handles; i++) {
- Dart_Handle dart_handle = Dart_ListGetAt(handles, i);
- Dart_Handle dart_signal = Dart_ListGetAt(signals, i);
- if (!Dart_IsInteger(dart_handle) || !Dart_IsInteger(dart_signal)) {
- SetInvalidArgumentReturn(arguments);
- return;
- }
- int64_t mojo_handle = 0;
- int64_t mojo_signal = 0;
- Dart_IntegerToInt64(dart_handle, &mojo_handle);
- Dart_IntegerToInt64(dart_signal, &mojo_signal);
- mojo_handles[i] = static_cast<MojoHandle>(mojo_handle);
- mojo_signals[i] = static_cast<MojoHandleSignals>(mojo_signal);
- }
-
- MojoResult res = MojoWaitMany(mojo_handles.get(), mojo_signals.get(),
- static_cast<uint32_t>(num_handles),
- static_cast<MojoDeadline>(deadline));
- Dart_SetIntegerReturnValue(arguments, static_cast<int64_t>(res));
-}
-
-
-static void MojoSharedBuffer_Create(Dart_NativeArguments arguments) {
- int64_t num_bytes = 0;
- int64_t flags = 0;
- CHECK_INTEGER_ARGUMENT(arguments, 0, &num_bytes, Null);
- CHECK_INTEGER_ARGUMENT(arguments, 1, &flags, Null);
-
- MojoCreateSharedBufferOptions options;
- options.struct_size = sizeof(MojoCreateSharedBufferOptions);
- options.flags = static_cast<MojoCreateSharedBufferOptionsFlags>(flags);
-
- MojoHandle out = MOJO_HANDLE_INVALID;;
- MojoResult res = MojoCreateSharedBuffer(
- &options, static_cast<int32_t>(num_bytes), &out);
-
- Dart_Handle list = Dart_NewList(2);
- Dart_ListSetAt(list, 0, Dart_NewInteger(res));
- Dart_ListSetAt(list, 1, Dart_NewInteger(out));
- Dart_SetReturnValue(arguments, list);
-}
-
-
-static void MojoSharedBuffer_Duplicate(Dart_NativeArguments arguments) {
- int64_t handle = 0;
- int64_t flags = 0;
- CHECK_INTEGER_ARGUMENT(arguments, 0, &handle, Null);
- CHECK_INTEGER_ARGUMENT(arguments, 1, &flags, Null);
-
- MojoDuplicateBufferHandleOptions options;
- options.struct_size = sizeof(MojoDuplicateBufferHandleOptions);
- options.flags = static_cast<MojoDuplicateBufferHandleOptionsFlags>(flags);
-
- MojoHandle out = MOJO_HANDLE_INVALID;;
- MojoResult res = MojoDuplicateBufferHandle(
- static_cast<MojoHandle>(handle), &options, &out);
-
- Dart_Handle list = Dart_NewList(2);
- Dart_ListSetAt(list, 0, Dart_NewInteger(res));
- Dart_ListSetAt(list, 1, Dart_NewInteger(out));
- Dart_SetReturnValue(arguments, list);
-}
-
-
-static void MojoSharedBuffer_Map(Dart_NativeArguments arguments) {
- int64_t handle = 0;
- int64_t offset = 0;
- int64_t num_bytes = 0;
- int64_t flags = 0;
- CHECK_INTEGER_ARGUMENT(arguments, 0, &handle, Null);
- CHECK_INTEGER_ARGUMENT(arguments, 1, &offset, Null);
- CHECK_INTEGER_ARGUMENT(arguments, 2, &num_bytes, Null);
- CHECK_INTEGER_ARGUMENT(arguments, 3, &flags, Null);
-
- void* out;
- MojoResult res = MojoMapBuffer(static_cast<MojoHandle>(handle),
- offset,
- num_bytes,
- &out,
- static_cast<MojoMapBufferFlags>(flags));
-
- Dart_Handle list = Dart_NewList(2);
- Dart_Handle typed_data;
- if (res == MOJO_RESULT_OK) {
- typed_data = Dart_NewExternalTypedData(
- Dart_TypedData_kByteData, out, num_bytes);
- } else {
- typed_data = Dart_Null();
- }
- Dart_ListSetAt(list, 0, Dart_NewInteger(res));
- Dart_ListSetAt(list, 1, typed_data);
- Dart_SetReturnValue(arguments, list);
-}
-
-
-static void MojoSharedBuffer_Unmap(Dart_NativeArguments arguments) {
- Dart_Handle typed_data = Dart_GetNativeArgument(arguments, 0);
- if (!Dart_IsTypedData(typed_data)) {
- SetInvalidArgumentReturn(arguments);
- return;
- }
-
- Dart_TypedData_Type typ;
- void *data;
- intptr_t len;
- Dart_TypedDataAcquireData(typed_data, &typ, &data, &len);
- MojoResult res = MojoUnmapBuffer(data);
- Dart_TypedDataReleaseData(typed_data);
-
- Dart_SetIntegerReturnValue(arguments, static_cast<int64_t>(res));
-}
-
-
-static void MojoDataPipe_Create(Dart_NativeArguments arguments) {
- int64_t element_bytes = 0;
- int64_t capacity_bytes = 0;
- int64_t flags = 0;
- CHECK_INTEGER_ARGUMENT(arguments, 0, &element_bytes, Null);
- CHECK_INTEGER_ARGUMENT(arguments, 1, &capacity_bytes, Null);
- CHECK_INTEGER_ARGUMENT(arguments, 2, &flags, Null);
-
- MojoCreateDataPipeOptions options;
- options.struct_size = sizeof(MojoCreateDataPipeOptions);
- options.flags = static_cast<MojoCreateDataPipeOptionsFlags>(flags);
- options.element_num_bytes = static_cast<uint32_t>(element_bytes);
- options.capacity_num_bytes = static_cast<uint32_t>(capacity_bytes);
-
- MojoHandle producer = MOJO_HANDLE_INVALID;
- MojoHandle consumer = MOJO_HANDLE_INVALID;
- MojoResult res = MojoCreateDataPipe(&options, &producer, &consumer);
-
- Dart_Handle list = Dart_NewList(3);
- Dart_ListSetAt(list, 0, Dart_NewInteger(res));
- Dart_ListSetAt(list, 1, Dart_NewInteger(producer));
- Dart_ListSetAt(list, 2, Dart_NewInteger(consumer));
- Dart_SetReturnValue(arguments, list);
-}
-
-
-static void MojoDataPipe_WriteData(Dart_NativeArguments arguments) {
- int64_t handle = 0;
- CHECK_INTEGER_ARGUMENT(arguments, 0, &handle, Null);
-
- Dart_Handle typed_data = Dart_GetNativeArgument(arguments, 1);
- if (!Dart_IsTypedData(typed_data)) {
- SetNullReturn(arguments);
- return;
- }
-
- int64_t num_bytes = 0;
- CHECK_INTEGER_ARGUMENT(arguments, 2, &num_bytes, Null);
-
- int64_t flags = 0;
- CHECK_INTEGER_ARGUMENT(arguments, 3, &flags, Null);
-
- Dart_TypedData_Type type;
- void* data;
- intptr_t data_length;
- Dart_TypedDataAcquireData(typed_data, &type, &data, &data_length);
- uint32_t length = static_cast<uint32_t>(num_bytes);
- MojoResult res = MojoWriteData(
- static_cast<MojoHandle>(handle),
- data,
- &length,
- static_cast<MojoWriteDataFlags>(flags));
- Dart_TypedDataReleaseData(typed_data);
-
- Dart_Handle list = Dart_NewList(2);
- Dart_ListSetAt(list, 0, Dart_NewInteger(res));
- Dart_ListSetAt(list, 1, Dart_NewInteger(length));
- Dart_SetReturnValue(arguments, list);
-}
-
-
-static void MojoDataPipe_BeginWriteData(Dart_NativeArguments arguments) {
- int64_t handle = 0;
- int64_t buffer_bytes = 0;
- int64_t flags = 0;
- CHECK_INTEGER_ARGUMENT(arguments, 0, &handle, Null);
- CHECK_INTEGER_ARGUMENT(arguments, 1, &buffer_bytes, Null);
- CHECK_INTEGER_ARGUMENT(arguments, 2, &flags, Null);
-
- void* buffer;
- uint32_t size = static_cast<uint32_t>(buffer_bytes);
- MojoResult res = MojoBeginWriteData(
- static_cast<MojoHandle>(handle),
- &buffer,
- &size,
- static_cast<MojoWriteDataFlags>(flags));
-
- Dart_Handle list = Dart_NewList(2);
- Dart_Handle typed_data;
- if (res == MOJO_RESULT_OK) {
- typed_data = Dart_NewExternalTypedData(
- Dart_TypedData_kByteData, buffer, size);
- } else {
- typed_data = Dart_Null();
- }
- Dart_ListSetAt(list, 0, Dart_NewInteger(res));
- Dart_ListSetAt(list, 1, typed_data);
- Dart_SetReturnValue(arguments, list);
-}
-
-
-static void MojoDataPipe_EndWriteData(Dart_NativeArguments arguments) {
- int64_t handle = 0;
- int64_t num_bytes_written = 0;
- CHECK_INTEGER_ARGUMENT(arguments, 0, &handle, InvalidArgument);
- CHECK_INTEGER_ARGUMENT(arguments, 1, &num_bytes_written, InvalidArgument);
-
- MojoResult res = MojoEndWriteData(
- static_cast<MojoHandle>(handle),
- static_cast<uint32_t>(num_bytes_written));
-
- Dart_SetIntegerReturnValue(arguments, static_cast<int64_t>(res));
-}
-
-
-static void MojoDataPipe_ReadData(Dart_NativeArguments arguments) {
- int64_t handle = 0;
- CHECK_INTEGER_ARGUMENT(arguments, 0, &handle, Null);
-
- Dart_Handle typed_data = Dart_GetNativeArgument(arguments, 1);
- if (!Dart_IsTypedData(typed_data) && !Dart_IsNull(typed_data)) {
- SetNullReturn(arguments);
- return;
- }
-
- int64_t num_bytes = 0;
- CHECK_INTEGER_ARGUMENT(arguments, 2, &num_bytes, Null);
-
- int64_t flags = 0;
- CHECK_INTEGER_ARGUMENT(arguments, 3, &flags, Null);
-
- Dart_TypedData_Type typ;
- void* data = NULL;
- intptr_t bdlen = 0;
- if (!Dart_IsNull(typed_data)) {
- Dart_TypedDataAcquireData(typed_data, &typ, &data, &bdlen);
- }
- uint32_t len = static_cast<uint32_t>(num_bytes);
- MojoResult res = MojoReadData(
- static_cast<MojoHandle>(handle),
- data,
- &len,
- static_cast<MojoReadDataFlags>(flags));
- if (!Dart_IsNull(typed_data)) {
- Dart_TypedDataReleaseData(typed_data);
- }
-
- Dart_Handle list = Dart_NewList(2);
- Dart_ListSetAt(list, 0, Dart_NewInteger(res));
- Dart_ListSetAt(list, 1, Dart_NewInteger(len));
- Dart_SetReturnValue(arguments, list);
-}
-
-
-static void MojoDataPipe_BeginReadData(Dart_NativeArguments arguments) {
- int64_t handle = 0;
- int64_t buffer_bytes = 0;
- int64_t flags = 0;
- CHECK_INTEGER_ARGUMENT(arguments, 0, &handle, Null);
- CHECK_INTEGER_ARGUMENT(arguments, 1, &buffer_bytes, Null);
- CHECK_INTEGER_ARGUMENT(arguments, 2, &flags, Null);
-
- void* buffer;
- uint32_t size = static_cast<uint32_t>(buffer_bytes);
- MojoResult res = MojoBeginReadData(
- static_cast<MojoHandle>(handle),
- const_cast<const void**>(&buffer),
- &size,
- static_cast<MojoWriteDataFlags>(flags));
-
- Dart_Handle list = Dart_NewList(2);
- Dart_Handle typed_data;
- if (res == MOJO_RESULT_OK) {
- typed_data = Dart_NewExternalTypedData(
- Dart_TypedData_kByteData, buffer, size);
- } else {
- typed_data = Dart_Null();
- }
- Dart_ListSetAt(list, 0, Dart_NewInteger(res));
- Dart_ListSetAt(list, 1, typed_data);
- Dart_SetReturnValue(arguments, list);
-}
-
-
-static void MojoDataPipe_EndReadData(Dart_NativeArguments arguments) {
- int64_t handle = 0;
- int64_t num_bytes_read = 0;
- CHECK_INTEGER_ARGUMENT(arguments, 0, &handle, InvalidArgument);
- CHECK_INTEGER_ARGUMENT(arguments, 1, &num_bytes_read, InvalidArgument);
-
- MojoResult res = MojoEndReadData(
- static_cast<MojoHandle>(handle),
- static_cast<uint32_t>(num_bytes_read));
-
- Dart_SetIntegerReturnValue(arguments, static_cast<int64_t>(res));
-}
-
-
-static void MojoMessagePipe_Create(Dart_NativeArguments arguments) {
- int64_t flags = 0;
- CHECK_INTEGER_ARGUMENT(arguments, 0, &flags, Null);
-
- MojoCreateMessagePipeOptions options;
- options.struct_size = sizeof(MojoCreateMessagePipeOptions);
- options.flags = static_cast<MojoCreateMessagePipeOptionsFlags>(flags);
-
- MojoHandle end1 = MOJO_HANDLE_INVALID;
- MojoHandle end2 = MOJO_HANDLE_INVALID;
- MojoResult res = MojoCreateMessagePipe(&options, &end1, &end2);
-
- Dart_Handle list = Dart_NewList(3);
- Dart_ListSetAt(list, 0, Dart_NewInteger(res));
- Dart_ListSetAt(list, 1, Dart_NewInteger(end1));
- Dart_ListSetAt(list, 2, Dart_NewInteger(end2));
- Dart_SetReturnValue(arguments, list);
-}
-
-
-static void MojoMessagePipe_Write(Dart_NativeArguments arguments) {
- int64_t handle = 0;
- CHECK_INTEGER_ARGUMENT(arguments, 0, &handle, InvalidArgument);
-
- Dart_Handle typed_data = Dart_GetNativeArgument(arguments, 1);
- if (!Dart_IsTypedData(typed_data) && !Dart_IsNull(typed_data)) {
- SetInvalidArgumentReturn(arguments);
- return;
- }
-
- int64_t num_bytes = 0;
- CHECK_INTEGER_ARGUMENT(arguments, 2, &num_bytes, InvalidArgument);
-
- Dart_Handle handles = Dart_GetNativeArgument(arguments, 3);
- if (!Dart_IsList(handles) && !Dart_IsNull(handles)) {
- SetInvalidArgumentReturn(arguments);
- return;
- }
-
- int64_t flags = 0;
- CHECK_INTEGER_ARGUMENT(arguments, 4, &flags, InvalidArgument);
-
- // Grab the data if there is any.
- Dart_TypedData_Type typ;
- void* bytes = NULL;
- intptr_t bdlen = 0;
- if (!Dart_IsNull(typed_data)) {
- Dart_TypedDataAcquireData(typed_data, &typ, &bytes, &bdlen);
- }
-
- // Grab the handles if there are any.
- scoped_ptr<MojoHandle[]> mojo_handles;
- intptr_t handles_len = 0;
- if (!Dart_IsNull(handles)) {
- Dart_ListLength(handles, &handles_len);
- mojo_handles.reset(new MojoHandle[handles_len]);
- for (int i = 0; i < handles_len; i++) {
- Dart_Handle dart_handle = Dart_ListGetAt(handles, i);
- if (!Dart_IsInteger(dart_handle)) {
- SetInvalidArgumentReturn(arguments);
- return;
- }
- int64_t mojo_handle = 0;
- Dart_IntegerToInt64(dart_handle, &mojo_handle);
- mojo_handles[i] = static_cast<MojoHandle>(mojo_handle);
- }
- }
-
- MojoResult res = MojoWriteMessage(
- static_cast<MojoHandle>(handle),
- const_cast<const void*>(bytes),
- static_cast<uint32_t>(num_bytes),
- mojo_handles.get(),
- static_cast<uint32_t>(handles_len),
- static_cast<MojoWriteMessageFlags>(flags));
-
- // Release the data.
- if (!Dart_IsNull(typed_data)) {
- Dart_TypedDataReleaseData(typed_data);
- }
-
- Dart_SetIntegerReturnValue(arguments, static_cast<int64_t>(res));
-}
-
-
-static void MojoMessagePipe_Read(Dart_NativeArguments arguments) {
- int64_t handle = 0;
- CHECK_INTEGER_ARGUMENT(arguments, 0, &handle, Null);
-
- Dart_Handle typed_data = Dart_GetNativeArgument(arguments, 1);
- if (!Dart_IsTypedData(typed_data) && !Dart_IsNull(typed_data)) {
- SetNullReturn(arguments);
- return;
- }
-
- int64_t num_bytes = 0;
- CHECK_INTEGER_ARGUMENT(arguments, 2, &num_bytes, Null);
-
- Dart_Handle handles = Dart_GetNativeArgument(arguments, 3);
- if (!Dart_IsList(handles) && !Dart_IsNull(handles)) {
- SetNullReturn(arguments);
- return;
- }
-
- int64_t flags = 0;
- CHECK_INTEGER_ARGUMENT(arguments, 4, &flags, Null);
-
- // Grab the data if there is any.
- Dart_TypedData_Type typ;
- void* bytes = NULL;
- intptr_t byte_data_len = 0;
- if (!Dart_IsNull(typed_data)) {
- Dart_TypedDataAcquireData(typed_data, &typ, &bytes, &byte_data_len);
- }
- uint32_t blen = static_cast<uint32_t>(num_bytes);
-
- // Grab the handles if there are any.
- scoped_ptr<MojoHandle[]> mojo_handles;
- intptr_t handles_len = 0;
- if (!Dart_IsNull(handles)) {
- Dart_ListLength(handles, &handles_len);
- mojo_handles.reset(new MojoHandle[handles_len]);
- }
- uint32_t hlen = static_cast<uint32_t>(handles_len);
-
- MojoResult res = MojoReadMessage(
- static_cast<MojoHandle>(handle),
- bytes,
- &blen,
- mojo_handles.get(),
- &hlen,
- static_cast<MojoReadMessageFlags>(flags));
-
- // Release the data.
- if (!Dart_IsNull(typed_data)) {
- Dart_TypedDataReleaseData(typed_data);
- }
-
- if (!Dart_IsNull(handles)) {
- for (int i = 0; i < handles_len; i++) {
- Dart_ListSetAt(handles, i, Dart_NewInteger(mojo_handles[i]));
- }
- }
-
- Dart_Handle list = Dart_NewList(3);
- Dart_ListSetAt(list, 0, Dart_NewInteger(res));
- Dart_ListSetAt(list, 1, Dart_NewInteger(blen));
- Dart_ListSetAt(list, 2, Dart_NewInteger(hlen));
- Dart_SetReturnValue(arguments, list);
-}
-
-
-#define SCOPE_FUNCTIONS(V) \
- V(MojoSharedBuffer_Create) \
- V(MojoSharedBuffer_Duplicate) \
- V(MojoSharedBuffer_Map) \
- V(MojoSharedBuffer_Unmap) \
- V(MojoDataPipe_Create) \
- V(MojoDataPipe_WriteData) \
- V(MojoDataPipe_BeginWriteData) \
- V(MojoDataPipe_ReadData) \
- V(MojoDataPipe_BeginReadData) \
- V(MojoDataPipe_EndReadData) \
- V(MojoMessagePipe_Create) \
- V(MojoMessagePipe_Write) \
- V(MojoMessagePipe_Read) \
-
-#define NOSCOPE_FUNCTIONS(V) \
- V(MojoSystemThunks_Set) \
- V(MojoHandle_Close) \
- V(MojoHandle_Wait) \
- V(MojoHandle_WaitMany) \
- V(MojoDataPipe_EndWriteData) \
-
-#define FUNCTION_STRING_MAP(name) {#name, name},
-
-struct FunctionLookup {
- const char* name;
- Dart_NativeFunction function;
-};
-
-FunctionLookup function_list[] = {
- SCOPE_FUNCTIONS(FUNCTION_STRING_MAP)
- {NULL, NULL}
-};
-
-FunctionLookup no_scope_function_list[] = {
- NOSCOPE_FUNCTIONS(FUNCTION_STRING_MAP)
- {NULL, NULL}
-};
-
-#undef FUNCTION_STRING_MAP
-
-
-Dart_NativeFunction ResolveName(Dart_Handle name,
- int argc,
- bool* auto_setup_scope) {
- if (!Dart_IsString(name)) {
- return NULL;
- }
- Dart_NativeFunction result = NULL;
- if (auto_setup_scope == NULL) {
- return NULL;
- }
-
- Dart_EnterScope();
- const char* cname;
- HandleError(Dart_StringToCString(name, &cname));
-
- for (int i=0; function_list[i].name != NULL; ++i) {
- if (strcmp(function_list[i].name, cname) == 0) {
- *auto_setup_scope = true;
- Dart_ExitScope();
- return function_list[i].function;
- }
- }
-
- for (int i=0; no_scope_function_list[i].name != NULL; ++i) {
- if (strcmp(no_scope_function_list[i].name, cname) == 0) {
- *auto_setup_scope = false;
- result = no_scope_function_list[i].function;
- break;
- }
- }
-
- Dart_ExitScope();
- return result;
-}
diff --git a/mojo/public/dart/src/types.dart b/mojo/public/dart/src/types.dart
deleted file mode 100644
index 658e477..0000000
--- a/mojo/public/dart/src/types.dart
+++ /dev/null
@@ -1,116 +0,0 @@
-// 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.
-
-
-part of core;
-
-
-class MojoResult {
- static const int kOk = 0;
- static const int kCancelled = -1;
- static const int kUnknown = -2;
- static const int kInvalidArgument = -3;
- static const int kDeadlineExceeded = -4;
- static const int kNotFound = -5;
- static const int kAlreadyExists = -6;
- static const int kPermissionDenied = -7;
- static const int kResourceExhausted = -8;
- static const int kFailedPrecondition = -9;
- static const int kAborted = -10;
- static const int kOutOfRange = -11;
- static const int kUnimplemented = -12;
- static const int kInternal = -13;
- static const int kUnavailable = -14;
- static const int kDataLoss = -15;
- static const int kBusy = -16;
- static const int kShouldWait = -17;
-
- static const OK = const MojoResult._(kOk);
- static const CANCELLED = const MojoResult._(kCancelled);
- static const UNKNOWN = const MojoResult._(kUnknown);
- static const INVALID_ARGUMENT = const MojoResult._(kInvalidArgument);
- static const DEADLINE_EXCEEDED = const MojoResult._(kDeadlineExceeded);
- static const NOT_FOUND = const MojoResult._(kNotFound);
- static const ALREADY_EXISTS = const MojoResult._(kAlreadyExists);
- static const PERMISSION_DENIED = const MojoResult._(kPermissionDenied);
- static const RESOURCE_EXHAUSTED = const MojoResult._(kResourceExhausted);
- static const FAILED_PRECONDITION = const MojoResult._(kFailedPrecondition);
- static const ABORTED = const MojoResult._(kAborted);
- static const OUT_OF_RANGE = const MojoResult._(kOutOfRange);
- static const UNIMPLEMENTED = const MojoResult._(kUnimplemented);
- static const INTERNAL = const MojoResult._(kInternal);
- static const UNAVAILABLE = const MojoResult._(kUnavailable);
- static const DATA_LOSS = const MojoResult._(kDataLoss);
- static const BUSY = const MojoResult._(kBusy);
- static const SHOULD_WAIT = const MojoResult._(kShouldWait);
-
- final int value;
-
- const MojoResult._(this.value);
-
- factory MojoResult(int value) {
- switch (value) {
- case kOk: return OK;
- case kCancelled: return CANCELLED;
- case kUnknown: return UNKNOWN;
- case kInvalidArgument: return INVALID_ARGUMENT;
- case kDeadlineExceeded: return DEADLINE_EXCEEDED;
- case kNotFound: return NOT_FOUND;
- case kAlreadyExists: return ALREADY_EXISTS;
- case kPermissionDenied: return PERMISSION_DENIED;
- case kResourceExhausted: return RESOURCE_EXHAUSTED;
- case kFailedPrecondition: return FAILED_PRECONDITION;
- case kAborted: return ABORTED;
- case kOutOfRange: return OUT_OF_RANGE;
- case kUnimplemented: return UNIMPLEMENTED;
- case kInternal: return INTERNAL;
- case kUnavailable: return UNAVAILABLE;
- case kDataLoss: return DATA_LOSS;
- case kBusy: return BUSY;
- case kShouldWait: return SHOULD_WAIT;
- default: return null;
- }
- }
-
- bool get isOk => (this == OK);
- bool get isCancelled => (this == CANCELLED);
- bool get isUnknown => (this == UNKNOWN);
- bool get isInvalidArgument => (this == INVALID_ARGUMENT);
- bool get isDeadlineExceeded => (this == DEADLINE_EXCEEDED);
- bool get isNotFound => (this == NOT_FOUND);
- bool get isAlreadExists => (this == ALREADY_EXISTS);
- bool get isPermissionDenied => (this == PERMISSION_DENIED);
- bool get isResourceExhausted => (this == RESOURCE_EXHAUSTED);
- bool get isFailedPrecondition => (this == FAILED_PRECONDITION);
- bool get isAborted => (this == ABORTED);
- bool get isOutOfRange => (this == OUT_OF_RANGE);
- bool get isUnimplemented => (this == UNIMPLEMENTED);
- bool get isInternal => (this == INTERNAL);
- bool get isUnavailable => (this == UNAVAILABLE);
- bool get isDataLoss => (this == DATA_LOSS);
- bool get isBusy => (this == BUSY);
- bool get isShouldWait => (this == SHOULD_WAIT);
-}
-
-
-class MojoHandleSignals {
- static const int NONE = 0;
- static const int READABLE = 1 << 0;
- static const int WRITABLE = 1 << 1;
- static const int READWRITE = READABLE | WRITABLE;
-
- static bool isReadable(int mask) => (mask & READABLE) == READABLE;
- static bool isWritable(int mask) => (mask & WRITABLE) == WRITABLE;
- static bool isReadWrite(int mask) => (mask & READWRITE) == READWRITE;
- static int toggleWrite(int mask) =>
- isWritable(mask) ? (mask & ~WRITABLE) : (mask | WRITABLE);
-}
-
-
-class MojoHandleSignalsState {
- const MojoHandleSignalsState(this.satisfied_signals,
- this.satisfiable_signals);
- final int satisfied_signals;
- final int satisfiable_signals;
-}
diff --git a/mojo/public/go/system/impl/mojo_types.go b/mojo/public/go/system/impl/mojo_types.go
index 01d518e..9156a45 100644
--- a/mojo/public/go/system/impl/mojo_types.go
+++ b/mojo/public/go/system/impl/mojo_types.go
@@ -66,7 +66,6 @@ const (
MOJO_READ_DATA_FLAG_ALL_OR_NONE = 1 << 0
MOJO_READ_DATA_FLAG_DISCARD = 1 << 1
MOJO_READ_DATA_FLAG_QUERY = 1 << 2
- MOJO_READ_DATA_FLAG_PEEK = 1 << 3
MOJO_WRITE_DATA_FLAG_NONE MojoWriteDataFlags = 0
MOJO_WRITE_DATA_FLAG_ALL_OR_NONE MojoWriteDataFlags = 1 << 0
diff --git a/mojo/public/java/bindings/src/org/chromium/mojo/bindings/Decoder.java b/mojo/public/java/bindings/src/org/chromium/mojo/bindings/Decoder.java
index b95b6dd..80ed9d1 100644
--- a/mojo/public/java/bindings/src/org/chromium/mojo/bindings/Decoder.java
+++ b/mojo/public/java/bindings/src/org/chromium/mojo/bindings/Decoder.java
@@ -108,7 +108,7 @@ public class Decoder {
private Decoder(Message message, Validator validator, int baseOffset) {
mMessage = message;
- mMessage.getData().order(ByteOrder.LITTLE_ENDIAN);
+ mMessage.getData().order(ByteOrder.nativeOrder());
mBaseOffset = baseOffset;
mValidator = validator;
}
@@ -615,8 +615,8 @@ public class Decoder {
}
if (expectedLength != BindingsHelper.UNSPECIFIED_ARRAY_LENGTH
&& dataHeader.numFields != expectedLength) {
- throw new DeserializationException("Incorrect array length. Expected: "
- + expectedLength + ", but got: " + dataHeader.numFields + ".");
+ throw new DeserializationException("Incorrect array length. Expected: " +
+ expectedLength + ", but got: " + dataHeader.numFields + ".");
}
return dataHeader;
}
@@ -631,8 +631,8 @@ public class Decoder {
}
if (expectedLength != BindingsHelper.UNSPECIFIED_ARRAY_LENGTH
&& dataHeader.numFields != expectedLength) {
- throw new DeserializationException("Incorrect array length. Expected: "
- + expectedLength + ", but got: " + dataHeader.numFields + ".");
+ throw new DeserializationException("Incorrect array length. Expected: " +
+ expectedLength + ", but got: " + dataHeader.numFields + ".");
}
return dataHeader;
}
diff --git a/mojo/public/java/bindings/src/org/chromium/mojo/bindings/Encoder.java b/mojo/public/java/bindings/src/org/chromium/mojo/bindings/Encoder.java
index 75cddc9..ef04f6d 100644
--- a/mojo/public/java/bindings/src/org/chromium/mojo/bindings/Encoder.java
+++ b/mojo/public/java/bindings/src/org/chromium/mojo/bindings/Encoder.java
@@ -59,7 +59,7 @@ public class Encoder {
this.core = core;
byteBuffer = ByteBuffer.allocateDirect(
bufferSize > 0 ? bufferSize : INITIAL_BUFFER_SIZE);
- byteBuffer.order(ByteOrder.LITTLE_ENDIAN);
+ byteBuffer.order(ByteOrder.nativeOrder());
dataEnd = 0;
}
@@ -226,8 +226,8 @@ public class Encoder {
encodeNullPointer(offset, nullable);
return;
}
- final int arrayNullability = nullable
- ? BindingsHelper.ARRAY_NULLABLE : BindingsHelper.NOTHING_NULLABLE;
+ final int arrayNullability = nullable ?
+ BindingsHelper.ARRAY_NULLABLE : BindingsHelper.NOTHING_NULLABLE;
encode(v.getBytes(Charset.forName("utf8")), offset, arrayNullability,
BindingsHelper.UNSPECIFIED_ARRAY_LENGTH);
}
@@ -303,8 +303,8 @@ public class Encoder {
encodeNullPointer(offset, BindingsHelper.isArrayNullable(arrayNullability));
return;
}
- if (expectedLength != BindingsHelper.UNSPECIFIED_ARRAY_LENGTH
- && expectedLength != v.length) {
+ if (expectedLength != BindingsHelper.UNSPECIFIED_ARRAY_LENGTH &&
+ expectedLength != v.length) {
throw new SerializationException("Trying to encode a fixed array of incorrect length.");
}
byte[] bytes = new byte[(v.length + 7) / BindingsHelper.ALIGNMENT];
@@ -327,8 +327,8 @@ public class Encoder {
encodeNullPointer(offset, BindingsHelper.isArrayNullable(arrayNullability));
return;
}
- if (expectedLength != BindingsHelper.UNSPECIFIED_ARRAY_LENGTH
- && expectedLength != v.length) {
+ if (expectedLength != BindingsHelper.UNSPECIFIED_ARRAY_LENGTH &&
+ expectedLength != v.length) {
throw new SerializationException("Trying to encode a fixed array of incorrect length.");
}
encodeByteArray(v, v.length, offset);
@@ -473,8 +473,8 @@ public class Encoder {
private Encoder encoderForArray(
int elementSizeInByte, int length, int offset, int expectedLength) {
- if (expectedLength != BindingsHelper.UNSPECIFIED_ARRAY_LENGTH
- && expectedLength != length) {
+ if (expectedLength != BindingsHelper.UNSPECIFIED_ARRAY_LENGTH &&
+ expectedLength != length) {
throw new SerializationException("Trying to encode a fixed array of incorrect length.");
}
return encoderForArrayByTotalSize(length * elementSizeInByte, length, offset);
diff --git a/mojo/public/java/bindings/src/org/chromium/mojo/bindings/ServiceMessage.java b/mojo/public/java/bindings/src/org/chromium/mojo/bindings/ServiceMessage.java
index 313dc6a..ac62bf6 100644
--- a/mojo/public/java/bindings/src/org/chromium/mojo/bindings/ServiceMessage.java
+++ b/mojo/public/java/bindings/src/org/chromium/mojo/bindings/ServiceMessage.java
@@ -57,7 +57,7 @@ public class ServiceMessage extends Message {
if (mPayload == null) {
ByteBuffer truncatedBuffer =
((ByteBuffer) getData().position(getHeader().getSize())).slice();
- truncatedBuffer.order(ByteOrder.LITTLE_ENDIAN);
+ truncatedBuffer.order(ByteOrder.nativeOrder());
mPayload = new Message(truncatedBuffer, getHandles());
}
return mPayload;
diff --git a/mojo/public/java/system/src/org/chromium/mojo/system/DataPipe.java b/mojo/public/java/system/src/org/chromium/mojo/system/DataPipe.java
index a5b77ae..4cd74e1 100644
--- a/mojo/public/java/system/src/org/chromium/mojo/system/DataPipe.java
+++ b/mojo/public/java/system/src/org/chromium/mojo/system/DataPipe.java
@@ -161,7 +161,6 @@ public interface DataPipe {
private static final int FLAG_NONE = 0;
private static final int FLAG_ALL_OR_NONE = 1 << 0;
private static final int FLAG_QUERY = 1 << 2;
- private static final int FLAG_PEEK = 1 << 3;
/**
* Immutable flag with not bit set.
@@ -190,7 +189,7 @@ public interface DataPipe {
/**
* Change the query bit of this flag. If set query the number of elements available to read.
- * Mutually exclusive with |discard| and |allOrNone| is ignored if this flag is set.
+ * Mutually exclusive with |dicard| and |allOrNone| is ignored if this flag is set.
*
* @param query the new value of the query bit.
* @return this.
@@ -200,18 +199,6 @@ public interface DataPipe {
}
/**
- * Change the peek bit of this flag. If set, read the requested number of elements, and
- * leave those elements in the pipe. A later read will return the same data.
- * Mutually exclusive with |discard| and |query|.
- *
- * @param peek the new value of the peek bit.
- * @return this.
- */
- public ReadFlags peek(boolean peek) {
- return setFlag(FLAG_PEEK, peek);
- }
-
- /**
* @return a flag with no bit set.
*/
public static ReadFlags none() {
diff --git a/mojo/public/js/core.js b/mojo/public/js/core.js
index 9dcb20f..8727833 100644
--- a/mojo/public/js/core.js
+++ b/mojo/public/js/core.js
@@ -111,7 +111,6 @@ var READ_DATA_FLAG_NONE;
var READ_DATA_FLAG_ALL_OR_NONE;
var READ_DATA_FLAG_DISCARD;
var READ_DATA_FLAG_QUERY;
-var READ_DATA_FLAG_PEEK;
/**
* Closes the given |handle|. See MojoClose for more info.
diff --git a/mojo/public/js/core_unittests.js b/mojo/public/js/core_unittests.js
index eaeaa4f..34cd4c0 100644
--- a/mojo/public/js/core_unittests.js
+++ b/mojo/public/js/core_unittests.js
@@ -15,6 +15,7 @@ define([
runWithDataPipe(testReadAndWriteDataPipe);
runWithDataPipeWithOptions(testNop);
runWithDataPipeWithOptions(testReadAndWriteDataPipe);
+ testHandleToString();
gc.collectGarbage(); // should not crash
this.result = "PASS";
@@ -104,16 +105,6 @@ define([
expect(write.result).toBe(core.RESULT_OK);
expect(write.numBytes).toBe(42);
- var peeked = core.readData(
- pipe.consumerHandle,
- core.READ_DATA_FLAG_PEEK | core.READ_DATA_FLAG_ALL_OR_NONE);
- expect(peeked.result).toBe(core.RESULT_OK);
- expect(peeked.buffer.byteLength).toBe(42);
-
- var peeked_memory = new Uint8Array(peeked.buffer);
- for (var i = 0; i < peeked_memory.length; ++i)
- expect(peeked_memory[i]).toBe((i * i) & 0xFF);
-
var read = core.readData(
pipe.consumerHandle, core.READ_DATA_FLAG_ALL_OR_NONE);
@@ -125,4 +116,18 @@ define([
expect(memory[i]).toBe((i * i) & 0xFF);
}
+ function testHandleToString() {
+ var pipe = core.createDataPipe();
+ expect(pipe.consumerHandle.toString).toBeDefined();
+
+ var openHandleRE = /^\[mojo\:\:Handle \d+\]$/ // e.g. "[mojo::Handle 123]"
+ var openHandleString = pipe.consumerHandle.toString();
+ expect(openHandleString.match(openHandleRE)[0]).toEqual(openHandleString);
+
+ expect(core.close(pipe.producerHandle)).toBe(core.RESULT_OK);
+ expect(core.close(pipe.consumerHandle)).toBe(core.RESULT_OK);
+
+ expect(pipe.consumerHandle.toString()).toEqual("[mojo::Handle null]");
+ }
+
});
diff --git a/mojo/public/js/threading.js b/mojo/public/js/threading.js
deleted file mode 100644
index cfe5037..0000000
--- a/mojo/public/js/threading.js
+++ /dev/null
@@ -1,21 +0,0 @@
-// 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.
-
-// Module "mojo/public/js/threading"
-//
-// Note: This file is for documentation purposes only. The code here is not
-// actually executed. The real module is implemented natively in Mojo.
-//
-// This module provides a way for a Mojo application implemented in JS
-// to exit by quitting the current message loop. This module is not
-// intended to be used by Mojo JS application started by the JS
-// content handler.
-
-while (1);
-
-/**
- * Quits the current message loop, esssentially:
- * base::MessageLoop::current()->QuitNow();
-*/
-function quit() { [native code] }
diff --git a/mojo/public/mojo_public.gyp b/mojo/public/mojo_public.gyp
index 1e62097..46f22f7 100644
--- a/mojo/public/mojo_public.gyp
+++ b/mojo/public/mojo_public.gyp
@@ -70,7 +70,6 @@
],
'sources': [
'cpp/bindings/array.h',
- 'cpp/bindings/binding.h',
'cpp/bindings/callback.h',
'cpp/bindings/error_handler.h',
'cpp/bindings/interface_impl.h',
@@ -80,7 +79,6 @@
'cpp/bindings/message_filter.h',
'cpp/bindings/no_interface.h',
'cpp/bindings/string.h',
- 'cpp/bindings/strong_binding.h',
'cpp/bindings/type_converter.h',
'cpp/bindings/lib/array_internal.h',
'cpp/bindings/lib/array_internal.cc',
@@ -98,6 +96,7 @@
'cpp/bindings/lib/filter_chain.h',
'cpp/bindings/lib/fixed_buffer.cc',
'cpp/bindings/lib/fixed_buffer.h',
+ 'cpp/bindings/lib/interface_impl_internal.h',
'cpp/bindings/lib/interface_ptr_internal.h',
'cpp/bindings/lib/map_data_internal.h',
'cpp/bindings/lib/map_internal.h',
@@ -124,7 +123,7 @@
],
},
{
- # GN version: //mojo/public/js
+ # GN version: //mojo/public/js/bindings
'target_name': 'mojo_js_bindings',
'type': 'static_library',
'include_dirs': [
@@ -189,23 +188,16 @@
],
},
{
- 'target_name': 'mojo_application_bindings_mojom',
- 'type': 'none',
- 'variables': {
- 'mojom_files': [
- 'interfaces/application/application.mojom',
- 'interfaces/application/service_provider.mojom',
- 'interfaces/application/shell.mojom',
- ],
- },
- 'includes': [ 'tools/bindings/mojom_bindings_generator_explicit.gypi' ],
- },
- {
# GN version: //mojo/public/interfaces/application:application
'target_name': 'mojo_application_bindings',
'type': 'static_library',
+ 'sources': [
+ 'interfaces/application/application.mojom',
+ 'interfaces/application/service_provider.mojom',
+ 'interfaces/application/shell.mojom',
+ ],
+ 'includes': [ 'tools/bindings/mojom_bindings_generator.gypi' ],
'dependencies': [
- 'mojo_application_bindings_mojom',
'mojo_cpp_bindings',
],
'export_dependent_settings': [
@@ -321,35 +313,28 @@
],
},
{
- 'target_name': 'mojo_public_test_interfaces_mojom',
- 'type': 'none',
- 'variables': {
- 'mojom_files': [
- 'interfaces/bindings/tests/math_calculator.mojom',
- 'interfaces/bindings/tests/no_module.mojom',
- 'interfaces/bindings/tests/rect.mojom',
- 'interfaces/bindings/tests/regression_tests.mojom',
- 'interfaces/bindings/tests/sample_factory.mojom',
- 'interfaces/bindings/tests/sample_import.mojom',
- 'interfaces/bindings/tests/sample_import2.mojom',
- 'interfaces/bindings/tests/sample_interfaces.mojom',
- 'interfaces/bindings/tests/sample_service.mojom',
- 'interfaces/bindings/tests/serialization_test_structs.mojom',
- 'interfaces/bindings/tests/test_structs.mojom',
- 'interfaces/bindings/tests/validation_test_interfaces.mojom',
- ],
- },
- 'includes': [ 'tools/bindings/mojom_bindings_generator_explicit.gypi' ],
- },
- {
# GN version: //mojo/public/interfaces/bindings/tests:test_interfaces
'target_name': 'mojo_public_test_interfaces',
'type': 'static_library',
+ 'sources': [
+ 'interfaces/bindings/tests/math_calculator.mojom',
+ 'interfaces/bindings/tests/no_module.mojom',
+ 'interfaces/bindings/tests/rect.mojom',
+ 'interfaces/bindings/tests/regression_tests.mojom',
+ 'interfaces/bindings/tests/sample_factory.mojom',
+ 'interfaces/bindings/tests/sample_import.mojom',
+ 'interfaces/bindings/tests/sample_import2.mojom',
+ 'interfaces/bindings/tests/sample_interfaces.mojom',
+ 'interfaces/bindings/tests/sample_service.mojom',
+ 'interfaces/bindings/tests/serialization_test_structs.mojom',
+ 'interfaces/bindings/tests/test_structs.mojom',
+ 'interfaces/bindings/tests/validation_test_interfaces.mojom',
+ ],
+ 'includes': [ 'tools/bindings/mojom_bindings_generator.gypi' ],
'export_dependent_settings': [
'mojo_cpp_bindings',
],
'dependencies': [
- 'mojo_public_test_interfaces_mojom',
'mojo_cpp_bindings',
],
},
diff --git a/mojo/public/python/mojo/bindings/descriptor.py b/mojo/public/python/mojo/bindings/descriptor.py
index f190d2b..f566d47 100644
--- a/mojo/public/python/mojo/bindings/descriptor.py
+++ b/mojo/public/python/mojo/bindings/descriptor.py
@@ -41,7 +41,7 @@ class SerializableType(Type):
def __init__(self, typecode):
Type.__init__(self)
self.typecode = typecode
- self.byte_size = struct.calcsize('<%s' % self.GetTypeCode())
+ self.byte_size = struct.calcsize('=%s' % self.GetTypeCode())
def GetTypeCode(self):
"""
diff --git a/mojo/public/python/mojo/bindings/messaging.py b/mojo/public/python/mojo/bindings/messaging.py
index bba3c01..f9061fb 100644
--- a/mojo/public/python/mojo/bindings/messaging.py
+++ b/mojo/public/python/mojo/bindings/messaging.py
@@ -31,9 +31,9 @@ class MessageHeader(object):
"""The header of a mojo message."""
_SIMPLE_MESSAGE_NUM_FIELDS = 2
- _SIMPLE_MESSAGE_STRUCT = struct.Struct("<IIII")
+ _SIMPLE_MESSAGE_STRUCT = struct.Struct("=IIII")
- _REQUEST_ID_STRUCT = struct.Struct("<Q")
+ _REQUEST_ID_STRUCT = struct.Struct("=Q")
_REQUEST_ID_OFFSET = _SIMPLE_MESSAGE_STRUCT.size
_MESSAGE_WITH_REQUEST_ID_NUM_FIELDS = 3
diff --git a/mojo/public/python/mojo/bindings/serialization.py b/mojo/public/python/mojo/bindings/serialization.py
index 2c0478f..9a4b6a9 100644
--- a/mojo/public/python/mojo/bindings/serialization.py
+++ b/mojo/public/python/mojo/bindings/serialization.py
@@ -8,7 +8,7 @@ import struct
# Format of a header for a struct or an array.
-HEADER_STRUCT = struct.Struct("<II")
+HEADER_STRUCT = struct.Struct("=II")
class SerializationException(Exception):
@@ -110,7 +110,7 @@ def _FilterGroups(groups, version):
def _GetStruct(groups):
index = 0
- codes = [ '<' ]
+ codes = [ '=' ]
for group in groups:
code = group.GetTypeCode()
size = group.GetByteSize()
diff --git a/mojo/public/python/mojo/c_core.pxd b/mojo/public/python/mojo/c_core.pxd
index 1526dfe..80b8487d 100644
--- a/mojo/public/python/mojo/c_core.pxd
+++ b/mojo/public/python/mojo/c_core.pxd
@@ -126,7 +126,6 @@ cdef extern from "mojo/public/c/system/core.h" nogil:
const MojoReadDataFlags MOJO_READ_DATA_FLAG_ALL_OR_NONE
const MojoReadDataFlags MOJO_READ_DATA_FLAG_DISCARD
const MojoReadDataFlags MOJO_READ_DATA_FLAG_QUERY
- const MojoReadDataFlags MOJO_READ_DATA_FLAG_PEEK
MojoResult MojoCreateDataPipe(
const MojoCreateDataPipeOptions* options,
diff --git a/mojo/public/python/mojo/system.pyx b/mojo/public/python/mojo/system.pyx
index 4507d4d..8285261 100644
--- a/mojo/public/python/mojo/system.pyx
+++ b/mojo/public/python/mojo/system.pyx
@@ -62,7 +62,6 @@ READ_DATA_FLAG_NONE = c_core.MOJO_READ_DATA_FLAG_NONE
READ_DATA_FLAG_ALL_OR_NONE = c_core.MOJO_READ_DATA_FLAG_ALL_OR_NONE
READ_DATA_FLAG_DISCARD = c_core.MOJO_READ_DATA_FLAG_DISCARD
READ_DATA_FLAG_QUERY = c_core.MOJO_READ_DATA_FLAG_QUERY
-READ_DATA_FLAG_PEEK = c_core.MOJO_READ_DATA_FLAG_PEEK
MAP_BUFFER_FLAG_NONE = c_core.MOJO_MAP_BUFFER_FLAG_NONE
def GetTimeTicksNow():
diff --git a/mojo/public/tools/bindings/mojom_bindings_generator.gypi b/mojo/public/tools/bindings/mojom_bindings_generator.gypi
index e8843bb..02c2813 100644
--- a/mojo/public/tools/bindings/mojom_bindings_generator.gypi
+++ b/mojo/public/tools/bindings/mojom_bindings_generator.gypi
@@ -3,23 +3,76 @@
# found in the LICENSE file.
{
- 'includes': [
- 'mojom_bindings_generator_variables.gypi',
- ],
'rules': [
{
'rule_name': '<(_target_name)_mojom_bindings_generator',
'extension': 'mojom',
'variables': {
'mojom_base_output_dir':
- '<!(python <(DEPTH)/build/inverse_depth.py <(DEPTH))',
+ '<!(python <(DEPTH)/build/inverse_depth.py <(DEPTH))',
+ 'mojom_bindings_generator':
+ '<(DEPTH)/mojo/public/tools/bindings/mojom_bindings_generator.py',
'java_out_dir': '<(PRODUCT_DIR)/java_mojo/<(_target_name)/src',
'mojom_import_args%': [
'-I<(DEPTH)'
],
},
'inputs': [
- '<@(mojom_bindings_generator_sources)',
+ '<(mojom_bindings_generator)',
+ '<(DEPTH)/mojo/public/tools/bindings/generators/cpp_templates/enum_declaration.tmpl',
+ '<(DEPTH)/mojo/public/tools/bindings/generators/cpp_templates/interface_declaration.tmpl',
+ '<(DEPTH)/mojo/public/tools/bindings/generators/cpp_templates/interface_definition.tmpl',
+ '<(DEPTH)/mojo/public/tools/bindings/generators/cpp_templates/interface_macros.tmpl',
+ '<(DEPTH)/mojo/public/tools/bindings/generators/cpp_templates/interface_proxy_declaration.tmpl',
+ '<(DEPTH)/mojo/public/tools/bindings/generators/cpp_templates/interface_request_validator_declaration.tmpl',
+ '<(DEPTH)/mojo/public/tools/bindings/generators/cpp_templates/interface_response_validator_declaration.tmpl',
+ '<(DEPTH)/mojo/public/tools/bindings/generators/cpp_templates/interface_stub_declaration.tmpl',
+ '<(DEPTH)/mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl',
+ '<(DEPTH)/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl',
+ '<(DEPTH)/mojo/public/tools/bindings/generators/cpp_templates/module-internal.h.tmpl',
+ '<(DEPTH)/mojo/public/tools/bindings/generators/cpp_templates/params_definition.tmpl',
+ '<(DEPTH)/mojo/public/tools/bindings/generators/cpp_templates/struct_declaration.tmpl',
+ '<(DEPTH)/mojo/public/tools/bindings/generators/cpp_templates/struct_definition.tmpl',
+ '<(DEPTH)/mojo/public/tools/bindings/generators/cpp_templates/struct_macros.tmpl',
+ '<(DEPTH)/mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_declaration.tmpl',
+ '<(DEPTH)/mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_definition.tmpl',
+ '<(DEPTH)/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl',
+ '<(DEPTH)/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_definition.tmpl',
+ '<(DEPTH)/mojo/public/tools/bindings/generators/java_templates/constant_definition.tmpl',
+ '<(DEPTH)/mojo/public/tools/bindings/generators/java_templates/constants.java.tmpl',
+ '<(DEPTH)/mojo/public/tools/bindings/generators/java_templates/enum_definition.tmpl',
+ '<(DEPTH)/mojo/public/tools/bindings/generators/java_templates/enum.java.tmpl',
+ '<(DEPTH)/mojo/public/tools/bindings/generators/java_templates/header.java.tmpl',
+ '<(DEPTH)/mojo/public/tools/bindings/generators/java_templates/interface_definition.tmpl',
+ '<(DEPTH)/mojo/public/tools/bindings/generators/java_templates/interface.java.tmpl',
+ '<(DEPTH)/mojo/public/tools/bindings/generators/java_templates/interface_internal.java.tmpl',
+ '<(DEPTH)/mojo/public/tools/bindings/generators/java_templates/struct_definition.tmpl',
+ '<(DEPTH)/mojo/public/tools/bindings/generators/java_templates/struct.java.tmpl',
+ '<(DEPTH)/mojo/public/tools/bindings/generators/js_templates/enum_definition.tmpl',
+ '<(DEPTH)/mojo/public/tools/bindings/generators/js_templates/interface_definition.tmpl',
+ '<(DEPTH)/mojo/public/tools/bindings/generators/js_templates/module_definition.tmpl',
+ '<(DEPTH)/mojo/public/tools/bindings/generators/js_templates/module.amd.tmpl',
+ '<(DEPTH)/mojo/public/tools/bindings/generators/js_templates/module.sky.tmpl',
+ '<(DEPTH)/mojo/public/tools/bindings/generators/js_templates/struct_definition.tmpl',
+ '<(DEPTH)/mojo/public/tools/bindings/generators/python_templates/module_macros.tmpl',
+ '<(DEPTH)/mojo/public/tools/bindings/generators/python_templates/module.py.tmpl',
+ '<(DEPTH)/mojo/public/tools/bindings/generators/mojom_cpp_generator.py',
+ '<(DEPTH)/mojo/public/tools/bindings/generators/mojom_java_generator.py',
+ '<(DEPTH)/mojo/public/tools/bindings/generators/mojom_js_generator.py',
+ '<(DEPTH)/mojo/public/tools/bindings/generators/mojom_python_generator.py',
+ '<(DEPTH)/mojo/public/tools/bindings/pylib/mojom/__init__.py',
+ '<(DEPTH)/mojo/public/tools/bindings/pylib/mojom/error.py',
+ '<(DEPTH)/mojo/public/tools/bindings/pylib/mojom/generate/__init__.py',
+ '<(DEPTH)/mojo/public/tools/bindings/pylib/mojom/generate/data.py',
+ '<(DEPTH)/mojo/public/tools/bindings/pylib/mojom/generate/generator.py',
+ '<(DEPTH)/mojo/public/tools/bindings/pylib/mojom/generate/module.py',
+ '<(DEPTH)/mojo/public/tools/bindings/pylib/mojom/generate/pack.py',
+ '<(DEPTH)/mojo/public/tools/bindings/pylib/mojom/generate/template_expander.py',
+ '<(DEPTH)/mojo/public/tools/bindings/pylib/mojom/parse/__init__.py',
+ '<(DEPTH)/mojo/public/tools/bindings/pylib/mojom/parse/ast.py',
+ '<(DEPTH)/mojo/public/tools/bindings/pylib/mojom/parse/lexer.py',
+ '<(DEPTH)/mojo/public/tools/bindings/pylib/mojom/parse/parser.py',
+ '<(DEPTH)/mojo/public/tools/bindings/pylib/mojom/parse/translate.py',
],
'outputs': [
'<(SHARED_INTERMEDIATE_DIR)/<(mojom_base_output_dir)/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).mojom.cc',
diff --git a/mojo/public/tools/bindings/mojom_bindings_generator_explicit.gypi b/mojo/public/tools/bindings/mojom_bindings_generator_explicit.gypi
deleted file mode 100644
index 68348fb..0000000
--- a/mojo/public/tools/bindings/mojom_bindings_generator_explicit.gypi
+++ /dev/null
@@ -1,69 +0,0 @@
-# Copyright 2013 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.
-
-{
- 'includes': [
- 'mojom_bindings_generator_variables.gypi',
- ],
- 'variables': {
- 'mojom_base_output_dir':
- '<!(python <(DEPTH)/build/inverse_depth.py <(DEPTH))',
- 'mojom_generated_outputs': [
- '<!@(python <(DEPTH)/mojo/public/tools/bindings/mojom_list_outputs.py --basedir <(mojom_base_output_dir) <@(mojom_files))',
- ],
- },
- 'actions': [
- {
- 'action_name': '<(_target_name)_mojom_bindings_generator',
- 'variables': {
- 'java_out_dir': '<(PRODUCT_DIR)/java_mojo/<(_target_name)/src',
- 'mojom_import_args%': [
- '-I<(DEPTH)'
- ],
- },
- 'inputs': [
- '<@(mojom_bindings_generator_sources)',
- '<@(mojom_files)',
- ],
- 'outputs': [
- '<@(mojom_generated_outputs)',
- ],
- 'action': [
- 'python', '<@(mojom_bindings_generator)',
- '<@(mojom_files)',
- '--use_chromium_bundled_pylibs',
- '-d', '<(DEPTH)',
- '<@(mojom_import_args)',
- '-o', '<(SHARED_INTERMEDIATE_DIR)',
- '--java_output_directory=<(java_out_dir)',
- ],
- 'message': 'Generating Mojo bindings from <@(mojom_files)',
- 'process_outputs_as_sources': 1,
- }
- ],
- 'direct_dependent_settings': {
- 'sources': [
- '<@(mojom_generated_outputs)',
- ],
- # Include paths needed to compile the generated sources into a library.
- 'include_dirs': [
- '<(DEPTH)',
- '<(SHARED_INTERMEDIATE_DIR)',
- ],
- 'direct_dependent_settings': {
- # Include paths needed to find the generated header files and their
- # transitive dependancies when using the library.
- 'include_dirs': [
- '<(DEPTH)',
- '<(SHARED_INTERMEDIATE_DIR)',
- ],
- 'variables': {
- 'generated_src_dirs': [
- '<(PRODUCT_DIR)/java_mojo/<(_target_name)/src',
- ],
- },
- }
- },
- 'hard_dependency': 1,
-}
diff --git a/mojo/public/tools/bindings/mojom_bindings_generator_variables.gypi b/mojo/public/tools/bindings/mojom_bindings_generator_variables.gypi
deleted file mode 100644
index b4b53e6..0000000
--- a/mojo/public/tools/bindings/mojom_bindings_generator_variables.gypi
+++ /dev/null
@@ -1,67 +0,0 @@
-# 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.
-
-{
- 'variables': {
- 'mojom_bindings_generator':
- '<(DEPTH)/mojo/public/tools/bindings/mojom_bindings_generator.py',
- 'mojom_bindings_generator_sources': [
- '<(mojom_bindings_generator)',
- '<(DEPTH)/mojo/public/tools/bindings/generators/cpp_templates/enum_declaration.tmpl',
- '<(DEPTH)/mojo/public/tools/bindings/generators/cpp_templates/interface_declaration.tmpl',
- '<(DEPTH)/mojo/public/tools/bindings/generators/cpp_templates/interface_definition.tmpl',
- '<(DEPTH)/mojo/public/tools/bindings/generators/cpp_templates/interface_macros.tmpl',
- '<(DEPTH)/mojo/public/tools/bindings/generators/cpp_templates/interface_proxy_declaration.tmpl',
- '<(DEPTH)/mojo/public/tools/bindings/generators/cpp_templates/interface_request_validator_declaration.tmpl',
- '<(DEPTH)/mojo/public/tools/bindings/generators/cpp_templates/interface_response_validator_declaration.tmpl',
- '<(DEPTH)/mojo/public/tools/bindings/generators/cpp_templates/interface_stub_declaration.tmpl',
- '<(DEPTH)/mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl',
- '<(DEPTH)/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl',
- '<(DEPTH)/mojo/public/tools/bindings/generators/cpp_templates/module-internal.h.tmpl',
- '<(DEPTH)/mojo/public/tools/bindings/generators/cpp_templates/params_definition.tmpl',
- '<(DEPTH)/mojo/public/tools/bindings/generators/cpp_templates/struct_declaration.tmpl',
- '<(DEPTH)/mojo/public/tools/bindings/generators/cpp_templates/struct_definition.tmpl',
- '<(DEPTH)/mojo/public/tools/bindings/generators/cpp_templates/struct_macros.tmpl',
- '<(DEPTH)/mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_declaration.tmpl',
- '<(DEPTH)/mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_definition.tmpl',
- '<(DEPTH)/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl',
- '<(DEPTH)/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_definition.tmpl',
- '<(DEPTH)/mojo/public/tools/bindings/generators/java_templates/constant_definition.tmpl',
- '<(DEPTH)/mojo/public/tools/bindings/generators/java_templates/constants.java.tmpl',
- '<(DEPTH)/mojo/public/tools/bindings/generators/java_templates/enum_definition.tmpl',
- '<(DEPTH)/mojo/public/tools/bindings/generators/java_templates/enum.java.tmpl',
- '<(DEPTH)/mojo/public/tools/bindings/generators/java_templates/header.java.tmpl',
- '<(DEPTH)/mojo/public/tools/bindings/generators/java_templates/interface_definition.tmpl',
- '<(DEPTH)/mojo/public/tools/bindings/generators/java_templates/interface.java.tmpl',
- '<(DEPTH)/mojo/public/tools/bindings/generators/java_templates/interface_internal.java.tmpl',
- '<(DEPTH)/mojo/public/tools/bindings/generators/java_templates/struct_definition.tmpl',
- '<(DEPTH)/mojo/public/tools/bindings/generators/java_templates/struct.java.tmpl',
- '<(DEPTH)/mojo/public/tools/bindings/generators/js_templates/enum_definition.tmpl',
- '<(DEPTH)/mojo/public/tools/bindings/generators/js_templates/interface_definition.tmpl',
- '<(DEPTH)/mojo/public/tools/bindings/generators/js_templates/module_definition.tmpl',
- '<(DEPTH)/mojo/public/tools/bindings/generators/js_templates/module.amd.tmpl',
- '<(DEPTH)/mojo/public/tools/bindings/generators/js_templates/module.sky.tmpl',
- '<(DEPTH)/mojo/public/tools/bindings/generators/js_templates/struct_definition.tmpl',
- '<(DEPTH)/mojo/public/tools/bindings/generators/python_templates/module_macros.tmpl',
- '<(DEPTH)/mojo/public/tools/bindings/generators/python_templates/module.py.tmpl',
- '<(DEPTH)/mojo/public/tools/bindings/generators/mojom_cpp_generator.py',
- '<(DEPTH)/mojo/public/tools/bindings/generators/mojom_java_generator.py',
- '<(DEPTH)/mojo/public/tools/bindings/generators/mojom_js_generator.py',
- '<(DEPTH)/mojo/public/tools/bindings/generators/mojom_python_generator.py',
- '<(DEPTH)/mojo/public/tools/bindings/pylib/mojom/__init__.py',
- '<(DEPTH)/mojo/public/tools/bindings/pylib/mojom/error.py',
- '<(DEPTH)/mojo/public/tools/bindings/pylib/mojom/generate/__init__.py',
- '<(DEPTH)/mojo/public/tools/bindings/pylib/mojom/generate/data.py',
- '<(DEPTH)/mojo/public/tools/bindings/pylib/mojom/generate/generator.py',
- '<(DEPTH)/mojo/public/tools/bindings/pylib/mojom/generate/module.py',
- '<(DEPTH)/mojo/public/tools/bindings/pylib/mojom/generate/pack.py',
- '<(DEPTH)/mojo/public/tools/bindings/pylib/mojom/generate/template_expander.py',
- '<(DEPTH)/mojo/public/tools/bindings/pylib/mojom/parse/__init__.py',
- '<(DEPTH)/mojo/public/tools/bindings/pylib/mojom/parse/ast.py',
- '<(DEPTH)/mojo/public/tools/bindings/pylib/mojom/parse/lexer.py',
- '<(DEPTH)/mojo/public/tools/bindings/pylib/mojom/parse/parser.py',
- '<(DEPTH)/mojo/public/tools/bindings/pylib/mojom/parse/translate.py',
- ]
- }
-} \ No newline at end of file
diff --git a/mojo/public/tools/bindings/mojom_list_outputs.py b/mojo/public/tools/bindings/mojom_list_outputs.py
deleted file mode 100755
index 8ac94e8..0000000
--- a/mojo/public/tools/bindings/mojom_list_outputs.py
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env python
-# 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.
-
-import argparse
-import os.path
-import sys
-
-def main():
- parser = argparse.ArgumentParser(
- description="GYP helper script for mapping mojoms => generated outputs.")
- parser.add_argument("--basedir", required=True)
- parser.add_argument("mojom", nargs="*")
-
- args = parser.parse_args()
-
- for mojom in args.mojom:
- full = os.path.join("<(SHARED_INTERMEDIATE_DIR)", args.basedir, mojom)
- base, ext = os.path.splitext(full)
- assert ext == ".mojom", mojom
- # Fix filename escaping issues on Windows.
- base = base.replace("\\", "/")
- print base + ".mojom.cc"
- print base + ".mojom.h"
- print base + ".mojom-internal.h"
- print base + ".mojom.js"
- print base + ".mojom.html"
- print base + "_mojom.py"
-
- return 0
-
-if __name__ == "__main__":
- sys.exit(main())