| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 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 15 matching lines...) Expand all Loading... |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef V8NodeFilterCondition_h | 31 #ifndef V8NodeFilterCondition_h |
| 32 #define V8NodeFilterCondition_h | 32 #define V8NodeFilterCondition_h |
| 33 | 33 |
| 34 #include "bindings/core/v8/ScriptWrappable.h" | 34 #include "bindings/core/v8/ScriptWrappable.h" |
| 35 #include "bindings/core/v8/TraceWrapperV8Reference.h" | 35 #include "bindings/core/v8/TraceWrapperV8Reference.h" |
| 36 #include "core/dom/NodeFilterCondition.h" | |
| 37 #include "platform/heap/Handle.h" | 36 #include "platform/heap/Handle.h" |
| 38 #include "v8/include/v8.h" | 37 #include "v8/include/v8.h" |
| 39 | 38 |
| 40 namespace blink { | 39 namespace blink { |
| 41 | 40 |
| 42 class ExceptionState; | 41 class ExceptionState; |
| 43 class Node; | 42 class Node; |
| 44 class ScriptState; | 43 class ScriptState; |
| 45 | 44 |
| 46 // V8NodeFilterCondition maintains a Javascript implemented callback for | 45 // V8NodeFilterCondition maintains a Javascript implemented callback for |
| 47 // filtering Node returned by NodeIterator/TreeWalker. A V8NodeFilterCondition | 46 // filtering Node returned by NodeIterator/TreeWalker. A V8NodeFilterCondition |
| 48 // is referenced by a NodeIterator/TreeWalker. | 47 // is referenced by a NodeIterator/TreeWalker. |
| 49 // | 48 // |
| 50 // Binding generator should generate this code. See crbug.com/630986. | 49 // Binding generator should generate this code. See crbug.com/630986. |
| 51 class V8NodeFilterCondition final : public NodeFilterCondition, | 50 class V8NodeFilterCondition final |
| 52 public TraceWrapperBase { | 51 : public GarbageCollectedFinalized<V8NodeFilterCondition>, |
| 52 public TraceWrapperBase { |
| 53 public: | 53 public: |
| 54 static V8NodeFilterCondition* CreateOrNull(v8::Local<v8::Value> filter, | 54 static V8NodeFilterCondition* CreateOrNull(v8::Local<v8::Value> filter, |
| 55 ScriptState* script_state) { | 55 ScriptState* script_state) { |
| 56 return filter->IsNull() ? nullptr | 56 return filter->IsNull() ? nullptr |
| 57 : new V8NodeFilterCondition(filter, script_state); | 57 : new V8NodeFilterCondition(filter, script_state); |
| 58 } | 58 } |
| 59 | 59 |
| 60 ~V8NodeFilterCondition() override; | 60 ~V8NodeFilterCondition(); |
| 61 DEFINE_INLINE_VIRTUAL_TRACE() {} |
| 61 DECLARE_TRACE_WRAPPERS(); | 62 DECLARE_TRACE_WRAPPERS(); |
| 62 | 63 |
| 63 unsigned acceptNode(Node*, ExceptionState&) const override; | 64 unsigned acceptNode(Node*, ExceptionState&) const; |
| 64 v8::Local<v8::Value> Callback(v8::Isolate* isolate) const { | 65 v8::Local<v8::Value> Callback(v8::Isolate* isolate) const { |
| 65 return filter_.NewLocal(isolate); | 66 return filter_.NewLocal(isolate); |
| 66 } | 67 } |
| 67 | 68 |
| 68 private: | 69 private: |
| 69 V8NodeFilterCondition(v8::Local<v8::Value> filter, | 70 V8NodeFilterCondition(v8::Local<v8::Value> filter, |
| 70 ScriptState*); | 71 ScriptState*); |
| 71 | 72 |
| 72 RefPtr<ScriptState> script_state_; | 73 RefPtr<ScriptState> script_state_; |
| 73 TraceWrapperV8Reference<v8::Object> filter_; | 74 TraceWrapperV8Reference<v8::Object> filter_; |
| 74 }; | 75 }; |
| 75 | 76 |
| 76 } // namespace blink | 77 } // namespace blink |
| 77 | 78 |
| 78 #endif // V8NodeFilterCondition_h | 79 #endif // V8NodeFilterCondition_h |
| OLD | NEW |