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

Side by Side Diff: Source/WebCore/bindings/dart/DartDOMWrapper.cpp

Issue 10453030: Use newly added Dart_New for wrappers instantiation. (Closed) Base URL: svn://svn.chromium.org/multivm/trunk/webkit
Patch Set: . Created 8 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011, Google Inc. 1 // Copyright 2011, Google Inc.
2 // All rights reserved. 2 // 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 28 matching lines...) Expand all
39 #include "HTMLFormControlElement.h" 39 #include "HTMLFormControlElement.h"
40 #include "LabelableElement.h" 40 #include "LabelableElement.h"
41 41
42 #include <stdio.h> 42 #include <stdio.h>
43 #include <wtf/text/WTFString.h> 43 #include <wtf/text/WTFString.h>
44 44
45 namespace WebCore { 45 namespace WebCore {
46 46
47 Dart_Handle DartDOMWrapper::instantiateWrapper(const char* className) 47 Dart_Handle DartDOMWrapper::instantiateWrapper(const char* className)
48 { 48 {
49 // FIXME: this all is very ugly, but we're blocked by API here.
50 // In this case we need an API to invoke ctor, or even better,
51 // create an instance without exposing constructor at all.
52 String factoryMethodName = String("_create") + className;
53 Dart_Handle html = DartUtilities::htmlLibraryForCurrentIsolate(); 49 Dart_Handle html = DartUtilities::htmlLibraryForCurrentIsolate();
54 ASSERT(!Dart_IsError(html)); 50 ASSERT(!Dart_IsError(html));
55 51
56 Dart_Handle cls = Dart_GetClass(html, Dart_NewString(className)); 52 Dart_Handle cls = Dart_GetClass(html, Dart_NewString(className));
57 ASSERT(!Dart_IsError(cls)); 53 ASSERT(!Dart_IsError(cls));
58 54
59 Dart_Handle instance = Dart_Invoke(cls, DartUtilities::stringToDartString(fa ctoryMethodName), 0, 0); 55 Dart_Handle instance = Dart_New(cls, Dart_Null(), 0, 0);
60 ASSERT(!Dart_IsError(instance)); 56 ASSERT(!Dart_IsError(instance));
57
61 return instance; 58 return instance;
62 } 59 }
63 60
64 bool DartDOMWrapper::instanceOf(const char* className, Dart_Handle wrapper) 61 bool DartDOMWrapper::instanceOf(const char* className, Dart_Handle wrapper)
65 { 62 {
66 // FIXME: Cache classes in the corresponding bindings class. Requires persis tent handles. 63 // FIXME: Cache classes in the corresponding bindings class. Requires persis tent handles.
67 Dart_Handle html = DartUtilities::htmlLibraryForCurrentIsolate(); 64 Dart_Handle html = DartUtilities::htmlLibraryForCurrentIsolate();
68 ASSERT(!Dart_IsError(html)); 65 ASSERT(!Dart_IsError(html));
69 66
70 Dart_Handle cls = Dart_GetClass(html, Dart_NewString(className)); 67 Dart_Handle cls = Dart_GetClass(html, Dart_NewString(className));
(...skipping 25 matching lines...) Expand all
96 DOM_EXCEPTION_INTERFACES_FOR_EACH(TRY_TO_CREATE_EXCEPTION) 93 DOM_EXCEPTION_INTERFACES_FOR_EACH(TRY_TO_CREATE_EXCEPTION)
97 } 94 }
98 95
99 ASSERT_NOT_REACHED(); 96 ASSERT_NOT_REACHED();
100 return Dart_NewString("Unknown WebCore exception"); 97 return Dart_NewString("Unknown WebCore exception");
101 } 98 }
102 99
103 #undef TRY_TO_CREATE_EXCEPTION 100 #undef TRY_TO_CREATE_EXCEPTION
104 101
105 } 102 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698