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

Side by Side Diff: Source/WebCore/bindings/dart/custom/DartDOMStringListCustom.cpp

Issue 10660025: Cleanup dart to string conversions. (Closed) Base URL: svn://svn.chromium.org/multivm/trunk/webkit
Patch Set: . Created 8 years, 6 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 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "DartDOMStringList.h" 6 #include "DartDOMStringList.h"
7 7
8 #include <wtf/Vector.h> 8 #include <wtf/Vector.h>
9 9
10 namespace WebCore { 10 namespace WebCore {
11 11
12 PassRefPtr<DOMStringList> DartDOMStringList::toNative(Dart_Handle handle, Dart_H andle& exception) 12 PassRefPtr<DOMStringList> DartDOMStringList::toNative(Dart_Handle handle, Dart_H andle& exception)
13 { 13 {
14 if (DartDOMWrapper::instanceOf<DartDOMStringList>(handle)) 14 if (DartDOMWrapper::instanceOf<DartDOMStringList>(handle))
15 return DartDOMWrapper::unwrapDartWrapper<DartDOMStringList>(handle, exce ption); 15 return DartDOMWrapper::unwrapDartWrapper<DartDOMStringList>(handle, exce ption);
16 16
17 Vector<Dart_Handle> elements; 17 Vector<Dart_Handle> elements;
18 DartUtilities::extractListElements(handle, exception, elements); 18 DartUtilities::extractListElements(handle, exception, elements);
19 if (exception) 19 if (exception)
20 return 0; 20 return 0;
21 21
22 RefPtr<DOMStringList> m_domStringList = DOMStringList::create(); 22 RefPtr<DOMStringList> m_domStringList = DOMStringList::create();
23 for (size_t i = 0; i < elements.size(); i++) { 23 for (size_t i = 0; i < elements.size(); i++) {
24 RefPtr<StringImpl> element = DartUtilities::toStringImpl(elements[i], Da rtUtilities::ConvertNone, exception); 24 DartStringAdapter element = DartUtilities::dartToString(elements[i], exc eption);
25 if (exception) 25 if (exception)
26 return 0; 26 return 0;
27 ASSERT(element.get()); 27 m_domStringList->append(element);
28 m_domStringList->append(element.get());
29 } 28 }
30 return m_domStringList.release(); 29 return m_domStringList.release();
31 } 30 }
32 31
33 } 32 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698