Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1492)

Unified Diff: content/public/child/v8_value_converter.h

Issue 2014323002: Use std::unique_ptr<base::Value> in V8ValueConverter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: android fixes Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/child/v8_value_converter_impl_unittest.cc ('k') | content/renderer/dom_automation_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/child/v8_value_converter.h
diff --git a/content/public/child/v8_value_converter.h b/content/public/child/v8_value_converter.h
index 67e3025ff1a6beb68f0d32d4a193584deb007cb2..aeb38c9a82933cd4f05f0f7911c22a3171af510b 100644
--- a/content/public/child/v8_value_converter.h
+++ b/content/public/child/v8_value_converter.h
@@ -5,6 +5,8 @@
#ifndef CONTENT_PUBLIC_CHILD_V8_VALUE_CONVERTER_H_
#define CONTENT_PUBLIC_CHILD_V8_VALUE_CONVERTER_H_
+#include <memory>
+
#include "base/callback.h"
#include "content/common/content_export.h"
#include "v8/include/v8.h"
@@ -28,8 +30,9 @@ class CONTENT_EXPORT V8ValueConverter {
// Extends the default behaviour of V8ValueConverter.
class CONTENT_EXPORT Strategy {
public:
- typedef base::Callback<base::Value*(
- v8::Local<v8::Value>, v8::Isolate* isolate)> FromV8ValueCallback;
+ typedef base::Callback<std::unique_ptr<base::Value>(v8::Local<v8::Value>,
+ v8::Isolate* isolate)>
+ FromV8ValueCallback;
virtual ~Strategy() {}
@@ -38,7 +41,7 @@ class CONTENT_EXPORT V8ValueConverter {
// Use |callback| to convert any child values, as this will retain
// the ValueConverter's internal checks for depth and cycles.
virtual bool FromV8Object(v8::Local<v8::Object> value,
- base::Value** out,
+ std::unique_ptr<base::Value>* out,
v8::Isolate* isolate,
const FromV8ValueCallback& callback) const;
@@ -47,7 +50,7 @@ class CONTENT_EXPORT V8ValueConverter {
// Use |callback| to convert any child values, as this will retain
// the ValueConverter's internal checks for depth and cycles.
virtual bool FromV8Array(v8::Local<v8::Array> value,
- base::Value** out,
+ std::unique_ptr<base::Value>* out,
v8::Isolate* isolate,
const FromV8ValueCallback& callback) const;
@@ -55,18 +58,18 @@ class CONTENT_EXPORT V8ValueConverter {
// behavior. v8::Object is passed as ArrayBuffer and ArrayBufferView
// classes are siblings.
virtual bool FromV8ArrayBuffer(v8::Local<v8::Object> value,
- base::Value** out,
+ std::unique_ptr<base::Value>* out,
v8::Isolate* isolate) const;
// If false is returned, V8ValueConverter proceeds with the default
// behavior. This allows to intercept "non-finite" values and do something
// with them.
virtual bool FromV8Number(v8::Local<v8::Number> value,
- base::Value** out) const;
+ std::unique_ptr<base::Value>* out) const;
// If false is returned, V8ValueConverter proceeds with the default
// behavior.
- virtual bool FromV8Undefined(base::Value** out) const;
+ virtual bool FromV8Undefined(std::unique_ptr<base::Value>* out) const;
};
static V8ValueConverter* create();
@@ -119,9 +122,9 @@ class CONTENT_EXPORT V8ValueConverter {
// Likewise, if an object throws while converting a property it will not be
// converted, whereas if an array throws while converting an item it will be
// converted to Value(TYPE_NULL).
- // TODO(dcheng): This should return a unique_ptr.
- virtual base::Value* FromV8Value(v8::Local<v8::Value> value,
- v8::Local<v8::Context> context) const = 0;
+ virtual std::unique_ptr<base::Value> FromV8Value(
+ v8::Local<v8::Value> value,
+ v8::Local<v8::Context> context) const = 0;
};
} // namespace content
« no previous file with comments | « content/child/v8_value_converter_impl_unittest.cc ('k') | content/renderer/dom_automation_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698