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

Side by Side Diff: Source/bindings/v8/custom/V8SVGLengthCustom.cpp

Issue 105693002: Generate a bit less code to handle failed arity checks. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 7 years 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); 69 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
70 SVGLengthContext lengthContext(wrapper->contextElement()); 70 SVGLengthContext lengthContext(wrapper->contextElement());
71 imp.setValue(static_cast<float>(value->NumberValue()), lengthContext, except ionState); 71 imp.setValue(static_cast<float>(value->NumberValue()), lengthContext, except ionState);
72 if (exceptionState.throwIfNeeded()) 72 if (exceptionState.throwIfNeeded())
73 return; 73 return;
74 wrapper->commitChange(); 74 wrapper->commitChange();
75 } 75 }
76 76
77 void V8SVGLength::convertToSpecifiedUnitsMethodCustom(const v8::FunctionCallback Info<v8::Value>& info) 77 void V8SVGLength::convertToSpecifiedUnitsMethodCustom(const v8::FunctionCallback Info<v8::Value>& info)
78 { 78 {
79 ExceptionState exceptionState(ExceptionState::ExecutionContext, "convertToSp ecifiedUnits", "SVGLength", info.Holder(), info.GetIsolate());
79 SVGPropertyTearOff<SVGLength>* wrapper = V8SVGLength::toNative(info.Holder() ); 80 SVGPropertyTearOff<SVGLength>* wrapper = V8SVGLength::toNative(info.Holder() );
80 if (wrapper->isReadOnly()) { 81 if (wrapper->isReadOnly()) {
81 setDOMException(NoModificationAllowedError, info.GetIsolate()); 82 exceptionState.throwDOMException(NoModificationAllowedError, "The length is read only.");
83 exceptionState.throwIfNeeded();
82 return; 84 return;
83 } 85 }
84 86
85 if (info.Length() < 1) { 87 if (info.Length() < 1) {
86 throwTypeError(ExceptionMessages::failedToExecute("convertToSpecifiedUni ts", "SVGLength", ExceptionMessages::notEnoughArguments(1, info.Length())), info .GetIsolate()); 88 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length()));
89 exceptionState.throwIfNeeded();
87 return; 90 return;
88 } 91 }
89 92
90 SVGLength& imp = wrapper->propertyReference(); 93 SVGLength& imp = wrapper->propertyReference();
91 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
92 V8TRYCATCH_VOID(int, unitType, toUInt32(info[0])); 94 V8TRYCATCH_VOID(int, unitType, toUInt32(info[0]));
93 SVGLengthContext lengthContext(wrapper->contextElement()); 95 SVGLengthContext lengthContext(wrapper->contextElement());
94 imp.convertToSpecifiedUnits(unitType, lengthContext, exceptionState); 96 imp.convertToSpecifiedUnits(unitType, lengthContext, exceptionState);
95 if (exceptionState.throwIfNeeded()) 97 if (exceptionState.throwIfNeeded())
96 return; 98 return;
97 wrapper->commitChange(); 99 wrapper->commitChange();
98 } 100 }
99 101
100 } // namespace WebCore 102 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/custom/V8MutationObserverCustom.cpp ('k') | Source/bindings/v8/custom/V8TextTrackCueCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698