| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #include "modules/indexeddb/IDBValueWrapping.h" | 5 #include "modules/indexeddb/IDBValueWrapping.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "bindings/core/v8/ScriptValue.h" | 9 #include "bindings/core/v8/ScriptValue.h" |
| 10 #include "bindings/core/v8/serialization/SerializationTag.h" | 10 #include "bindings/core/v8/serialization/SerializationTag.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 SerializedScriptValue::SerializeOptions::WasmSerializationPolicy | 60 SerializedScriptValue::SerializeOptions::WasmSerializationPolicy |
| 61 wasm_policy, | 61 wasm_policy, |
| 62 ExceptionState& exception_state) { | 62 ExceptionState& exception_state) { |
| 63 SerializedScriptValue::SerializeOptions options; | 63 SerializedScriptValue::SerializeOptions options; |
| 64 options.blob_info = &blob_info_; | 64 options.blob_info = &blob_info_; |
| 65 options.for_storage = SerializedScriptValue::kForStorage; | 65 options.for_storage = SerializedScriptValue::kForStorage; |
| 66 options.wasm_policy = wasm_policy; | 66 options.wasm_policy = wasm_policy; |
| 67 | 67 |
| 68 serialized_value_ = SerializedScriptValue::Serialize(isolate, value, options, | 68 serialized_value_ = SerializedScriptValue::Serialize(isolate, value, options, |
| 69 exception_state); | 69 exception_state); |
| 70 | 70 if (serialized_value_) |
| 71 original_data_length_ = serialized_value_->DataLengthInBytes(); |
| 71 #if DCHECK_IS_ON() | 72 #if DCHECK_IS_ON() |
| 72 if (exception_state.HadException()) | 73 if (exception_state.HadException()) |
| 73 had_exception_ = true; | 74 had_exception_ = true; |
| 74 #endif // DCHECK_IS_ON() | 75 #endif // DCHECK_IS_ON() |
| 75 } | 76 } |
| 76 | 77 |
| 77 void IDBValueWrapper::Clone(ScriptState* script_state, ScriptValue* clone) { | 78 void IDBValueWrapper::Clone(ScriptState* script_state, ScriptValue* clone) { |
| 78 #if DCHECK_IS_ON() | 79 #if DCHECK_IS_ON() |
| 79 DCHECK(!had_exception_) << __FUNCTION__ | 80 DCHECK(!had_exception_) << __FUNCTION__ |
| 80 << " called on wrapper with serialization exception"; | 81 << " called on wrapper with serialization exception"; |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 ++current_; | 248 ++current_; |
| 248 value |= static_cast<unsigned>(byte & 0x7F) << shift; | 249 value |= static_cast<unsigned>(byte & 0x7F) << shift; |
| 249 shift += 7; | 250 shift += 7; |
| 250 | 251 |
| 251 has_another_byte = byte & 0x80; | 252 has_another_byte = byte & 0x80; |
| 252 } while (has_another_byte); | 253 } while (has_another_byte); |
| 253 return true; | 254 return true; |
| 254 } | 255 } |
| 255 | 256 |
| 256 } // namespace blink | 257 } // namespace blink |
| OLD | NEW |