OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 124 |
125 ScriptState* state = 0; | 125 ScriptState* state = 0; |
126 if (context->isDocument()) { | 126 if (context->isDocument()) { |
127 state = mainWorldScriptState(static_cast<Document*>(context)->frame()); | 127 state = mainWorldScriptState(static_cast<Document*>(context)->frame()); |
128 } else { | 128 } else { |
129 ASSERT(context->isWorkerGlobalScope()); | 129 ASSERT(context->isWorkerGlobalScope()); |
130 state = scriptStateFromWorkerGlobalScope(toWorkerGlobalScope(context)); | 130 state = scriptStateFromWorkerGlobalScope(toWorkerGlobalScope(context)); |
131 } | 131 } |
132 ASSERT(state); | 132 ASSERT(state); |
133 | 133 |
134 v8::HandleScope handleScope; | 134 v8::Isolate* isolate = state->isolate(); |
| 135 v8::HandleScope handleScope(isolate); |
135 v8::Handle<v8::Context> v8Context = state->context(); | 136 v8::Handle<v8::Context> v8Context = state->context(); |
136 v8::Context::Scope scope(v8Context); | 137 v8::Context::Scope scope(v8Context); |
137 v8::Isolate* isolate = v8Context->GetIsolate(); | |
138 v8::Handle<v8::Value> args[] = { m_result.newLocal(isolate) }; | 138 v8::Handle<v8::Value> args[] = { m_result.newLocal(isolate) }; |
139 V8ScriptRunner::callFunction(m_callback.newLocal(isolate), context, m_receiv
er.newLocal(isolate), WTF_ARRAY_LENGTH(args), args); | 139 V8ScriptRunner::callFunction(m_callback.newLocal(isolate), context, m_receiv
er.newLocal(isolate), WTF_ARRAY_LENGTH(args), args); |
140 }; | 140 }; |
141 | 141 |
142 v8::Handle<v8::Value> postTask(v8::Handle<v8::Function> callback, v8::Handle<v8:
:Object> receiver, v8::Handle<v8::Value> value, v8::Isolate* isolate) | 142 v8::Handle<v8::Value> postTask(v8::Handle<v8::Function> callback, v8::Handle<v8:
:Object> receiver, v8::Handle<v8::Value> value, v8::Isolate* isolate) |
143 { | 143 { |
144 ScriptExecutionContext* scriptExecutionContext = getScriptExecutionContext()
; | 144 ScriptExecutionContext* scriptExecutionContext = getScriptExecutionContext()
; |
145 ASSERT(scriptExecutionContext && scriptExecutionContext->isContextThread()); | 145 ASSERT(scriptExecutionContext && scriptExecutionContext->isContextThread()); |
146 scriptExecutionContext->postTask(adoptPtr(new PromiseTask(callback, receiver
, value))); | 146 scriptExecutionContext->postTask(adoptPtr(new PromiseTask(callback, receiver
, value))); |
147 return v8::Undefined(isolate); | 147 return v8::Undefined(isolate); |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 v8::TryCatch trycatch; | 638 v8::TryCatch trycatch; |
639 v8::Handle<v8::Value> args[] = { result }; | 639 v8::Handle<v8::Value> args[] = { result }; |
640 V8ScriptRunner::callFunction(function, getScriptExecutionContext(), rece
iver, WTF_ARRAY_LENGTH(args), args); | 640 V8ScriptRunner::callFunction(function, getScriptExecutionContext(), rece
iver, WTF_ARRAY_LENGTH(args), args); |
641 } else { | 641 } else { |
642 ASSERT(mode == Asynchronous); | 642 ASSERT(mode == Asynchronous); |
643 postTask(function, receiver, result, isolate); | 643 postTask(function, receiver, result, isolate); |
644 } | 644 } |
645 } | 645 } |
646 | 646 |
647 } // namespace WebCore | 647 } // namespace WebCore |
OLD | NEW |