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

Side by Side Diff: Source/WebCore/bindings/dart/custom/DartCanvasRenderingContext2DCustom.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 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 90
91 void strokeStyleSetter(Dart_NativeArguments args) 91 void strokeStyleSetter(Dart_NativeArguments args)
92 { 92 {
93 DartApiScope dartApiScope; 93 DartApiScope dartApiScope;
94 Dart_Handle exception = 0; 94 Dart_Handle exception = 0;
95 { 95 {
96 CanvasRenderingContext2D* receiver = DartDOMWrapper::receiver<CanvasRend eringContext2D>(args); 96 CanvasRenderingContext2D* receiver = DartDOMWrapper::receiver<CanvasRend eringContext2D>(args);
97 97
98 Dart_Handle arg = Dart_GetNativeArgument(args, 1); 98 Dart_Handle arg = Dart_GetNativeArgument(args, 1);
99 if (Dart_IsString(arg)) { 99 if (Dart_IsString(arg)) {
100 const ParameterAdapter<String> color(Dart_GetNativeArgument(args, 1) ); 100 DartStringAdapter color = DartUtilities::dartToString(Dart_GetNative Argument(args, 1), exception);
101 if (!color.conversionSuccessful()) { 101 if (exception)
102 exception = color.exception();
103 goto fail; 102 goto fail;
104 }
105 103
106 receiver->setStrokeColor(color); 104 receiver->setStrokeColor(color);
107 return; 105 return;
108 } 106 }
109 107
110 receiver->setStrokeStyle(toCanvasStyle(arg)); 108 receiver->setStrokeStyle(toCanvasStyle(arg));
111 return; 109 return;
112 } 110 }
113 111
114 fail: 112 fail:
(...skipping 16 matching lines...) Expand all
131 129
132 void fillStyleSetter(Dart_NativeArguments args) 130 void fillStyleSetter(Dart_NativeArguments args)
133 { 131 {
134 DartApiScope dartApiScope; 132 DartApiScope dartApiScope;
135 Dart_Handle exception = 0; 133 Dart_Handle exception = 0;
136 { 134 {
137 CanvasRenderingContext2D* receiver = DartDOMWrapper::receiver<CanvasRend eringContext2D>(args); 135 CanvasRenderingContext2D* receiver = DartDOMWrapper::receiver<CanvasRend eringContext2D>(args);
138 136
139 Dart_Handle arg = Dart_GetNativeArgument(args, 1); 137 Dart_Handle arg = Dart_GetNativeArgument(args, 1);
140 if (Dart_IsString(arg)) { 138 if (Dart_IsString(arg)) {
141 const ParameterAdapter<String> color(arg); 139 DartStringAdapter color = DartUtilities::dartToString(arg, exception );
142 if (!color.conversionSuccessful()) { 140 if (exception)
143 exception = color.exception();
144 goto fail; 141 goto fail;
145 }
146 142
147 receiver->setFillColor(color); 143 receiver->setFillColor(color);
148 return; 144 return;
149 } 145 }
150 146
151 receiver->setFillStyle(toCanvasStyle(arg)); 147 receiver->setFillStyle(toCanvasStyle(arg));
152 return; 148 return;
153 } 149 }
154 150
155 fail: 151 fail:
156 Dart_ThrowException(exception); 152 Dart_ThrowException(exception);
157 ASSERT_NOT_REACHED(); 153 ASSERT_NOT_REACHED();
158 } 154 }
159 155
160 } // namespace DartCanvasRenderingContext2DInternal 156 } // namespace DartCanvasRenderingContext2DInternal
161 157
162 } // namespace WebCore 158 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/WebCore/bindings/dart/DartUtilities.cpp ('k') | Source/WebCore/bindings/dart/custom/DartDOMStringListCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698