OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007-2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2007-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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 { | 108 { |
109 if (!m_scriptState->contextIsValid()) { | 109 if (!m_scriptState->contextIsValid()) { |
110 WTF_LOG(Timers, "ScheduledAction::execute %p: context is empty", this); | 110 WTF_LOG(Timers, "ScheduledAction::execute %p: context is empty", this); |
111 return; | 111 return; |
112 } | 112 } |
113 | 113 |
114 TRACE_EVENT0("v8", "ScheduledAction::execute"); | 114 TRACE_EVENT0("v8", "ScheduledAction::execute"); |
115 ScriptState::Scope scope(m_scriptState.get()); | 115 ScriptState::Scope scope(m_scriptState.get()); |
116 if (!m_function.isEmpty()) { | 116 if (!m_function.isEmpty()) { |
117 WTF_LOG(Timers, "ScheduledAction::execute %p: have function", this); | 117 WTF_LOG(Timers, "ScheduledAction::execute %p: have function", this); |
118 Vector<v8::Handle<v8::Value> > info; | 118 Vector<v8::Handle<v8::Value>> info; |
119 createLocalHandlesForArgs(&info); | 119 createLocalHandlesForArgs(&info); |
120 frame->script().callFunction(m_function.newLocal(m_scriptState->isolate(
)), m_scriptState->context()->Global(), info.size(), info.data()); | 120 frame->script().callFunction(m_function.newLocal(m_scriptState->isolate(
)), m_scriptState->context()->Global(), info.size(), info.data()); |
121 } else { | 121 } else { |
122 WTF_LOG(Timers, "ScheduledAction::execute %p: executing from source", th
is); | 122 WTF_LOG(Timers, "ScheduledAction::execute %p: executing from source", th
is); |
123 frame->script().executeScriptAndReturnValue(m_scriptState->context(), Sc
riptSourceCode(m_code)); | 123 frame->script().executeScriptAndReturnValue(m_scriptState->context(), Sc
riptSourceCode(m_code)); |
124 } | 124 } |
125 | 125 |
126 // The frame might be invalid at this point because JavaScript could have re
leased it. | 126 // The frame might be invalid at this point because JavaScript could have re
leased it. |
127 } | 127 } |
128 | 128 |
129 void ScheduledAction::execute(WorkerGlobalScope* worker) | 129 void ScheduledAction::execute(WorkerGlobalScope* worker) |
130 { | 130 { |
131 ASSERT(worker->thread()->isCurrentThread()); | 131 ASSERT(worker->thread()->isCurrentThread()); |
132 ASSERT(m_scriptState->contextIsValid()); | 132 ASSERT(m_scriptState->contextIsValid()); |
133 if (!m_function.isEmpty()) { | 133 if (!m_function.isEmpty()) { |
134 ScriptState::Scope scope(m_scriptState.get()); | 134 ScriptState::Scope scope(m_scriptState.get()); |
135 Vector<v8::Handle<v8::Value> > info; | 135 Vector<v8::Handle<v8::Value>> info; |
136 createLocalHandlesForArgs(&info); | 136 createLocalHandlesForArgs(&info); |
137 V8ScriptRunner::callFunction(m_function.newLocal(m_scriptState->isolate(
)), worker, m_scriptState->context()->Global(), info.size(), info.data(), m_scri
ptState->isolate()); | 137 V8ScriptRunner::callFunction(m_function.newLocal(m_scriptState->isolate(
)), worker, m_scriptState->context()->Global(), info.size(), info.data(), m_scri
ptState->isolate()); |
138 } else { | 138 } else { |
139 worker->script()->evaluate(m_code); | 139 worker->script()->evaluate(m_code); |
140 } | 140 } |
141 } | 141 } |
142 | 142 |
143 void ScheduledAction::createLocalHandlesForArgs(Vector<v8::Handle<v8::Value> >*
handles) | 143 void ScheduledAction::createLocalHandlesForArgs(Vector<v8::Handle<v8::Value>>* h
andles) |
144 { | 144 { |
145 handles->reserveCapacity(m_info.Size()); | 145 handles->reserveCapacity(m_info.Size()); |
146 for (size_t i = 0; i < m_info.Size(); ++i) | 146 for (size_t i = 0; i < m_info.Size(); ++i) |
147 handles->append(m_info.Get(i)); | 147 handles->append(m_info.Get(i)); |
148 } | 148 } |
149 | 149 |
150 } // namespace blink | 150 } // namespace blink |
OLD | NEW |