Index: mojo/edk/js/handle.cc |
diff --git a/mojo/edk/js/handle.cc b/mojo/edk/js/handle.cc |
index de8f3383836494bc63fc67134da1cc88302797a3..ae3415f05647e777a428eef41ba0bf1516e4c03e 100644 |
--- a/mojo/edk/js/handle.cc |
+++ b/mojo/edk/js/handle.cc |
@@ -4,6 +4,7 @@ |
#include "mojo/edk/js/handle.h" |
+#include <sstream> |
#include "mojo/edk/js/handle_close_observer.h" |
namespace mojo { |
@@ -17,6 +18,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() { |