Skip to content

Commit 39bd2be

Browse files
committed
Avoid using CHECK in files using node headesr
Node has its own CHECK macro which requires linking with node::Assert.
1 parent cef86f5 commit 39bd2be

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
lines changed

atom/common/native_mate_converters/v8_value_converter.cc

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -111,32 +111,31 @@ base::Value* V8ValueConverter::FromV8Value(
111111

112112
v8::Local<v8::Value> V8ValueConverter::ToV8ValueImpl(
113113
v8::Isolate* isolate, const base::Value* value) const {
114-
CHECK(value);
115114
switch (value->GetType()) {
116115
case base::Value::TYPE_NULL:
117116
return v8::Null(isolate);
118117

119118
case base::Value::TYPE_BOOLEAN: {
120119
bool val = false;
121-
CHECK(value->GetAsBoolean(&val));
120+
value->GetAsBoolean(&val);
122121
return v8::Boolean::New(isolate, val);
123122
}
124123

125124
case base::Value::TYPE_INTEGER: {
126125
int val = 0;
127-
CHECK(value->GetAsInteger(&val));
126+
value->GetAsInteger(&val);
128127
return v8::Integer::New(isolate, val);
129128
}
130129

131130
case base::Value::TYPE_DOUBLE: {
132131
double val = 0.0;
133-
CHECK(value->GetAsDouble(&val));
132+
value->GetAsDouble(&val);
134133
return v8::Number::New(isolate, val);
135134
}
136135

137136
case base::Value::TYPE_STRING: {
138137
std::string val;
139-
CHECK(value->GetAsString(&val));
138+
value->GetAsString(&val);
140139
return v8::String::NewFromUtf8(
141140
isolate, val.c_str(), v8::String::kNormalString, val.length());
142141
}
@@ -164,10 +163,9 @@ v8::Local<v8::Value> V8ValueConverter::ToV8Array(
164163

165164
for (size_t i = 0; i < val->GetSize(); ++i) {
166165
const base::Value* child = nullptr;
167-
CHECK(val->Get(i, &child));
166+
val->Get(i, &child);
168167

169168
v8::Local<v8::Value> child_v8 = ToV8ValueImpl(isolate, child);
170-
CHECK(!child_v8.IsEmpty());
171169

172170
v8::TryCatch try_catch;
173171
result->Set(static_cast<uint32_t>(i), child_v8);
@@ -187,7 +185,6 @@ v8::Local<v8::Value> V8ValueConverter::ToV8Object(
187185
!iter.IsAtEnd(); iter.Advance()) {
188186
const std::string& key = iter.key();
189187
v8::Local<v8::Value> child_v8 = ToV8ValueImpl(isolate, &iter.value());
190-
CHECK(!child_v8.IsEmpty());
191188

192189
v8::TryCatch try_catch;
193190
result.Set(key, child_v8);
@@ -211,8 +208,6 @@ base::Value* V8ValueConverter::FromV8ValueImpl(
211208
FromV8ValueState* state,
212209
v8::Local<v8::Value> val,
213210
v8::Isolate* isolate) const {
214-
CHECK(!val.IsEmpty());
215-
216211
FromV8ValueState::Level state_level(state);
217212
if (state->HasReachedMaxRecursionDepth())
218213
return nullptr;

atom/common/node_bindings.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include "atom/common/api/locker.h"
1212
#include "atom/common/atom_command_line.h"
1313
#include "atom/common/native_mate_converters/file_path_converter.h"
14-
#include "atom/common/node_includes.h"
1514
#include "base/command_line.h"
1615
#include "base/base_paths.h"
1716
#include "base/environment.h"
@@ -22,6 +21,8 @@
2221
#include "content/public/common/content_paths.h"
2322
#include "native_mate/dictionary.h"
2423

24+
#include "atom/common/node_includes.h"
25+
2526
using content::BrowserThread;
2627

2728
// Force all builtin modules to be referenced so they can actually run their
@@ -216,7 +217,6 @@ void NodeBindings::UvRunOnce() {
216217
DCHECK(!is_browser_ || BrowserThread::CurrentlyOn(BrowserThread::UI));
217218

218219
node::Environment* env = uv_env();
219-
CHECK(env);
220220

221221
// Use Locker in browser process.
222222
mate::Locker locker(env->isolate());

vendor/native_mate

0 commit comments

Comments
 (0)