| 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..108e21cf397b3a268a7d2e9cf72f122c39517ba9 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,10 +105,20 @@ void V8ValueConverterImpl::SetStripNullFromObjects(bool val) {
|
| strip_null_from_objects_ = val;
|
| }
|
|
|
| +void V8ValueConverterImpl::SetStrategy(V8ValueConverterStrategy* 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);
|
| v8::HandleScope handle_scope;
|
| + if (strategy_) {
|
| + v8::Handle<v8::Value> out;
|
| + if (strategy_->ToV8Value(value, &out)) {
|
| + return handle_scope.Close(out);
|
| + }
|
| + }
|
| return handle_scope.Close(ToV8ValueImpl(value));
|
| }
|
|
|
| @@ -116,6 +127,11 @@ Value* V8ValueConverterImpl::FromV8Value(
|
| v8::Handle<v8::Context> context) const {
|
| v8::Context::Scope context_scope(context);
|
| v8::HandleScope handle_scope;
|
| + if (strategy_) {
|
| + Value* out = NULL;
|
| + if (strategy_->FromV8Value(val, &out))
|
| + return out;
|
| + }
|
| FromV8ValueState state(avoid_identity_hash_for_testing_);
|
| return FromV8ValueImpl(val, &state);
|
| }
|
|
|