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

Side by Side Diff: Source/bindings/v8/V8Binding.cpp

Issue 21274004: Fix Document leak from NodeFilter. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 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 | Annotate | Revision Log
OLDNEW
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
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 #include "config.h" 31 #include "config.h"
32 #include "bindings/v8/V8Binding.h" 32 #include "bindings/v8/V8Binding.h"
33 33
34 #include "V8DOMStringList.h" 34 #include "V8DOMStringList.h"
35 #include "V8Element.h" 35 #include "V8Element.h"
36 #include "V8NodeFilter.h"
36 #include "V8Window.h" 37 #include "V8Window.h"
37 #include "V8WorkerGlobalScope.h" 38 #include "V8WorkerGlobalScope.h"
38 #include "V8XPathNSResolver.h" 39 #include "V8XPathNSResolver.h"
39 #include "bindings/v8/ScriptController.h" 40 #include "bindings/v8/ScriptController.h"
40 #include "bindings/v8/V8NodeFilterCondition.h" 41 #include "bindings/v8/V8NodeFilterCondition.h"
41 #include "bindings/v8/V8ObjectConstructor.h" 42 #include "bindings/v8/V8ObjectConstructor.h"
42 #include "bindings/v8/V8WindowShell.h" 43 #include "bindings/v8/V8WindowShell.h"
43 #include "bindings/v8/WorkerScriptController.h" 44 #include "bindings/v8/WorkerScriptController.h"
44 #include "bindings/v8/custom/V8CustomXPathNSResolver.h" 45 #include "bindings/v8/custom/V8CustomXPathNSResolver.h"
45 #include "core/dom/DOMStringList.h" 46 #include "core/dom/DOMStringList.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 136
136 Vector<v8::Handle<v8::Value> > toVectorOfArguments(const v8::FunctionCallbackInf o<v8::Value>& args) 137 Vector<v8::Handle<v8::Value> > toVectorOfArguments(const v8::FunctionCallbackInf o<v8::Value>& args)
137 { 138 {
138 Vector<v8::Handle<v8::Value> > result; 139 Vector<v8::Handle<v8::Value> > result;
139 size_t length = args.Length(); 140 size_t length = args.Length();
140 for (size_t i = 0; i < length; ++i) 141 for (size_t i = 0; i < length; ++i)
141 result.append(args[i]); 142 result.append(args[i]);
142 return result; 143 return result;
143 } 144 }
144 145
145 PassRefPtr<NodeFilter> toNodeFilter(v8::Handle<v8::Value> callback) 146 PassRefPtr<NodeFilter> toNodeFilter(v8::Handle<v8::Value> callback, v8::Isolate* isolate)
146 { 147 {
147 return NodeFilter::create(V8NodeFilterCondition::create(callback)); 148 RefPtr<NodeFilter> filter = NodeFilter::create();
149
150 // FIXME: Should pass in appropriate creationContext
151 v8::Handle<v8::Object> filterWrapper = toV8(PassRefPtr<NodeFilter>(filter), v8::Handle<v8::Object>(), isolate).As<v8::Object>();
abarth-chromium 2013/07/31 06:04:14 PassRefPtr<NodeFilter>(filter) -> filter.get() ^
kouhei (in TOK) 2013/07/31 06:21:34 Done.
152
153 RefPtr<NodeFilterCondition> condition = V8NodeFilterCondition::create(callba ck, filterWrapper);
154 filter->setCondition(condition.release());
155
156 return filter.release();
148 } 157 }
149 158
150 static const int8_t kMaxInt8 = 127; 159 static const int8_t kMaxInt8 = 127;
151 static const int8_t kMinInt8 = -128; 160 static const int8_t kMinInt8 = -128;
152 static const uint8_t kMaxUInt8 = 255; 161 static const uint8_t kMaxUInt8 = 255;
153 const int32_t kMaxInt32 = 0x7fffffff; 162 const int32_t kMaxInt32 = 0x7fffffff;
154 const int32_t kMinInt32 = -kMaxInt32 - 1; 163 const int32_t kMinInt32 = -kMaxInt32 - 1;
155 const uint32_t kMaxUInt32 = 0xffffffff; 164 const uint32_t kMaxUInt32 = 0xffffffff;
156 const int64_t kJSMaxInteger = 0x20000000000000LL - 1; // 2^53 - 1, maximum integ er exactly representable in ECMAScript. 165 const int64_t kJSMaxInteger = 0x20000000000000LL - 1; // 2^53 - 1, maximum integ er exactly representable in ECMAScript.
157 166
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 return DOMWrapperWorld::isolatedWorld(v8::Context::GetCurrent()); 561 return DOMWrapperWorld::isolatedWorld(v8::Context::GetCurrent());
553 } 562 }
554 563
555 v8::Local<v8::Value> getHiddenValueFromMainWorldWrapper(v8::Isolate* isolate, Sc riptWrappable* wrappable, v8::Handle<v8::String> key) 564 v8::Local<v8::Value> getHiddenValueFromMainWorldWrapper(v8::Isolate* isolate, Sc riptWrappable* wrappable, v8::Handle<v8::String> key)
556 { 565 {
557 v8::Local<v8::Object> wrapper = wrappable->newLocalWrapper(isolate); 566 v8::Local<v8::Object> wrapper = wrappable->newLocalWrapper(isolate);
558 return wrapper.IsEmpty() ? v8::Local<v8::Value>() : wrapper->GetHiddenValue( key); 567 return wrapper.IsEmpty() ? v8::Local<v8::Value>() : wrapper->GetHiddenValue( key);
559 } 568 }
560 569
561 } // namespace WebCore 570 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698