| Index: mojo/edk/js/handle.cc
|
| diff --git a/mojo/bindings/js/handle.cc b/mojo/edk/js/handle.cc
|
| similarity index 63%
|
| rename from mojo/bindings/js/handle.cc
|
| rename to mojo/edk/js/handle.cc
|
| index baa1baea3a2eb92788fe72d03816b225012cb554..ae3415f05647e777a428eef41ba0bf1516e4c03e 100644
|
| --- a/mojo/bindings/js/handle.cc
|
| +++ b/mojo/edk/js/handle.cc
|
| @@ -2,9 +2,10 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "mojo/bindings/js/handle.h"
|
| +#include "mojo/edk/js/handle.h"
|
|
|
| -#include "mojo/bindings/js/handle_close_observer.h"
|
| +#include <sstream>
|
| +#include "mojo/edk/js/handle_close_observer.h"
|
|
|
| namespace mojo {
|
| namespace js {
|
| @@ -19,6 +20,23 @@ HandleWrapper::~HandleWrapper() {
|
| NotifyCloseObservers();
|
| }
|
|
|
| +std::string HandleWrapper::ToString() {
|
| + std::ostringstream oss;
|
| + oss << "[mojo::Handle ";
|
| + if (handle_.is_valid())
|
| + oss << handle_.get().value();
|
| + else
|
| + oss << "null";
|
| + oss << "]";
|
| + return oss.str();
|
| +}
|
| +
|
| +gin::ObjectTemplateBuilder HandleWrapper::GetObjectTemplateBuilder(
|
| + v8::Isolate* isolate) {
|
| + return Wrappable<HandleWrapper>::GetObjectTemplateBuilder(isolate)
|
| + .SetMethod("toString", &HandleWrapper::ToString);
|
| +}
|
| +
|
| void HandleWrapper::Close() {
|
| NotifyCloseObservers();
|
| handle_.reset();
|
| @@ -68,4 +86,16 @@ bool Converter<mojo::Handle>::FromV8(v8::Isolate* isolate,
|
| return true;
|
| }
|
|
|
| +v8::Handle<v8::Value> Converter<mojo::MessagePipeHandle>::ToV8(
|
| + v8::Isolate* isolate, mojo::MessagePipeHandle val) {
|
| + return Converter<mojo::Handle>::ToV8(isolate, val);
|
| +}
|
| +
|
| +bool Converter<mojo::MessagePipeHandle>::FromV8(v8::Isolate* isolate,
|
| + v8::Handle<v8::Value> val,
|
| + mojo::MessagePipeHandle* out) {
|
| + return Converter<mojo::Handle>::FromV8(isolate, val, out);
|
| +}
|
| +
|
| +
|
| } // namespace gin
|
|
|