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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/V8NodeFilterCondition.cpp

Issue 2817533003: Replace ASSERT, RELEASE_ASSERT, and ASSERT_NOT_REACHED in bindings (Closed)
Patch Set: fixed dcheck build error Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 filter_.SetPhantom(); 56 filter_.SetPhantom();
57 } 57 }
58 } 58 }
59 59
60 V8NodeFilterCondition::~V8NodeFilterCondition() {} 60 V8NodeFilterCondition::~V8NodeFilterCondition() {}
61 61
62 unsigned V8NodeFilterCondition::AcceptNode( 62 unsigned V8NodeFilterCondition::AcceptNode(
63 Node* node, 63 Node* node,
64 ExceptionState& exception_state) const { 64 ExceptionState& exception_state) const {
65 v8::Isolate* isolate = script_state_->GetIsolate(); 65 v8::Isolate* isolate = script_state_->GetIsolate();
66 ASSERT(!script_state_->GetContext().IsEmpty()); 66 DCHECK(!script_state_->GetContext().IsEmpty());
67 v8::HandleScope handle_scope(isolate); 67 v8::HandleScope handle_scope(isolate);
68 v8::Local<v8::Value> filter = filter_.NewLocal(isolate); 68 v8::Local<v8::Value> filter = filter_.NewLocal(isolate);
69 69
70 ASSERT(filter.IsEmpty() || filter->IsObject()); 70 DCHECK(filter.IsEmpty() || filter->IsObject());
71 if (filter.IsEmpty()) 71 if (filter.IsEmpty())
72 return NodeFilter::kFilterAccept; 72 return NodeFilter::kFilterAccept;
73 73
74 v8::TryCatch exception_catcher(isolate); 74 v8::TryCatch exception_catcher(isolate);
75 75
76 v8::Local<v8::Function> callback; 76 v8::Local<v8::Function> callback;
77 v8::Local<v8::Value> receiver; 77 v8::Local<v8::Value> receiver;
78 if (filter->IsFunction()) { 78 if (filter->IsFunction()) {
79 UseCounter::Count(CurrentExecutionContext(isolate), 79 UseCounter::Count(CurrentExecutionContext(isolate),
80 UseCounter::kNodeFilterIsFunction); 80 UseCounter::kNodeFilterIsFunction);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 v8::Local<v8::Value> result; 113 v8::Local<v8::Value> result;
114 v8::Local<v8::Value> args[] = {node_wrapper}; 114 v8::Local<v8::Value> args[] = {node_wrapper};
115 if (!V8ScriptRunner::CallFunction(callback, 115 if (!V8ScriptRunner::CallFunction(callback,
116 ExecutionContext::From(script_state_.Get()), 116 ExecutionContext::From(script_state_.Get()),
117 receiver, 1, args, isolate) 117 receiver, 1, args, isolate)
118 .ToLocal(&result)) { 118 .ToLocal(&result)) {
119 exception_state.RethrowV8Exception(exception_catcher.Exception()); 119 exception_state.RethrowV8Exception(exception_catcher.Exception());
120 return NodeFilter::kFilterReject; 120 return NodeFilter::kFilterReject;
121 } 121 }
122 122
123 ASSERT(!result.IsEmpty()); 123 DCHECK(!result.IsEmpty());
124 124
125 uint32_t uint32_value; 125 uint32_t uint32_value;
126 if (!V8Call(result->Uint32Value(script_state_->GetContext()), uint32_value, 126 if (!V8Call(result->Uint32Value(script_state_->GetContext()), uint32_value,
127 exception_catcher)) { 127 exception_catcher)) {
128 exception_state.RethrowV8Exception(exception_catcher.Exception()); 128 exception_state.RethrowV8Exception(exception_catcher.Exception());
129 return NodeFilter::kFilterReject; 129 return NodeFilter::kFilterReject;
130 } 130 }
131 return uint32_value; 131 return uint32_value;
132 } 132 }
133 133
134 } // namespace blink 134 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698