| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 class ScriptSourceCode; | 46 class ScriptSourceCode; |
| 47 class ExecutionContext; | 47 class ExecutionContext; |
| 48 class ScriptStreamer; | 48 class ScriptStreamer; |
| 49 | 49 |
| 50 class CORE_EXPORT V8ScriptRunner final { | 50 class CORE_EXPORT V8ScriptRunner final { |
| 51 STATIC_ONLY(V8ScriptRunner); | 51 STATIC_ONLY(V8ScriptRunner); |
| 52 | 52 |
| 53 public: | 53 public: |
| 54 // For the following methods, the caller sites have to hold | 54 // For the following methods, the caller sites have to hold |
| 55 // a HandleScope and a ContextScope. | 55 // a HandleScope and a ContextScope. |
| 56 static v8::MaybeLocal<v8::Script> compileScript( | 56 static v8::MaybeLocal<v8::Script> compileScript(const ScriptSourceCode&, |
| 57 const ScriptSourceCode&, | 57 v8::Isolate*, |
| 58 v8::Isolate*, | 58 AccessControlStatus, |
| 59 AccessControlStatus = SharableCrossOrigin, | 59 V8CacheOptions); |
| 60 V8CacheOptions = V8CacheOptionsDefault); | 60 static v8::MaybeLocal<v8::Script> compileScript(const String&, |
| 61 static v8::MaybeLocal<v8::Script> compileScript( | 61 const String& fileName, |
| 62 const String&, | 62 const String& sourceMapUrl, |
| 63 const String& fileName, | 63 const TextPosition&, |
| 64 const String& sourceMapUrl, | 64 v8::Isolate*, |
| 65 const TextPosition&, | 65 CachedMetadataHandler*, |
| 66 v8::Isolate*, | 66 AccessControlStatus, |
| 67 CachedMetadataHandler* = nullptr, | 67 V8CacheOptions); |
| 68 AccessControlStatus = SharableCrossOrigin, | |
| 69 V8CacheOptions = V8CacheOptionsDefault); | |
| 70 // CachedMetadataHandler is set when metadata caching is supported. For | 68 // CachedMetadataHandler is set when metadata caching is supported. For |
| 71 // normal scripe resources, CachedMetadataHandler is from ScriptResource. | 69 // normal scripe resources, CachedMetadataHandler is from ScriptResource. |
| 72 // For worker script, ScriptResource is null but CachedMetadataHandler may be | 70 // For worker script, ScriptResource is null but CachedMetadataHandler may be |
| 73 // set. When ScriptStreamer is set, ScriptResource must be set. | 71 // set. When ScriptStreamer is set, ScriptResource must be set. |
| 74 static v8::MaybeLocal<v8::Script> compileScript( | 72 static v8::MaybeLocal<v8::Script> compileScript(v8::Local<v8::String>, |
| 75 v8::Local<v8::String>, | 73 const String& fileName, |
| 76 const String& fileName, | 74 const String& sourceMapUrl, |
| 77 const String& sourceMapUrl, | 75 const TextPosition&, |
| 78 const TextPosition&, | 76 v8::Isolate*, |
| 79 v8::Isolate*, | 77 ScriptResource*, |
| 80 ScriptResource* = nullptr, | 78 ScriptStreamer*, |
| 81 ScriptStreamer* = nullptr, | 79 CachedMetadataHandler*, |
| 82 CachedMetadataHandler* = nullptr, | 80 AccessControlStatus, |
| 83 AccessControlStatus = SharableCrossOrigin, | 81 V8CacheOptions); |
| 84 V8CacheOptions = V8CacheOptionsDefault); | |
| 85 static v8::MaybeLocal<v8::Module> compileModule(v8::Isolate*, | 82 static v8::MaybeLocal<v8::Module> compileModule(v8::Isolate*, |
| 86 const String& source, | 83 const String& source, |
| 87 const String& fileName); | 84 const String& fileName); |
| 88 static v8::MaybeLocal<v8::Value> runCompiledScript(v8::Isolate*, | 85 static v8::MaybeLocal<v8::Value> runCompiledScript(v8::Isolate*, |
| 89 v8::Local<v8::Script>, | 86 v8::Local<v8::Script>, |
| 90 ExecutionContext*); | 87 ExecutionContext*); |
| 91 static v8::MaybeLocal<v8::Value> compileAndRunInternalScript( | 88 static v8::MaybeLocal<v8::Value> compileAndRunInternalScript( |
| 92 v8::Local<v8::String>, | 89 v8::Local<v8::String>, |
| 93 v8::Isolate*, | 90 v8::Isolate*, |
| 94 const String& = String(), | 91 const String& = String(), |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 return v8::MaybeLocal<v8::Value>(); | 154 return v8::MaybeLocal<v8::Value>(); |
| 158 v8::Local<v8::Function> function = functionValue.As<v8::Function>(); | 155 v8::Local<v8::Function> function = functionValue.As<v8::Function>(); |
| 159 return V8ScriptRunner::callInternalFunction(function, undefined, numArgs, | 156 return V8ScriptRunner::callInternalFunction(function, undefined, numArgs, |
| 160 args, isolate); | 157 args, isolate); |
| 161 } | 158 } |
| 162 }; | 159 }; |
| 163 | 160 |
| 164 } // namespace blink | 161 } // namespace blink |
| 165 | 162 |
| 166 #endif // V8ScriptRunner_h | 163 #endif // V8ScriptRunner_h |
| OLD | NEW |