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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 // |m_filter|, the Javascript value, and the whole reference is exposed to V8 to | 51 // |m_filter|, the Javascript value, and the whole reference is exposed to V8 to |
52 // let V8 GC handle collection of |m_filter|. | 52 // let V8 GC handle collection of |m_filter|. |
53 // (DOM) | 53 // (DOM) |
54 // NodeIterator ----RefPtr----> NodeFilter ----RefPtr----> NodeFilterCondition | 54 // NodeIterator ----RefPtr----> NodeFilter ----RefPtr----> NodeFilterCondition |
55 // | ^ | ^ | | 55 // | ^ | ^ | |
56 // weak | weak | ScopedPersistent(weak) | 56 // weak | weak | ScopedPersistent(weak) |
57 // | RefPtr | RefPtr | | 57 // | RefPtr | RefPtr | |
58 // v | v | v | 58 // v | v | v |
59 // NodeIterator --HiddenValue--> NodeFilter --HiddenValue--> JS Callback | 59 // NodeIterator --HiddenValue--> NodeFilter --HiddenValue--> JS Callback |
60 // (V8) | 60 // (V8) |
61 class V8NodeFilterCondition : public NodeFilterCondition { | 61 class V8NodeFilterCondition FINAL : public NodeFilterCondition { |
62 public: | 62 public: |
63 static PassRefPtr<V8NodeFilterCondition> create(v8::Handle<v8::Value> filter
, v8::Handle<v8::Object> owner, v8::Isolate* isolate) | 63 static PassRefPtr<V8NodeFilterCondition> create(v8::Handle<v8::Value> filter
, v8::Handle<v8::Object> owner, v8::Isolate* isolate) |
64 { | 64 { |
65 return adoptRef(new V8NodeFilterCondition(filter, owner, isolate)); | 65 return adoptRef(new V8NodeFilterCondition(filter, owner, isolate)); |
66 } | 66 } |
67 | 67 |
68 virtual ~V8NodeFilterCondition(); | 68 virtual ~V8NodeFilterCondition(); |
69 | 69 |
70 virtual short acceptNode(ScriptState*, Node*) const; | 70 virtual short acceptNode(ScriptState*, Node*) const OVERRIDE; |
71 | 71 |
72 private: | 72 private: |
73 // As the value |filter| is maintained by V8GC, the |owner| which references | 73 // As the value |filter| is maintained by V8GC, the |owner| which references |
74 // V8NodeFilterCondition, usually a wrapper of NodeFilter, is specified here | 74 // V8NodeFilterCondition, usually a wrapper of NodeFilter, is specified here |
75 // to hold a strong reference to |filter|. | 75 // to hold a strong reference to |filter|. |
76 V8NodeFilterCondition(v8::Handle<v8::Value> filter, v8::Handle<v8::Object> o
wner, v8::Isolate*); | 76 V8NodeFilterCondition(v8::Handle<v8::Value> filter, v8::Handle<v8::Object> o
wner, v8::Isolate*); |
77 | 77 |
78 static void setWeakCallback(const v8::WeakCallbackData<v8::Value, V8NodeFilt
erCondition>&); | 78 static void setWeakCallback(const v8::WeakCallbackData<v8::Value, V8NodeFilt
erCondition>&); |
79 | 79 |
80 ScopedPersistent<v8::Value> m_filter; | 80 ScopedPersistent<v8::Value> m_filter; |
81 }; | 81 }; |
82 | 82 |
83 } // namespace WebCore | 83 } // namespace WebCore |
84 | 84 |
85 #endif // V8NodeFilterCondition_h | 85 #endif // V8NodeFilterCondition_h |
OLD | NEW |