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

Side by Side Diff: third_party/WebKit/WebCore/bindings/js/JSWorkerContextCustom.cpp

Issue 20076: WebKit merge 40500:40539 [WebKit side] (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 10 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 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 13 matching lines...) Expand all
24 */ 24 */
25 25
26 #include "config.h" 26 #include "config.h"
27 27
28 #if ENABLE(WORKERS) 28 #if ENABLE(WORKERS)
29 29
30 #include "JSWorkerContext.h" 30 #include "JSWorkerContext.h"
31 31
32 #include "JSDOMBinding.h" 32 #include "JSDOMBinding.h"
33 #include "JSEventListener.h" 33 #include "JSEventListener.h"
34 #include "ScheduledAction.h"
34 #include "WorkerContext.h" 35 #include "WorkerContext.h"
35 36
36 using namespace JSC; 37 using namespace JSC;
37 38
38 namespace WebCore { 39 namespace WebCore {
39 40
40 bool JSWorkerContext::customGetOwnPropertySlot(JSC::ExecState* exec, const JSC:: Identifier& propertyName, JSC::PropertySlot& slot) 41 bool JSWorkerContext::customGetOwnPropertySlot(JSC::ExecState* exec, const JSC:: Identifier& propertyName, JSC::PropertySlot& slot)
41 { 42 {
42 // Look for overrides before looking at any of our own properties. 43 // Look for overrides before looking at any of our own properties.
43 if (JSGlobalObject::getOwnPropertySlot(exec, propertyName, slot)) 44 if (JSGlobalObject::getOwnPropertySlot(exec, propertyName, slot))
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 87
87 JSValuePtr JSWorkerContext::removeEventListener(ExecState* exec, const ArgList& args) 88 JSValuePtr JSWorkerContext::removeEventListener(ExecState* exec, const ArgList& args)
88 { 89 {
89 JSUnprotectedEventListener* listener = findJSUnprotectedEventListener(exec, args.at(exec, 1)); 90 JSUnprotectedEventListener* listener = findJSUnprotectedEventListener(exec, args.at(exec, 1));
90 if (!listener) 91 if (!listener)
91 return jsUndefined(); 92 return jsUndefined();
92 impl()->removeEventListener(args.at(exec, 0).toString(exec), listener, args. at(exec, 2).toBoolean(exec)); 93 impl()->removeEventListener(args.at(exec, 0).toString(exec), listener, args. at(exec, 2).toBoolean(exec));
93 return jsUndefined(); 94 return jsUndefined();
94 } 95 }
95 96
97 static JSValuePtr setTimeoutOrInterval(ExecState* exec, WorkerContext* workerCon text, const ArgList& args, bool singleShot)
98 {
99 JSValuePtr v = args.at(exec, 0);
100 int delay = args.at(exec, 1).toInt32(exec);
101 if (v.isString())
102 return jsNumber(exec, workerContext->installTimeout(new ScheduledAction( asString(v)->value()), delay, singleShot));
103 CallData callData;
104 if (v.getCallData(callData) == CallTypeNone)
105 return jsUndefined();
106 ArgList argsTail;
107 args.getSlice(2, argsTail);
108 return jsNumber(exec, workerContext->installTimeout(new ScheduledAction(exec , v, argsTail), delay, singleShot));
109 }
110
111 JSValuePtr JSWorkerContext::setTimeout(ExecState* exec, const ArgList& args)
112 {
113 return setTimeoutOrInterval(exec, impl(), args, true);
114 }
115
116 JSValuePtr JSWorkerContext::clearTimeout(ExecState* exec, const ArgList& args)
117 {
118 impl()->removeTimeout(args.at(exec, 0).toInt32(exec));
119 return jsUndefined();
120 }
121
122 JSValuePtr JSWorkerContext::setInterval(ExecState* exec, const ArgList& args)
123 {
124 return setTimeoutOrInterval(exec, impl(), args, false);
125 }
126
127 JSValuePtr JSWorkerContext::clearInterval(ExecState* exec, const ArgList& args)
128 {
129 impl()->removeTimeout(args.at(exec, 0).toInt32(exec));
130 return jsUndefined();
131 }
132
96 } // namespace WebCore 133 } // namespace WebCore
97 134
98 #endif // ENABLE(WORKERS) 135 #endif // ENABLE(WORKERS)
OLDNEW
« no previous file with comments | « third_party/WebKit/WebCore/bindings/js/JSLocationCustom.cpp ('k') | third_party/WebKit/WebCore/bindings/js/ScriptController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698