OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_API_BINDING_TYPES_H_ | 5 #ifndef EXTENSIONS_RENDERER_API_BINDING_TYPES_H_ |
6 #define EXTENSIONS_RENDERER_API_BINDING_TYPES_H_ | 6 #define EXTENSIONS_RENDERER_API_BINDING_TYPES_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "v8/include/v8.h" | 12 #include "v8/include/v8.h" |
13 | 13 |
14 namespace extensions { | 14 namespace extensions { |
15 namespace binding { | 15 namespace binding { |
16 | 16 |
17 // A callback to execute the given v8::Function with the provided context and | 17 // A callback to execute the given v8::Function with the provided context and |
18 // arguments. | 18 // arguments. |
19 using RunJSFunction = base::Callback<void(v8::Local<v8::Function>, | 19 using RunJSFunction = base::Callback<void(v8::Local<v8::Function>, |
20 v8::Local<v8::Context>, | 20 v8::Local<v8::Context>, |
21 int argc, | 21 int argc, |
22 v8::Local<v8::Value>[])>; | 22 v8::Local<v8::Value>[])>; |
23 | 23 |
24 // A callback to execute the given v8::Function synchronously and return the | |
25 // result. Note that script can be suspended, so you need to be certain that | |
26 // it is not before expected a synchronous result. | |
27 using RunJSFunctionSync = | |
28 base::Callback<v8::Global<v8::Value>(v8::Local<v8::Function>, | |
jbroman
2017/01/02 19:46:38
Mind a comment alluding to why this returns a Glob
Devlin
2017/01/04 17:57:02
Done.
| |
29 v8::Local<v8::Context>, | |
30 int argc, | |
31 v8::Local<v8::Value>[])>; | |
32 | |
24 } // namespace binding | 33 } // namespace binding |
25 } // namespace extensions | 34 } // namespace extensions |
26 | 35 |
27 #endif // EXTENSIONS_RENDERER_API_BINDING_TYPES_H_ | 36 #endif // EXTENSIONS_RENDERER_API_BINDING_TYPES_H_ |
OLD | NEW |