Chromium Code Reviews| Index: include/v8.h |
| diff --git a/include/v8.h b/include/v8.h |
| index d2f19e07119428850900738afa58525f75b8ace4..66bd22053649b689e0d8f8333bb9b060bcb55a38 100644 |
| --- a/include/v8.h |
| +++ b/include/v8.h |
| @@ -3914,6 +3914,8 @@ class V8_EXPORT Proxy : public Object { |
| static void CheckCast(Value* obj); |
| }; |
| +// TODO(mtrofin): rename WasmCompiledModule to WasmModuleObject, for |
|
clemensh
2017/03/27 07:39:20
FYI: Ben once had the plan to rename this to WasmS
Mircea Trofin
2017/03/27 07:58:30
By "module" you mean "wire bytes"?
An instance of
|
| +// consistency with internal APIs. |
| class V8_EXPORT WasmCompiledModule : public Object { |
| public: |
| typedef std::pair<std::unique_ptr<const uint8_t[]>, size_t> SerializedModule; |
| @@ -3965,6 +3967,10 @@ class V8_EXPORT WasmCompiledModule : public Object { |
| V8_INLINE static WasmCompiledModule* Cast(Value* obj); |
| private: |
| + // TODO(ahaas): please remove the friend once streamed compilation is |
| + // implemented |
| + friend class WasmModuleObjectBuilder; |
| + |
| static MaybeLocal<WasmCompiledModule> Deserialize( |
| Isolate* isolate, const CallerOwnedBuffer& serialized_module, |
| const CallerOwnedBuffer& wire_bytes); |
| @@ -3980,6 +3986,29 @@ class V8_EXPORT WasmCompiledModule : public Object { |
| static void CheckCast(Value* obj); |
| }; |
| +class V8_EXPORT WasmModuleObjectBuilder final { |
| + public: |
| + WasmModuleObjectBuilder(Isolate* isolate) : isolate_(isolate) {} |
| + void OnBytesReceived(std::unique_ptr<const uint8_t[]>&& bytes, size_t size); |
| + MaybeLocal<WasmCompiledModule> Finish(); |
| + |
| + private: |
| + Isolate* isolate_ = nullptr; |
| + // TODO(ahaas): We probably need none of this below here once streamed |
| + // compilation is implemented. |
| + typedef std::pair<std::unique_ptr<const uint8_t[]>, size_t> Buffer; |
| + |
| + // Disable copy semantics *in this implementation*. We can choose to |
| + // relax this, albeit it's not clear why. |
| + WasmModuleObjectBuilder(const WasmModuleObjectBuilder&) = delete; |
| + WasmModuleObjectBuilder(WasmModuleObjectBuilder&&) = default; |
| + WasmModuleObjectBuilder& operator=(const WasmModuleObjectBuilder&) = delete; |
| + WasmModuleObjectBuilder& operator=(WasmModuleObjectBuilder&&) = default; |
| + |
| + std::vector<Buffer> received_buffers_; |
| + size_t total_size_ = 0; |
| +}; |
| + |
| #ifndef V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT |
| // The number of required internal fields can be defined by embedder. |
| #define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT 2 |