| OLD | NEW |
| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 V8HiddenValue::setHiddenValue(scriptState->isolate(), owner, V8HiddenVal
ue::condition(scriptState->isolate()), filter); | 50 V8HiddenValue::setHiddenValue(scriptState->isolate(), owner, V8HiddenVal
ue::condition(scriptState->isolate()), filter); |
| 51 m_filter.set(scriptState->isolate(), filter); | 51 m_filter.set(scriptState->isolate(), filter); |
| 52 m_filter.setWeak(this, &setWeakCallback); | 52 m_filter.setWeak(this, &setWeakCallback); |
| 53 } | 53 } |
| 54 } | 54 } |
| 55 | 55 |
| 56 V8NodeFilterCondition::~V8NodeFilterCondition() | 56 V8NodeFilterCondition::~V8NodeFilterCondition() |
| 57 { | 57 { |
| 58 } | 58 } |
| 59 | 59 |
| 60 short V8NodeFilterCondition::acceptNode(Node* node, ExceptionState& exceptionSta
te) const | 60 unsigned V8NodeFilterCondition::acceptNode(Node* node, ExceptionState& exception
State) const |
| 61 { | 61 { |
| 62 v8::Isolate* isolate = m_scriptState->isolate(); | 62 v8::Isolate* isolate = m_scriptState->isolate(); |
| 63 ASSERT(!m_scriptState->context().IsEmpty()); | 63 ASSERT(!m_scriptState->context().IsEmpty()); |
| 64 v8::HandleScope handleScope(isolate); | 64 v8::HandleScope handleScope(isolate); |
| 65 v8::Local<v8::Value> filter = m_filter.newLocal(isolate); | 65 v8::Local<v8::Value> filter = m_filter.newLocal(isolate); |
| 66 | 66 |
| 67 ASSERT(filter.IsEmpty() || filter->IsObject()); | 67 ASSERT(filter.IsEmpty() || filter->IsObject()); |
| 68 if (filter.IsEmpty()) | 68 if (filter.IsEmpty()) |
| 69 return NodeFilter::FILTER_ACCEPT; | 69 return NodeFilter::FILTER_ACCEPT; |
| 70 | 70 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 99 } | 99 } |
| 100 | 100 |
| 101 v8::Local<v8::Value> result; | 101 v8::Local<v8::Value> result; |
| 102 if (!ScriptController::callFunction(m_scriptState->executionContext(), callb
ack, receiver, 1, info.get(), isolate).ToLocal(&result)) { | 102 if (!ScriptController::callFunction(m_scriptState->executionContext(), callb
ack, receiver, 1, info.get(), isolate).ToLocal(&result)) { |
| 103 exceptionState.rethrowV8Exception(exceptionCatcher.Exception()); | 103 exceptionState.rethrowV8Exception(exceptionCatcher.Exception()); |
| 104 return NodeFilter::FILTER_REJECT; | 104 return NodeFilter::FILTER_REJECT; |
| 105 } | 105 } |
| 106 | 106 |
| 107 ASSERT(!result.IsEmpty()); | 107 ASSERT(!result.IsEmpty()); |
| 108 | 108 |
| 109 int32_t int32Value; | 109 uint32_t uint32Value; |
| 110 if (!v8Call(result->Int32Value(m_scriptState->context()), int32Value, except
ionCatcher)) { | 110 if (!v8Call(result->Uint32Value(m_scriptState->context()), uint32Value, exce
ptionCatcher)) { |
| 111 exceptionState.rethrowV8Exception(exceptionCatcher.Exception()); | 111 exceptionState.rethrowV8Exception(exceptionCatcher.Exception()); |
| 112 return NodeFilter::FILTER_REJECT; | 112 return NodeFilter::FILTER_REJECT; |
| 113 } | 113 } |
| 114 return int32Value; | 114 return uint32Value; |
| 115 } | 115 } |
| 116 | 116 |
| 117 void V8NodeFilterCondition::setWeakCallback(const v8::WeakCallbackInfo<V8NodeFil
terCondition>& data) | 117 void V8NodeFilterCondition::setWeakCallback(const v8::WeakCallbackInfo<V8NodeFil
terCondition>& data) |
| 118 { | 118 { |
| 119 data.GetParameter()->m_filter.clear(); | 119 data.GetParameter()->m_filter.clear(); |
| 120 } | 120 } |
| 121 | 121 |
| 122 } // namespace blink | 122 } // namespace blink |
| OLD | NEW |