OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009, 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2009, 2011 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 v8::Local<v8::Value>* params = 0; | 114 v8::Local<v8::Value>* params = 0; |
115 if (paramCount > 0) { | 115 if (paramCount > 0) { |
116 params = new v8::Local<v8::Value>[paramCount]; | 116 params = new v8::Local<v8::Value>[paramCount]; |
117 for (int i = 0; i < paramCount; i++) | 117 for (int i = 0; i < paramCount; i++) |
118 // parameters must be globalized | 118 // parameters must be globalized |
119 params[i] = args[i+2]; | 119 params[i] = args[i+2]; |
120 } | 120 } |
121 | 121 |
122 // params is passed to action, and released in action's destructor | 122 // params is passed to action, and released in action's destructor |
123 ASSERT(imp->frame()); | 123 ASSERT(imp->frame()); |
124 OwnPtr<ScheduledAction> action = adoptPtr(new ScheduledAction(imp->frame
()->script()->currentWorldContext(), v8::Handle<v8::Function>::Cast(function), p
aramCount, params)); | 124 OwnPtr<ScheduledAction> action = adoptPtr(new ScheduledAction(imp->frame
()->script()->currentWorldContext(), v8::Handle<v8::Function>::Cast(function), p
aramCount, params, args.GetIsolate())); |
125 | 125 |
126 // FIXME: We should use OwnArrayPtr for params. | 126 // FIXME: We should use OwnArrayPtr for params. |
127 delete[] params; | 127 delete[] params; |
128 | 128 |
129 id = DOMTimer::install(scriptContext, action.release(), timeout, singleS
hot); | 129 id = DOMTimer::install(scriptContext, action.release(), timeout, singleS
hot); |
130 } else { | 130 } else { |
131 if (imp->document() && !imp->document()->contentSecurityPolicy()->allowE
val()) | 131 if (imp->document() && !imp->document()->contentSecurityPolicy()->allowE
val()) |
132 return v8Integer(0, args.GetIsolate()); | 132 return v8Integer(0, args.GetIsolate()); |
133 ASSERT(imp->frame()); | 133 ASSERT(imp->frame()); |
134 id = DOMTimer::install(scriptContext, adoptPtr(new ScheduledAction(imp->
frame()->script()->currentWorldContext(), functionString)), timeout, singleShot)
; | 134 id = DOMTimer::install(scriptContext, adoptPtr(new ScheduledAction(imp->
frame()->script()->currentWorldContext(), functionString, KURL(), args.GetIsolat
e())), timeout, singleShot); |
135 } | 135 } |
136 | 136 |
137 // Try to do the idle notification before the timeout expires to get better | 137 // Try to do the idle notification before the timeout expires to get better |
138 // use of any idle time. Aim for the middle of the interval for simplicity. | 138 // use of any idle time. Aim for the middle of the interval for simplicity. |
139 if (timeout > 0) { | 139 if (timeout > 0) { |
140 double maximumFireInterval = static_cast<double>(timeout) / 1000 / 2; | 140 double maximumFireInterval = static_cast<double>(timeout) / 1000 / 2; |
141 V8GCForContextDispose::instance().notifyIdleSooner(maximumFireInterval); | 141 V8GCForContextDispose::instance().notifyIdleSooner(maximumFireInterval); |
142 } | 142 } |
143 | 143 |
144 return v8Integer(id, args.GetIsolate()); | 144 return v8Integer(id, args.GetIsolate()); |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 v8::Handle<v8::Context> context = frame->script()->currentWorldContext(); | 596 v8::Handle<v8::Context> context = frame->script()->currentWorldContext(); |
597 if (context.IsEmpty()) | 597 if (context.IsEmpty()) |
598 return v8Undefined(); | 598 return v8Undefined(); |
599 | 599 |
600 v8::Handle<v8::Object> global = context->Global(); | 600 v8::Handle<v8::Object> global = context->Global(); |
601 ASSERT(!global.IsEmpty()); | 601 ASSERT(!global.IsEmpty()); |
602 return global; | 602 return global; |
603 } | 603 } |
604 | 604 |
605 } // namespace WebCore | 605 } // namespace WebCore |
OLD | NEW |