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 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 return V8WorkerGlobalScope::toImpl(workerWrapper)->getExecutionContext()
; | 720 return V8WorkerGlobalScope::toImpl(workerWrapper)->getExecutionContext()
; |
721 ASSERT(s_toExecutionContextForModules); | 721 ASSERT(s_toExecutionContextForModules); |
722 return (*s_toExecutionContextForModules)(context); | 722 return (*s_toExecutionContextForModules)(context); |
723 } | 723 } |
724 | 724 |
725 void registerToExecutionContextForModules(ExecutionContext* (*toExecutionContext
ForModules)(v8::Local<v8::Context>)) | 725 void registerToExecutionContextForModules(ExecutionContext* (*toExecutionContext
ForModules)(v8::Local<v8::Context>)) |
726 { | 726 { |
727 s_toExecutionContextForModules = toExecutionContextForModules; | 727 s_toExecutionContextForModules = toExecutionContextForModules; |
728 } | 728 } |
729 | 729 |
| 730 void initializeOriginTrialsCore(v8::Local<v8::Context> context, const DOMWrapper
World& world) |
| 731 { |
| 732 DCHECK(!context.IsEmpty()); |
| 733 context->Enter(); |
| 734 // Initialization code for origin trials for core bindings should go here |
| 735 context->Exit(); |
| 736 } |
| 737 |
| 738 namespace { |
| 739 initializeOriginTrialsFunction s_initializeOriginTrialsFunction = &initializeOri
ginTrialsCore; |
| 740 } |
| 741 |
| 742 void initializeOriginTrials(v8::Local<v8::Context> context, const DOMWrapperWorl
d& world) |
| 743 { |
| 744 (*s_initializeOriginTrialsFunction)(context, world); |
| 745 } |
| 746 |
| 747 initializeOriginTrialsFunction setInitializeOriginTrialsFunction(initializeOrigi
nTrialsFunction fn) |
| 748 { |
| 749 initializeOriginTrialsFunction originalFunction = s_initializeOriginTrialsFu
nction; |
| 750 s_initializeOriginTrialsFunction = fn; |
| 751 return originalFunction; |
| 752 } |
| 753 |
730 ExecutionContext* currentExecutionContext(v8::Isolate* isolate) | 754 ExecutionContext* currentExecutionContext(v8::Isolate* isolate) |
731 { | 755 { |
732 return toExecutionContext(isolate->GetCurrentContext()); | 756 return toExecutionContext(isolate->GetCurrentContext()); |
733 } | 757 } |
734 | 758 |
735 ExecutionContext* enteredExecutionContext(v8::Isolate* isolate) | 759 ExecutionContext* enteredExecutionContext(v8::Isolate* isolate) |
736 { | 760 { |
737 ExecutionContext* context = toExecutionContext(isolate->GetEnteredContext())
; | 761 ExecutionContext* context = toExecutionContext(isolate->GetEnteredContext())
; |
738 if (!context) { | 762 if (!context) { |
739 // We don't always have an entered execution context, for example during
microtask callbacks from V8 | 763 // We don't always have an entered execution context, for example during
microtask callbacks from V8 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
920 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u
nwrap(data))); | 944 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u
nwrap(data))); |
921 } | 945 } |
922 | 946 |
923 v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value> value, v8::Isolate* iso
late) | 947 v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value> value, v8::Isolate* iso
late) |
924 { | 948 { |
925 v8CallOrCrash(value.As<v8::Object>()->SetIntegrityLevel(isolate->GetCurrentC
ontext(), v8::IntegrityLevel::kFrozen)); | 949 v8CallOrCrash(value.As<v8::Object>()->SetIntegrityLevel(isolate->GetCurrentC
ontext(), v8::IntegrityLevel::kFrozen)); |
926 return value; | 950 return value; |
927 } | 951 } |
928 | 952 |
929 } // namespace blink | 953 } // namespace blink |
OLD | NEW |