From 39bd2bee8eabbff6c45bd8d4c6d791ff388c309c Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 21 Jul 2016 16:44:30 +0900 Subject: [PATCH] Avoid using CHECK in files using node headesr Node has its own CHECK macro which requires linking with node::Assert. --- .../native_mate_converters/v8_value_converter.cc | 15 +++++---------- atom/common/node_bindings.cc | 4 ++-- vendor/native_mate | 2 +- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/atom/common/native_mate_converters/v8_value_converter.cc b/atom/common/native_mate_converters/v8_value_converter.cc index d53fe6f62713..ddff43924400 100644 --- a/atom/common/native_mate_converters/v8_value_converter.cc +++ b/atom/common/native_mate_converters/v8_value_converter.cc @@ -111,32 +111,31 @@ base::Value* V8ValueConverter::FromV8Value( v8::Local V8ValueConverter::ToV8ValueImpl( v8::Isolate* isolate, const base::Value* value) const { - CHECK(value); switch (value->GetType()) { case base::Value::TYPE_NULL: return v8::Null(isolate); case base::Value::TYPE_BOOLEAN: { bool val = false; - CHECK(value->GetAsBoolean(&val)); + value->GetAsBoolean(&val); return v8::Boolean::New(isolate, val); } case base::Value::TYPE_INTEGER: { int val = 0; - CHECK(value->GetAsInteger(&val)); + value->GetAsInteger(&val); return v8::Integer::New(isolate, val); } case base::Value::TYPE_DOUBLE: { double val = 0.0; - CHECK(value->GetAsDouble(&val)); + value->GetAsDouble(&val); return v8::Number::New(isolate, val); } case base::Value::TYPE_STRING: { std::string val; - CHECK(value->GetAsString(&val)); + value->GetAsString(&val); return v8::String::NewFromUtf8( isolate, val.c_str(), v8::String::kNormalString, val.length()); } @@ -164,10 +163,9 @@ v8::Local V8ValueConverter::ToV8Array( for (size_t i = 0; i < val->GetSize(); ++i) { const base::Value* child = nullptr; - CHECK(val->Get(i, &child)); + val->Get(i, &child); v8::Local child_v8 = ToV8ValueImpl(isolate, child); - CHECK(!child_v8.IsEmpty()); v8::TryCatch try_catch; result->Set(static_cast(i), child_v8); @@ -187,7 +185,6 @@ v8::Local V8ValueConverter::ToV8Object( !iter.IsAtEnd(); iter.Advance()) { const std::string& key = iter.key(); v8::Local child_v8 = ToV8ValueImpl(isolate, &iter.value()); - CHECK(!child_v8.IsEmpty()); v8::TryCatch try_catch; result.Set(key, child_v8); @@ -211,8 +208,6 @@ base::Value* V8ValueConverter::FromV8ValueImpl( FromV8ValueState* state, v8::Local val, v8::Isolate* isolate) const { - CHECK(!val.IsEmpty()); - FromV8ValueState::Level state_level(state); if (state->HasReachedMaxRecursionDepth()) return nullptr; diff --git a/atom/common/node_bindings.cc b/atom/common/node_bindings.cc index 40fa6bdb6e28..2a999ea79bc9 100644 --- a/atom/common/node_bindings.cc +++ b/atom/common/node_bindings.cc @@ -11,7 +11,6 @@ #include "atom/common/api/locker.h" #include "atom/common/atom_command_line.h" #include "atom/common/native_mate_converters/file_path_converter.h" -#include "atom/common/node_includes.h" #include "base/command_line.h" #include "base/base_paths.h" #include "base/environment.h" @@ -22,6 +21,8 @@ #include "content/public/common/content_paths.h" #include "native_mate/dictionary.h" +#include "atom/common/node_includes.h" + using content::BrowserThread; // Force all builtin modules to be referenced so they can actually run their @@ -216,7 +217,6 @@ void NodeBindings::UvRunOnce() { DCHECK(!is_browser_ || BrowserThread::CurrentlyOn(BrowserThread::UI)); node::Environment* env = uv_env(); - CHECK(env); // Use Locker in browser process. mate::Locker locker(env->isolate()); diff --git a/vendor/native_mate b/vendor/native_mate index b611cbb75f35..d9bfe6a49d85 160000 --- a/vendor/native_mate +++ b/vendor/native_mate @@ -1 +1 @@ -Subproject commit b611cbb75f35b89d4b7e86735432abe5ed059de3 +Subproject commit d9bfe6a49d8585916bd8dc77165154afeee4e5b6