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

Side by Side Diff: content/public/child/v8_value_converter.h

Issue 2000803003: Use std::unique_ptr for base::DictionaryValue and base::ListValue's internal store. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix various builds. Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef CONTENT_PUBLIC_CHILD_V8_VALUE_CONVERTER_H_ 5 #ifndef CONTENT_PUBLIC_CHILD_V8_VALUE_CONVERTER_H_
6 #define CONTENT_PUBLIC_CHILD_V8_VALUE_CONVERTER_H_ 6 #define CONTENT_PUBLIC_CHILD_V8_VALUE_CONVERTER_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "content/common/content_export.h" 9 #include "content/common/content_export.h"
10 #include "v8/include/v8.h" 10 #include "v8/include/v8.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 virtual void SetStripNullFromObjects(bool val) = 0; 98 virtual void SetStripNullFromObjects(bool val) = 0;
99 99
100 // Extend default behavior of V8ValueConverter. 100 // Extend default behavior of V8ValueConverter.
101 virtual void SetStrategy(Strategy* strategy) = 0; 101 virtual void SetStrategy(Strategy* strategy) = 0;
102 102
103 // Converts a base::Value to a v8::Value. 103 // Converts a base::Value to a v8::Value.
104 // 104 //
105 // Unsupported types are replaced with null. If an array or object throws 105 // Unsupported types are replaced with null. If an array or object throws
106 // while setting a value, that property or item is skipped, leaving a hole in 106 // while setting a value, that property or item is skipped, leaving a hole in
107 // the case of arrays. 107 // the case of arrays.
108 // TODO(dcheng): This should just take a const reference.
108 virtual v8::Local<v8::Value> ToV8Value( 109 virtual v8::Local<v8::Value> ToV8Value(
109 const base::Value* value, 110 const base::Value* value,
110 v8::Local<v8::Context> context) const = 0; 111 v8::Local<v8::Context> context) const = 0;
111 112
112 // Converts a v8::Value to base::Value. 113 // Converts a v8::Value to base::Value.
113 // 114 //
114 // Unsupported types (unless explicitly configured) are not converted, so 115 // Unsupported types (unless explicitly configured) are not converted, so
115 // this method may return NULL -- the exception is when converting arrays, 116 // this method may return NULL -- the exception is when converting arrays,
116 // where unsupported types are converted to Value(TYPE_NULL). 117 // where unsupported types are converted to Value(TYPE_NULL).
117 // 118 //
118 // Likewise, if an object throws while converting a property it will not be 119 // Likewise, if an object throws while converting a property it will not be
119 // converted, whereas if an array throws while converting an item it will be 120 // converted, whereas if an array throws while converting an item it will be
120 // converted to Value(TYPE_NULL). 121 // converted to Value(TYPE_NULL).
122 // TODO(dcheng): This should return a unique_ptr.
121 virtual base::Value* FromV8Value(v8::Local<v8::Value> value, 123 virtual base::Value* FromV8Value(v8::Local<v8::Value> value,
122 v8::Local<v8::Context> context) const = 0; 124 v8::Local<v8::Context> context) const = 0;
123 }; 125 };
124 126
125 } // namespace content 127 } // namespace content
126 128
127 #endif // CONTENT_PUBLIC_CHILD_V8_VALUE_CONVERTER_H_ 129 #endif // CONTENT_PUBLIC_CHILD_V8_VALUE_CONVERTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698