OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef EXTENSIONS_RENDERER_V8_HELPERS_H_ | 5 #ifndef EXTENSIONS_RENDERER_V8_HELPERS_H_ |
6 #define EXTENSIONS_RENDERER_V8_HELPERS_H_ | 6 #define EXTENSIONS_RENDERER_V8_HELPERS_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <string.h> | 9 #include <string.h> |
10 | 10 |
11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 12 #include "third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h" |
12 #include "v8/include/v8.h" | 13 #include "v8/include/v8.h" |
13 | 14 |
14 namespace extensions { | 15 namespace extensions { |
15 namespace v8_helpers { | 16 namespace v8_helpers { |
16 | 17 |
17 // Helper functions for V8 APIs. | 18 // Helper functions for V8 APIs. |
18 | 19 |
19 // Converts |str| to a V8 string. Returns true on success. | 20 // Converts |str| to a V8 string. Returns true on success. |
20 inline bool ToV8String(v8::Isolate* isolate, | 21 inline bool ToV8String(v8::Isolate* isolate, |
21 const char* str, | 22 const char* str, |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 .ToLocalChecked(); | 166 .ToLocalChecked(); |
166 } | 167 } |
167 | 168 |
168 // Wraps v8::Function::Call(). Returns true on success. | 169 // Wraps v8::Function::Call(). Returns true on success. |
169 inline bool CallFunction(v8::Local<v8::Context> context, | 170 inline bool CallFunction(v8::Local<v8::Context> context, |
170 v8::Local<v8::Function> function, | 171 v8::Local<v8::Function> function, |
171 v8::Local<v8::Value> recv, | 172 v8::Local<v8::Value> recv, |
172 int argc, | 173 int argc, |
173 v8::Local<v8::Value> argv[], | 174 v8::Local<v8::Value> argv[], |
174 v8::Local<v8::Value>* out) { | 175 v8::Local<v8::Value>* out) { |
| 176 blink::WebScopedMicrotaskSuppression microtasks_scope; |
175 return function->Call(context, recv, argc, argv).ToLocal(out); | 177 return function->Call(context, recv, argc, argv).ToLocal(out); |
176 } | 178 } |
177 | 179 |
178 } // namespace v8_helpers | 180 } // namespace v8_helpers |
179 } // namespace extensions | 181 } // namespace extensions |
180 | 182 |
181 #endif // EXTENSIONS_RENDERER_V8_HELPERS_H_ | 183 #endif // EXTENSIONS_RENDERER_V8_HELPERS_H_ |
OLD | NEW |