Chromium Code Reviews| Index: content/renderer/v8_value_converter_impl.cc |
| diff --git a/content/renderer/v8_value_converter_impl.cc b/content/renderer/v8_value_converter_impl.cc |
| index cb4b9af00f1c667ded643d7c3735833225e43272..2955c6fe6c0fb6522d8cc9dbb5601eb1df6225d6 100644 |
| --- a/content/renderer/v8_value_converter_impl.cc |
| +++ b/content/renderer/v8_value_converter_impl.cc |
| @@ -86,7 +86,8 @@ V8ValueConverterImpl::V8ValueConverterImpl() |
| reg_exp_allowed_(false), |
| function_allowed_(false), |
| strip_null_from_objects_(false), |
| - avoid_identity_hash_for_testing_(false) {} |
| + avoid_identity_hash_for_testing_(false), |
| + strategy_(NULL) {} |
| void V8ValueConverterImpl::SetDateAllowed(bool val) { |
| date_allowed_ = val; |
| @@ -104,6 +105,10 @@ void V8ValueConverterImpl::SetStripNullFromObjects(bool val) { |
| strip_null_from_objects_ = val; |
| } |
| +void V8ValueConverterImpl::SetStrategy(Strategy* strategy) { |
| + strategy_ = strategy; |
| +} |
| + |
| v8::Handle<v8::Value> V8ValueConverterImpl::ToV8Value( |
| const base::Value* value, v8::Handle<v8::Context> context) const { |
| v8::Context::Scope context_scope(context); |
| @@ -294,6 +299,11 @@ base::Value* V8ValueConverterImpl::FromV8Array( |
| FromV8ValueState* state) const { |
| if (!state->UpdateAndCheckUniqueness(val)) |
| return base::Value::CreateNullValue(); |
| + if (strategy_) { |
| + Value* out = NULL; |
| + if (strategy_->FromV8Array(val, &out)) |
| + return out; |
| + } |
|
not at google - send to devlin
2013/08/07 22:07:56
I think the context scope stuff below might actual
pmarch
2013/08/08 00:53:07
Done.
|
| scoped_ptr<v8::Context::Scope> scope; |
| // If val was created in a different context than our current one, change to |
| @@ -357,6 +367,11 @@ base::Value* V8ValueConverterImpl::FromV8Object( |
| FromV8ValueState* state) const { |
| if (!state->UpdateAndCheckUniqueness(val)) |
| return base::Value::CreateNullValue(); |
| + if (strategy_) { |
| + Value* out = NULL; |
| + if (strategy_->FromV8Object(val, &out)) |
| + return out; |
| + } |
|
not at google - send to devlin
2013/08/07 22:07:56
likewise
pmarch
2013/08/08 00:53:07
Done.
|
| scoped_ptr<v8::Context::Scope> scope; |
| // If val was created in a different context than our current one, change to |
| // that context, but change back after val is converted. |