Avoid using CHECK in files using node headesr

Node has its own CHECK macro which requires linking with node::Assert.
This commit is contained in:
Cheng Zhao 2016-07-21 16:44:30 +09:00
parent cef86f5257
commit 39bd2bee8e
3 changed files with 8 additions and 13 deletions

View file

@ -111,32 +111,31 @@ base::Value* V8ValueConverter::FromV8Value(
v8::Local<v8::Value> 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<v8::Value> 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<v8::Value> child_v8 = ToV8ValueImpl(isolate, child);
CHECK(!child_v8.IsEmpty());
v8::TryCatch try_catch;
result->Set(static_cast<uint32_t>(i), child_v8);
@ -187,7 +185,6 @@ v8::Local<v8::Value> V8ValueConverter::ToV8Object(
!iter.IsAtEnd(); iter.Advance()) {
const std::string& key = iter.key();
v8::Local<v8::Value> 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<v8::Value> val,
v8::Isolate* isolate) const {
CHECK(!val.IsEmpty());
FromV8ValueState::Level state_level(state);
if (state->HasReachedMaxRecursionDepth())
return nullptr;

View file

@ -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());

2
vendor/native_mate vendored

@ -1 +1 @@
Subproject commit b611cbb75f35b89d4b7e86735432abe5ed059de3
Subproject commit d9bfe6a49d8585916bd8dc77165154afeee4e5b6