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

Side by Side Diff: content/child/v8_value_converter_impl.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, 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_CHILD_V8_VALUE_CONVERTER_IMPL_H_ 5 #ifndef CONTENT_CHILD_V8_VALUE_CONVERTER_IMPL_H_
6 #define CONTENT_CHILD_V8_VALUE_CONVERTER_IMPL_H_ 6 #define CONTENT_CHILD_V8_VALUE_CONVERTER_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 16 matching lines...) Expand all
27 27
28 // V8ValueConverter implementation. 28 // V8ValueConverter implementation.
29 void SetDateAllowed(bool val) override; 29 void SetDateAllowed(bool val) override;
30 void SetRegExpAllowed(bool val) override; 30 void SetRegExpAllowed(bool val) override;
31 void SetFunctionAllowed(bool val) override; 31 void SetFunctionAllowed(bool val) override;
32 void SetStripNullFromObjects(bool val) override; 32 void SetStripNullFromObjects(bool val) override;
33 void SetStrategy(Strategy* strategy) override; 33 void SetStrategy(Strategy* strategy) override;
34 v8::Local<v8::Value> ToV8Value( 34 v8::Local<v8::Value> ToV8Value(
35 const base::Value* value, 35 const base::Value* value,
36 v8::Local<v8::Context> context) const override; 36 v8::Local<v8::Context> context) const override;
37 base::Value* FromV8Value(v8::Local<v8::Value> value, 37 std::unique_ptr<base::Value> FromV8Value(
38 v8::Local<v8::Context> context) const override; 38 v8::Local<v8::Value> value,
39 v8::Local<v8::Context> context) const override;
39 40
40 private: 41 private:
41 friend class ScopedAvoidIdentityHashForTesting; 42 friend class ScopedAvoidIdentityHashForTesting;
42 43
43 class FromV8ValueState; 44 class FromV8ValueState;
44 class ScopedUniquenessGuard; 45 class ScopedUniquenessGuard;
45 46
46 v8::Local<v8::Value> ToV8ValueImpl(v8::Isolate* isolate, 47 v8::Local<v8::Value> ToV8ValueImpl(v8::Isolate* isolate,
47 v8::Local<v8::Object> creation_context, 48 v8::Local<v8::Object> creation_context,
48 const base::Value* value) const; 49 const base::Value* value) const;
49 v8::Local<v8::Value> ToV8Array(v8::Isolate* isolate, 50 v8::Local<v8::Value> ToV8Array(v8::Isolate* isolate,
50 v8::Local<v8::Object> creation_context, 51 v8::Local<v8::Object> creation_context,
51 const base::ListValue* list) const; 52 const base::ListValue* list) const;
52 v8::Local<v8::Value> ToV8Object( 53 v8::Local<v8::Value> ToV8Object(
53 v8::Isolate* isolate, 54 v8::Isolate* isolate,
54 v8::Local<v8::Object> creation_context, 55 v8::Local<v8::Object> creation_context,
55 const base::DictionaryValue* dictionary) const; 56 const base::DictionaryValue* dictionary) const;
56 v8::Local<v8::Value> ToArrayBuffer(v8::Isolate* isolate, 57 v8::Local<v8::Value> ToArrayBuffer(v8::Isolate* isolate,
57 v8::Local<v8::Object> creation_context, 58 v8::Local<v8::Object> creation_context,
58 const base::BinaryValue* value) const; 59 const base::BinaryValue* value) const;
59 60
60 base::Value* FromV8ValueImpl(FromV8ValueState* state, 61 std::unique_ptr<base::Value> FromV8ValueImpl(FromV8ValueState* state,
61 v8::Local<v8::Value> value, 62 v8::Local<v8::Value> value,
62 v8::Isolate* isolate) const; 63 v8::Isolate* isolate) const;
63 base::Value* FromV8Array(v8::Local<v8::Array> array, 64 std::unique_ptr<base::Value> FromV8Array(v8::Local<v8::Array> array,
64 FromV8ValueState* state, 65 FromV8ValueState* state,
65 v8::Isolate* isolate) const; 66 v8::Isolate* isolate) const;
66 67
67 // This will convert objects of type ArrayBuffer or any of the 68 // This will convert objects of type ArrayBuffer or any of the
68 // ArrayBufferView subclasses. 69 // ArrayBufferView subclasses.
69 base::Value* FromV8ArrayBuffer(v8::Local<v8::Object> val, 70 std::unique_ptr<base::Value> FromV8ArrayBuffer(v8::Local<v8::Object> val,
70 v8::Isolate* isolate) const; 71 v8::Isolate* isolate) const;
71 72
72 base::Value* FromV8Object(v8::Local<v8::Object> object, 73 std::unique_ptr<base::Value> FromV8Object(v8::Local<v8::Object> object,
73 FromV8ValueState* state, 74 FromV8ValueState* state,
74 v8::Isolate* isolate) const; 75 v8::Isolate* isolate) const;
75 76
76 // If true, we will convert Date JavaScript objects to doubles. 77 // If true, we will convert Date JavaScript objects to doubles.
77 bool date_allowed_; 78 bool date_allowed_;
78 79
79 // If true, we will convert RegExp JavaScript objects to string. 80 // If true, we will convert RegExp JavaScript objects to string.
80 bool reg_exp_allowed_; 81 bool reg_exp_allowed_;
81 82
82 // If true, we will convert Function JavaScript objects to dictionaries. 83 // If true, we will convert Function JavaScript objects to dictionaries.
83 bool function_allowed_; 84 bool function_allowed_;
84 85
85 // If true, undefined and null values are ignored when converting v8 objects 86 // If true, undefined and null values are ignored when converting v8 objects
86 // into Values. 87 // into Values.
87 bool strip_null_from_objects_; 88 bool strip_null_from_objects_;
88 89
89 bool avoid_identity_hash_for_testing_; 90 bool avoid_identity_hash_for_testing_;
90 91
91 // Strategy object that changes the converter's behavior. 92 // Strategy object that changes the converter's behavior.
92 Strategy* strategy_; 93 Strategy* strategy_;
93 94
94 DISALLOW_COPY_AND_ASSIGN(V8ValueConverterImpl); 95 DISALLOW_COPY_AND_ASSIGN(V8ValueConverterImpl);
95 }; 96 };
96 97
97 } // namespace content 98 } // namespace content
98 99
99 #endif // CONTENT_CHILD_V8_VALUE_CONVERTER_IMPL_H_ 100 #endif // CONTENT_CHILD_V8_VALUE_CONVERTER_IMPL_H_
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/cast_streaming_native_handler.cc ('k') | content/child/v8_value_converter_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698