Chromium Code Reviews| Index: Source/core/page/DOMWindowTimers.cpp |
| diff --git a/Source/core/page/DOMWindowBase64.cpp b/Source/core/page/DOMWindowTimers.cpp |
| similarity index 66% |
| copy from Source/core/page/DOMWindowBase64.cpp |
| copy to Source/core/page/DOMWindowTimers.cpp |
| index 7d3252ba2b935162078a5703378344a8d8e6a764..499a7981588b53667b198322dfdde02062f07e74 100644 |
| --- a/Source/core/page/DOMWindowBase64.cpp |
| +++ b/Source/core/page/DOMWindowTimers.cpp |
| @@ -31,46 +31,37 @@ |
| */ |
| #include "config.h" |
| -#include "core/page/DOMWindowBase64.h" |
| +#include "core/page/DOMWindowTimers.h" |
| -#include "wtf/text/Base64.h" |
| +#include "core/dom/EventTarget.h" |
| +#include "core/page/DOMTimer.h" |
| namespace WebCore { |
| -namespace DOMWindowBase64 { |
| +namespace DOMWindowTimers { |
|
haraken
2013/07/19 11:25:44
Why do you use a namespace instead of a class? I e
|
| -String btoa(void*, const String& stringToEncode, ExceptionCode& ec) |
| +int setTimeout(EventTarget* eventTarget, PassOwnPtr<ScheduledAction> action, int timeout) |
| { |
| - if (stringToEncode.isNull()) |
| - return String(); |
| - |
| - if (!stringToEncode.containsOnlyLatin1()) { |
| - ec = InvalidCharacterError; |
| - return String(); |
| - } |
| - |
| - return base64Encode(stringToEncode.latin1()); |
| + return DOMTimer::install(eventTarget->scriptExecutionContext(), action, timeout, true); |
| } |
| -String atob(void*, const String& encodedString, ExceptionCode& ec) |
| +int setInterval(EventTarget* eventTarget, PassOwnPtr<ScheduledAction> action, int timeout) |
| { |
| - if (encodedString.isNull()) |
| - return String(); |
| - |
| - if (!encodedString.containsOnlyLatin1()) { |
| - ec = InvalidCharacterError; |
| - return String(); |
| - } |
| + return DOMTimer::install(eventTarget->scriptExecutionContext(), action, timeout, false); |
| +} |
| - Vector<char> out; |
| - if (!base64Decode(encodedString, out, Base64FailOnInvalidCharacter, Base64StrictPaddingValidation)) { |
| - ec = InvalidCharacterError; |
| - return String(); |
| - } |
| +void clearTimeout(EventTarget* eventTarget, int timeoutID) |
| +{ |
| + if (ScriptExecutionContext* context = eventTarget->scriptExecutionContext()) |
| + DOMTimer::removeByID(context, timeoutID); |
| +} |
| - return String(out.data(), out.size()); |
| +void clearInterval(EventTarget* eventTarget, int timeoutID) |
| +{ |
| + if (ScriptExecutionContext* context = eventTarget->scriptExecutionContext()) |
| + DOMTimer::removeByID(context, timeoutID); |
| } |
| -} // namespace DOMWindowBase64 |
| +} // namespace DOMWindowTimers |
| } // namespace WebCore |