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

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

Issue 2740143002: Change base::Value::ListStorage to std::vector<base::Value> (Closed)
Patch Set: Comment Updates Created 3 years, 9 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 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_request_handler.h" 5 #include "extensions/renderer/api_request_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/guid.h" 8 #include "base/guid.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 v8::Local<v8::Context> context = pending_request.context.Get(isolate); 114 v8::Local<v8::Context> context = pending_request.context.Get(isolate);
115 v8::Context::Scope context_scope(context); 115 v8::Context::Scope context_scope(context);
116 std::unique_ptr<content::V8ValueConverter> converter( 116 std::unique_ptr<content::V8ValueConverter> converter(
117 content::V8ValueConverter::create()); 117 content::V8ValueConverter::create());
118 std::vector<v8::Local<v8::Value>> args; 118 std::vector<v8::Local<v8::Value>> args;
119 args.reserve(response_args.GetSize() + 119 args.reserve(response_args.GetSize() +
120 pending_request.callback_arguments.size()); 120 pending_request.callback_arguments.size());
121 for (const auto& arg : pending_request.callback_arguments) 121 for (const auto& arg : pending_request.callback_arguments)
122 args.push_back(arg.Get(isolate)); 122 args.push_back(arg.Get(isolate));
123 for (const auto& arg : response_args) 123 for (const auto& arg : response_args)
124 args.push_back(converter->ToV8Value(arg.get(), context)); 124 args.push_back(converter->ToV8Value(&arg, context));
125 125
126 blink::WebScopedUserGesture user_gesture(pending_request.user_gesture_token); 126 blink::WebScopedUserGesture user_gesture(pending_request.user_gesture_token);
127 if (!error.empty()) 127 if (!error.empty())
128 last_error_.SetError(context, error); 128 last_error_.SetError(context, error);
129 129
130 // args.size() is converted to int, but args is controlled by chrome and is 130 // args.size() is converted to int, but args is controlled by chrome and is
131 // never close to std::numeric_limits<int>::max. 131 // never close to std::numeric_limits<int>::max.
132 call_js_.Run(pending_request.callback.Get(isolate), context, args.size(), 132 call_js_.Run(pending_request.callback.Get(isolate), context, args.size(),
133 args.data()); 133 args.data());
134 134
(...skipping 12 matching lines...) Expand all
147 } 147 }
148 148
149 std::set<int> APIRequestHandler::GetPendingRequestIdsForTesting() const { 149 std::set<int> APIRequestHandler::GetPendingRequestIdsForTesting() const {
150 std::set<int> result; 150 std::set<int> result;
151 for (const auto& pair : pending_requests_) 151 for (const auto& pair : pending_requests_)
152 result.insert(pair.first); 152 result.insert(pair.first);
153 return result; 153 return result;
154 } 154 }
155 155
156 } // namespace extensions 156 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698