summaryrefslogtreecommitdiffstats
path: root/content/renderer/v8_value_converter_impl.cc
diff options
context:
space:
mode:
authorpmarch@chromium.org <pmarch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-12 17:51:36 +0000
committerpmarch@chromium.org <pmarch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-12 17:51:36 +0000
commitd754cbb0f9c177e9e881e2dc2e3b721c4a1b7048 (patch)
treec84a4b1fe2893ef510fd0825993c248d0f8124de /content/renderer/v8_value_converter_impl.cc
parent581de1f37dd528c558ad5cca2fae0d95cd7c07fe (diff)
downloadchromium_src-d754cbb0f9c177e9e881e2dc2e3b721c4a1b7048.zip
chromium_src-d754cbb0f9c177e9e881e2dc2e3b721c4a1b7048.tar.gz
chromium_src-d754cbb0f9c177e9e881e2dc2e3b721c4a1b7048.tar.bz2
V8ValueConverter for the activity logger that does not invoke interceptors and
accessors when converting V8 values to base values. BUG=260978, 259093 Review URL: https://chromiumcodereview.appspot.com/19730002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@217032 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer/v8_value_converter_impl.cc')
-rw-r--r--content/renderer/v8_value_converter_impl.cc20
1 files changed, 19 insertions, 1 deletions
diff --git a/content/renderer/v8_value_converter_impl.cc b/content/renderer/v8_value_converter_impl.cc
index cb4b9af..efd3d44 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);
@@ -302,6 +307,12 @@ base::Value* V8ValueConverterImpl::FromV8Array(
val->CreationContext() != v8::Context::GetCurrent())
scope.reset(new v8::Context::Scope(val->CreationContext()));
+ if (strategy_) {
+ Value* out = NULL;
+ if (strategy_->FromV8Array(val, &out))
+ return out;
+ }
+
base::ListValue* result = new base::ListValue();
// Only fields with integer keys are carried over to the ListValue.
@@ -357,6 +368,7 @@ base::Value* V8ValueConverterImpl::FromV8Object(
FromV8ValueState* state) const {
if (!state->UpdateAndCheckUniqueness(val))
return base::Value::CreateNullValue();
+
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.
@@ -364,6 +376,12 @@ base::Value* V8ValueConverterImpl::FromV8Object(
val->CreationContext() != v8::Context::GetCurrent())
scope.reset(new v8::Context::Scope(val->CreationContext()));
+ if (strategy_) {
+ Value* out = NULL;
+ if (strategy_->FromV8Object(val, &out))
+ return out;
+ }
+
scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue());
v8::Handle<v8::Array> property_names(val->GetOwnPropertyNames());