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

Side by Side Diff: extensions/renderer/api_binding_test_util.cc

Issue 2931393003: [Content] Update V8ValueConverter::create to return a std::unique_ptr (Closed)
Patch Set: rebase Created 3 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
« no previous file with comments | « extensions/renderer/api_activity_logger.cc ('k') | extensions/renderer/api_event_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include "extensions/renderer/api_binding_test_util.h" 5 #include "extensions/renderer/api_binding_test_util.h"
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 v8::Local<v8::Function> FunctionFromString(v8::Local<v8::Context> context, 103 v8::Local<v8::Function> FunctionFromString(v8::Local<v8::Context> context,
104 base::StringPiece source) { 104 base::StringPiece source) {
105 v8::Local<v8::Value> value = V8ValueFromScriptSource(context, source); 105 v8::Local<v8::Value> value = V8ValueFromScriptSource(context, source);
106 v8::Local<v8::Function> function; 106 v8::Local<v8::Function> function;
107 EXPECT_TRUE(gin::ConvertFromV8(context->GetIsolate(), value, &function)); 107 EXPECT_TRUE(gin::ConvertFromV8(context->GetIsolate(), value, &function));
108 return function; 108 return function;
109 } 109 }
110 110
111 std::unique_ptr<base::Value> V8ToBaseValue(v8::Local<v8::Value> value, 111 std::unique_ptr<base::Value> V8ToBaseValue(v8::Local<v8::Value> value,
112 v8::Local<v8::Context> context) { 112 v8::Local<v8::Context> context) {
113 std::unique_ptr<content::V8ValueConverter> converter( 113 return content::V8ValueConverter::Create()->FromV8Value(value, context);
114 content::V8ValueConverter::create());
115 return converter->FromV8Value(value, context);
116 } 114 }
117 115
118 v8::Local<v8::Value> RunFunction(v8::Local<v8::Function> function, 116 v8::Local<v8::Value> RunFunction(v8::Local<v8::Function> function,
119 v8::Local<v8::Context> context, 117 v8::Local<v8::Context> context,
120 v8::Local<v8::Value> receiver, 118 v8::Local<v8::Value> receiver,
121 int argc, 119 int argc,
122 v8::Local<v8::Value> argv[]) { 120 v8::Local<v8::Value> argv[]) {
123 std::string error; 121 std::string error;
124 v8::Local<v8::Value> result; 122 v8::Local<v8::Value> result;
125 EXPECT_TRUE( 123 EXPECT_TRUE(
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 return V8ToBaseValue(GetPropertyFromObject(object, context, key), context); 199 return V8ToBaseValue(GetPropertyFromObject(object, context, key), context);
202 } 200 }
203 201
204 std::string GetStringPropertyFromObject(v8::Local<v8::Object> object, 202 std::string GetStringPropertyFromObject(v8::Local<v8::Object> object,
205 v8::Local<v8::Context> context, 203 v8::Local<v8::Context> context,
206 base::StringPiece key) { 204 base::StringPiece key) {
207 return V8ToString(GetPropertyFromObject(object, context, key), context); 205 return V8ToString(GetPropertyFromObject(object, context, key), context);
208 } 206 }
209 207
210 } // namespace extensions 208 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/api_activity_logger.cc ('k') | extensions/renderer/api_event_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698