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

Unified Diff: mojo/bindings/js/handle.cc

Issue 278093003: Break dependency on core from generated mojom.js files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Specialize Converter<gin::Handle<gin::HandleWrapper> > Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/bindings/js/handle.h ('k') | mojo/public/js/bindings/connector.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/bindings/js/handle.cc
diff --git a/mojo/bindings/js/handle.cc b/mojo/bindings/js/handle.cc
index 36a49886db4b39693d26fa66b9298b254007a77d..e1d0fb04b60c063466536c04f48502c7b1423179 100644
--- a/mojo/bindings/js/handle.cc
+++ b/mojo/bindings/js/handle.cc
@@ -17,12 +17,19 @@ HandleWrapper::~HandleWrapper() {
v8::Handle<v8::Value> Converter<mojo::Handle>::ToV8(v8::Isolate* isolate,
const mojo::Handle& val) {
+ if (!val.is_valid())
+ return v8::Null(isolate);
return HandleWrapper::Create(isolate, val.value()).ToV8();
}
bool Converter<mojo::Handle>::FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val,
mojo::Handle* out) {
+ if (val->IsNull()) {
+ *out = mojo::Handle();
+ return true;
+ }
+
gin::Handle<HandleWrapper> handle;
if (!Converter<gin::Handle<HandleWrapper> >::FromV8(isolate, val, &handle))
return false;
« no previous file with comments | « mojo/bindings/js/handle.h ('k') | mojo/public/js/bindings/connector.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698