| 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 v8::Local<v8::Value> (&args)[N]) { | 136 v8::Local<v8::Value> (&args)[N]) { |
| 137 return CallExtraHelper(script_state, name, N, args).ToLocalChecked(); | 137 return CallExtraHelper(script_state, name, N, args).ToLocalChecked(); |
| 138 } | 138 } |
| 139 | 139 |
| 140 // Use V8ThrowException instead of this function unless absolutely needed. | 140 // Use V8ThrowException instead of this function unless absolutely needed. |
| 141 static void ThrowException(v8::Isolate*, | 141 static void ThrowException(v8::Isolate*, |
| 142 v8::Local<v8::Value> exception, | 142 v8::Local<v8::Value> exception, |
| 143 const v8::ScriptOrigin&); | 143 const v8::ScriptOrigin&); |
| 144 | 144 |
| 145 private: | 145 private: |
| 146 static v8::MaybeLocal<v8::Value> CallExtraHelper(ScriptState* script_state, | 146 static v8::MaybeLocal<v8::Value> CallExtraHelper(ScriptState*, |
| 147 const char* name, | 147 const char* name, |
| 148 size_t num_args, | 148 size_t num_args, |
| 149 v8::Local<v8::Value>* args) { | 149 v8::Local<v8::Value>* args); |
| 150 v8::Isolate* isolate = script_state->GetIsolate(); | |
| 151 v8::Local<v8::Value> undefined = v8::Undefined(isolate); | |
| 152 v8::Local<v8::Value> function_value = | |
| 153 script_state->GetFromExtrasExports(name).V8Value(); | |
| 154 if (function_value.IsEmpty()) | |
| 155 return v8::MaybeLocal<v8::Value>(); | |
| 156 v8::Local<v8::Function> function = function_value.As<v8::Function>(); | |
| 157 return V8ScriptRunner::CallInternalFunction(function, undefined, num_args, | |
| 158 args, isolate); | |
| 159 } | |
| 160 }; | 150 }; |
| 161 | 151 |
| 162 } // namespace blink | 152 } // namespace blink |
| 163 | 153 |
| 164 #endif // V8ScriptRunner_h | 154 #endif // V8ScriptRunner_h |
| OLD | NEW |