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 26 matching lines...) Expand all Loading... |
37 #include "DOMWindow.h" | 37 #include "DOMWindow.h" |
38 #include "ExceptionCode.h" | 38 #include "ExceptionCode.h" |
39 #include "Frame.h" | 39 #include "Frame.h" |
40 #include "FrameLoadRequest.h" | 40 #include "FrameLoadRequest.h" |
41 #include "FrameView.h" | 41 #include "FrameView.h" |
42 #include "HTMLCollection.h" | 42 #include "HTMLCollection.h" |
43 #include "HTMLDocument.h" | 43 #include "HTMLDocument.h" |
44 #include "MediaPlayer.h" | 44 #include "MediaPlayer.h" |
45 #include "Page.h" | 45 #include "Page.h" |
46 #include "PlatformScreen.h" | 46 #include "PlatformScreen.h" |
47 #include "ScheduledAction.h" | |
48 #include "ScriptSourceCode.h" | 47 #include "ScriptSourceCode.h" |
49 #include "SerializedScriptValue.h" | 48 #include "SerializedScriptValue.h" |
50 #include "Settings.h" | 49 #include "Settings.h" |
51 #include "SharedWorkerRepository.h" | 50 #include "SharedWorkerRepository.h" |
52 #include "Storage.h" | 51 #include "Storage.h" |
53 #include "V8Binding.h" | 52 #include "V8Binding.h" |
54 #include "V8BindingMacros.h" | 53 #include "V8BindingMacros.h" |
55 #include "V8BindingState.h" | 54 #include "V8BindingState.h" |
56 #include "V8EventListener.h" | 55 #include "V8EventListener.h" |
57 #include "V8GCForContextDispose.h" | 56 #include "V8GCForContextDispose.h" |
58 #include "V8HiddenPropertyName.h" | 57 #include "V8HiddenPropertyName.h" |
59 #include "V8HTMLAudioElementConstructor.h" | 58 #include "V8HTMLAudioElementConstructor.h" |
60 #include "V8HTMLCollection.h" | 59 #include "V8HTMLCollection.h" |
61 #include "V8HTMLImageElementConstructor.h" | 60 #include "V8HTMLImageElementConstructor.h" |
62 #include "V8HTMLOptionElementConstructor.h" | 61 #include "V8HTMLOptionElementConstructor.h" |
63 #include "V8MessagePortCustom.h" | 62 #include "V8MessagePortCustom.h" |
64 #include "V8Node.h" | 63 #include "V8Node.h" |
65 #include "V8Proxy.h" | 64 #include "V8Proxy.h" |
| 65 #include "V8ScheduledAction.h" |
66 #include "V8Utilities.h" | 66 #include "V8Utilities.h" |
67 #if ENABLE(WEB_SOCKETS) | 67 #if ENABLE(WEB_SOCKETS) |
68 #include "WebSocket.h" | 68 #include "WebSocket.h" |
69 #endif | 69 #endif |
70 #include "WindowFeatures.h" | 70 #include "WindowFeatures.h" |
71 | 71 |
72 namespace WebCore { | 72 namespace WebCore { |
73 | 73 |
74 v8::Handle<v8::Value> WindowSetTimeoutImpl(const v8::Arguments& args, bool singl
eShot) | 74 v8::Handle<v8::Value> WindowSetTimeoutImpl(const v8::Arguments& args, bool singl
eShot) |
75 { | 75 { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 int paramCount = argumentCount >= 2 ? argumentCount - 2 : 0; | 119 int paramCount = argumentCount >= 2 ? argumentCount - 2 : 0; |
120 v8::Local<v8::Value>* params = 0; | 120 v8::Local<v8::Value>* params = 0; |
121 if (paramCount > 0) { | 121 if (paramCount > 0) { |
122 params = new v8::Local<v8::Value>[paramCount]; | 122 params = new v8::Local<v8::Value>[paramCount]; |
123 for (int i = 0; i < paramCount; i++) | 123 for (int i = 0; i < paramCount; i++) |
124 // parameters must be globalized | 124 // parameters must be globalized |
125 params[i] = args[i+2]; | 125 params[i] = args[i+2]; |
126 } | 126 } |
127 | 127 |
128 // params is passed to action, and released in action's destructor | 128 // params is passed to action, and released in action's destructor |
129 OwnPtr<ScheduledAction> action = adoptPtr(new ScheduledAction(V8Proxy::c
ontext(imp->frame()), v8::Handle<v8::Function>::Cast(function), paramCount, para
ms)); | 129 OwnPtr<ScheduledAction> action = adoptPtr(new V8ScheduledAction(V8Proxy:
:context(imp->frame()), v8::Handle<v8::Function>::Cast(function), paramCount, pa
rams)); |
130 | 130 |
131 // FIXME: We should use OwnArrayPtr for params. | 131 // FIXME: We should use OwnArrayPtr for params. |
132 delete[] params; | 132 delete[] params; |
133 | 133 |
134 id = DOMTimer::install(scriptContext, action.release(), timeout, singleS
hot); | 134 id = DOMTimer::install(scriptContext, action.release(), timeout, singleS
hot); |
135 } else { | 135 } else { |
136 if (imp->document() && !imp->document()->contentSecurityPolicy()->allowE
val()) | 136 if (imp->document() && !imp->document()->contentSecurityPolicy()->allowE
val()) |
137 return v8::Integer::New(0); | 137 return v8::Integer::New(0); |
138 id = DOMTimer::install(scriptContext, adoptPtr(new ScheduledAction(V8Pro
xy::context(imp->frame()), functionString)), timeout, singleShot); | 138 id = DOMTimer::install(scriptContext, adoptPtr(new V8ScheduledAction(V8P
roxy::context(imp->frame()), functionString)), timeout, singleShot); |
139 } | 139 } |
140 | 140 |
141 // Try to do the idle notification before the timeout expires to get better | 141 // Try to do the idle notification before the timeout expires to get better |
142 // use of any idle time. Aim for the middle of the interval for simplicity. | 142 // use of any idle time. Aim for the middle of the interval for simplicity. |
143 if (timeout > 0) { | 143 if (timeout > 0) { |
144 double maximumFireInterval = static_cast<double>(timeout) / 1000 / 2; | 144 double maximumFireInterval = static_cast<double>(timeout) / 1000 / 2; |
145 V8GCForContextDispose::instance().notifyIdleSooner(maximumFireInterval); | 145 V8GCForContextDispose::instance().notifyIdleSooner(maximumFireInterval); |
146 } | 146 } |
147 | 147 |
148 return v8::Integer::New(id); | 148 return v8::Integer::New(id); |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 v8::Handle<v8::Context> context = V8Proxy::context(frame); | 628 v8::Handle<v8::Context> context = V8Proxy::context(frame); |
629 if (context.IsEmpty()) | 629 if (context.IsEmpty()) |
630 return v8::Handle<v8::Object>(); | 630 return v8::Handle<v8::Object>(); |
631 | 631 |
632 v8::Handle<v8::Object> global = context->Global(); | 632 v8::Handle<v8::Object> global = context->Global(); |
633 ASSERT(!global.IsEmpty()); | 633 ASSERT(!global.IsEmpty()); |
634 return global; | 634 return global; |
635 } | 635 } |
636 | 636 |
637 } // namespace WebCore | 637 } // namespace WebCore |
OLD | NEW |