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

Side by Side Diff: content/renderer/pepper/v8_var_converter.cc

Issue 635593004: PPAPI: Make V8VarConverter longer-lived (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge Created 6 years, 2 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 | « content/renderer/pepper/v8_var_converter.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "content/renderer/pepper/v8_var_converter.h" 5 #include "content/renderer/pepper/v8_var_converter.h"
6 6
7 #include <map> 7 #include <map>
8 #include <stack> 8 #include <stack>
9 #include <string> 9 #include <string>
10 10
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 } 278 }
279 return true; 279 return true;
280 } 280 }
281 281
282 bool CanHaveChildren(PP_Var var) { 282 bool CanHaveChildren(PP_Var var) {
283 return var.type == PP_VARTYPE_ARRAY || var.type == PP_VARTYPE_DICTIONARY; 283 return var.type == PP_VARTYPE_ARRAY || var.type == PP_VARTYPE_DICTIONARY;
284 } 284 }
285 285
286 } // namespace 286 } // namespace
287 287
288 V8VarConverter::V8VarConverter(PP_Instance instance)
289 : instance_(instance),
290 object_vars_allowed_(kDisallowObjectVars),
291 message_loop_proxy_(base::MessageLoopProxy::current()) {
292 resource_converter_.reset(new ResourceConverterImpl(
293 instance, RendererPpapiHost::GetForPPInstance(instance)));
294 }
295
296 V8VarConverter::V8VarConverter(PP_Instance instance, 288 V8VarConverter::V8VarConverter(PP_Instance instance,
297 AllowObjectVars object_vars_allowed) 289 AllowObjectVars object_vars_allowed)
298 : instance_(instance), 290 : instance_(instance),
299 object_vars_allowed_(object_vars_allowed), 291 object_vars_allowed_(object_vars_allowed) {
300 message_loop_proxy_(base::MessageLoopProxy::current()) { 292 resource_converter_.reset(new ResourceConverterImpl(instance));
301 resource_converter_.reset(new ResourceConverterImpl(
302 instance, RendererPpapiHost::GetForPPInstance(instance)));
303 } 293 }
304 294
305 V8VarConverter::V8VarConverter(PP_Instance instance, 295 V8VarConverter::V8VarConverter(PP_Instance instance,
306 scoped_ptr<ResourceConverter> resource_converter) 296 scoped_ptr<ResourceConverter> resource_converter)
307 : instance_(instance), 297 : instance_(instance),
308 object_vars_allowed_(kDisallowObjectVars), 298 object_vars_allowed_(kDisallowObjectVars),
309 message_loop_proxy_(base::MessageLoopProxy::current()),
310 resource_converter_(resource_converter.release()) {} 299 resource_converter_(resource_converter.release()) {}
311 300
312 V8VarConverter::~V8VarConverter() {} 301 V8VarConverter::~V8VarConverter() {}
313 302
314 // To/FromV8Value use a stack-based DFS search to traverse V8/Var graph. Each 303 // To/FromV8Value use a stack-based DFS search to traverse V8/Var graph. Each
315 // iteration, the top node on the stack examined. If the node has not been 304 // iteration, the top node on the stack examined. If the node has not been
316 // visited yet (i.e. sentinel == false) then it is added to the list of parents 305 // visited yet (i.e. sentinel == false) then it is added to the list of parents
317 // which contains all of the nodes on the path from the start node to the 306 // which contains all of the nodes on the path from the start node to the
318 // current node. Each of the current nodes children are examined. If they appear 307 // current node. Each of the current nodes children are examined. If they appear
319 // in the list of parents it means we have a cycle and we return NULL. 308 // in the list of parents it means we have a cycle and we return NULL.
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 std::string(*name_utf8, name_utf8.length()), child_var); 600 std::string(*name_utf8, name_utf8.length()), child_var);
612 DCHECK(success); 601 DCHECK(success);
613 } 602 }
614 } 603 }
615 } 604 }
616 *result_var = root; 605 *result_var = root;
617 return true; 606 return true;
618 } 607 }
619 608
620 } // namespace content 609 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/v8_var_converter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698