OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 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 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 ExecutionContext* (*s_toExecutionContextForModules)(v8::Local<v8::Context>) = nu
llptr; | 704 ExecutionContext* (*s_toExecutionContextForModules)(v8::Local<v8::Context>) = nu
llptr; |
705 } | 705 } |
706 | 706 |
707 ExecutionContext* toExecutionContext(v8::Local<v8::Context> context) | 707 ExecutionContext* toExecutionContext(v8::Local<v8::Context> context) |
708 { | 708 { |
709 if (context.IsEmpty()) | 709 if (context.IsEmpty()) |
710 return 0; | 710 return 0; |
711 v8::Local<v8::Object> global = context->Global(); | 711 v8::Local<v8::Object> global = context->Global(); |
712 v8::Local<v8::Object> windowWrapper = V8Window::findInstanceInPrototypeChain
(global, context->GetIsolate()); | 712 v8::Local<v8::Object> windowWrapper = V8Window::findInstanceInPrototypeChain
(global, context->GetIsolate()); |
713 if (!windowWrapper.IsEmpty()) | 713 if (!windowWrapper.IsEmpty()) |
714 return V8Window::toImpl(windowWrapper)->executionContext(); | 714 return V8Window::toImpl(windowWrapper)->getExecutionContext(); |
715 v8::Local<v8::Object> workerWrapper = V8WorkerGlobalScope::findInstanceInPro
totypeChain(global, context->GetIsolate()); | 715 v8::Local<v8::Object> workerWrapper = V8WorkerGlobalScope::findInstanceInPro
totypeChain(global, context->GetIsolate()); |
716 if (!workerWrapper.IsEmpty()) | 716 if (!workerWrapper.IsEmpty()) |
717 return V8WorkerGlobalScope::toImpl(workerWrapper)->executionContext(); | 717 return V8WorkerGlobalScope::toImpl(workerWrapper)->getExecutionContext()
; |
718 ASSERT(s_toExecutionContextForModules); | 718 ASSERT(s_toExecutionContextForModules); |
719 return (*s_toExecutionContextForModules)(context); | 719 return (*s_toExecutionContextForModules)(context); |
720 } | 720 } |
721 | 721 |
722 void registerToExecutionContextForModules(ExecutionContext* (*toExecutionContext
ForModules)(v8::Local<v8::Context>)) | 722 void registerToExecutionContextForModules(ExecutionContext* (*toExecutionContext
ForModules)(v8::Local<v8::Context>)) |
723 { | 723 { |
724 s_toExecutionContextForModules = toExecutionContextForModules; | 724 s_toExecutionContextForModules = toExecutionContextForModules; |
725 } | 725 } |
726 | 726 |
727 ExecutionContext* currentExecutionContext(v8::Isolate* isolate) | 727 ExecutionContext* currentExecutionContext(v8::Isolate* isolate) |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
780 } | 780 } |
781 | 781 |
782 v8::Local<v8::Context> toV8Context(ExecutionContext* context, DOMWrapperWorld& w
orld) | 782 v8::Local<v8::Context> toV8Context(ExecutionContext* context, DOMWrapperWorld& w
orld) |
783 { | 783 { |
784 ASSERT(context); | 784 ASSERT(context); |
785 if (context->isDocument()) { | 785 if (context->isDocument()) { |
786 if (LocalFrame* frame = toDocument(context)->frame()) | 786 if (LocalFrame* frame = toDocument(context)->frame()) |
787 return toV8Context(frame, world); | 787 return toV8Context(frame, world); |
788 } else if (context->isWorkerGlobalScope()) { | 788 } else if (context->isWorkerGlobalScope()) { |
789 if (WorkerOrWorkletScriptController* script = toWorkerOrWorkletGlobalSco
pe(context)->scriptController()) { | 789 if (WorkerOrWorkletScriptController* script = toWorkerOrWorkletGlobalSco
pe(context)->scriptController()) { |
790 if (script->scriptState()->contextIsValid()) | 790 if (script->getScriptState()->contextIsValid()) |
791 return script->scriptState()->context(); | 791 return script->getScriptState()->context(); |
792 } | 792 } |
793 } | 793 } |
794 return v8::Local<v8::Context>(); | 794 return v8::Local<v8::Context>(); |
795 } | 795 } |
796 | 796 |
797 v8::Local<v8::Context> toV8Context(Frame* frame, DOMWrapperWorld& world) | 797 v8::Local<v8::Context> toV8Context(Frame* frame, DOMWrapperWorld& world) |
798 { | 798 { |
799 if (!frame) | 799 if (!frame) |
800 return v8::Local<v8::Context>(); | 800 return v8::Local<v8::Context>(); |
801 v8::Local<v8::Context> context = toV8ContextEvenIfDetached(frame, world); | 801 v8::Local<v8::Context> context = toV8ContextEvenIfDetached(frame, world); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
958 { | 958 { |
959 v8::Local<v8::Value> data = info.Data(); | 959 v8::Local<v8::Value> data = info.Data(); |
960 ASSERT(data->IsExternal()); | 960 ASSERT(data->IsExternal()); |
961 V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->Cre
ationContext()); | 961 V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->Cre
ationContext()); |
962 if (!perContextData) | 962 if (!perContextData) |
963 return; | 963 return; |
964 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u
nwrap(data))); | 964 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u
nwrap(data))); |
965 } | 965 } |
966 | 966 |
967 } // namespace blink | 967 } // namespace blink |
OLD | NEW |