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

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

Issue 23861002: Remove calls to HandleScope default ctor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « content/renderer/pepper/message_channel.cc ('k') | content/renderer/render_view_impl.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 (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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 // current node. Each of the current nodes children are examined. If they appear 259 // current node. Each of the current nodes children are examined. If they appear
260 // in the list of parents it means we have a cycle and we return NULL. 260 // in the list of parents it means we have a cycle and we return NULL.
261 // Otherwise, if they can have children, we add them to the stack. If the 261 // Otherwise, if they can have children, we add them to the stack. If the
262 // node at the top of the stack has already been visited, then we pop it off the 262 // node at the top of the stack has already been visited, then we pop it off the
263 // stack and erase it from the list of parents. 263 // stack and erase it from the list of parents.
264 // static 264 // static
265 bool V8VarConverter::ToV8Value(const PP_Var& var, 265 bool V8VarConverter::ToV8Value(const PP_Var& var,
266 v8::Handle<v8::Context> context, 266 v8::Handle<v8::Context> context,
267 v8::Handle<v8::Value>* result) { 267 v8::Handle<v8::Value>* result) {
268 v8::Context::Scope context_scope(context); 268 v8::Context::Scope context_scope(context);
269 v8::HandleScope handle_scope; 269 v8::HandleScope handle_scope(context->GetIsolate());
270 270
271 VarHandleMap visited_ids; 271 VarHandleMap visited_ids;
272 ParentVarSet parent_ids; 272 ParentVarSet parent_ids;
273 273
274 std::stack<StackEntry<PP_Var> > stack; 274 std::stack<StackEntry<PP_Var> > stack;
275 stack.push(StackEntry<PP_Var>(var)); 275 stack.push(StackEntry<PP_Var>(var));
276 v8::Handle<v8::Value> root; 276 v8::Handle<v8::Value> root;
277 bool is_root = true; 277 bool is_root = true;
278 278
279 while (!stack.empty()) { 279 while (!stack.empty()) {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 363
364 *result = handle_scope.Close(root); 364 *result = handle_scope.Close(root);
365 return true; 365 return true;
366 } 366 }
367 367
368 void V8VarConverter::FromV8Value( 368 void V8VarConverter::FromV8Value(
369 v8::Handle<v8::Value> val, 369 v8::Handle<v8::Value> val,
370 v8::Handle<v8::Context> context, 370 v8::Handle<v8::Context> context,
371 const base::Callback<void(const ScopedPPVar&, bool)>& callback) { 371 const base::Callback<void(const ScopedPPVar&, bool)>& callback) {
372 v8::Context::Scope context_scope(context); 372 v8::Context::Scope context_scope(context);
373 v8::HandleScope handle_scope; 373 v8::HandleScope handle_scope(context->GetIsolate());
374 374
375 HandleVarMap visited_handles; 375 HandleVarMap visited_handles;
376 ParentHandleSet parent_handles; 376 ParentHandleSet parent_handles;
377 377
378 std::stack<StackEntry<v8::Handle<v8::Value> > > stack; 378 std::stack<StackEntry<v8::Handle<v8::Value> > > stack;
379 stack.push(StackEntry<v8::Handle<v8::Value> >(val)); 379 stack.push(StackEntry<v8::Handle<v8::Value> >(val));
380 ScopedPPVar root; 380 ScopedPPVar root;
381 bool is_root = true; 381 bool is_root = true;
382 382
383 while (!stack.empty()) { 383 while (!stack.empty()) {
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 bool success = dict_var->SetWithStringKey( 500 bool success = dict_var->SetWithStringKey(
501 std::string(*name_utf8, name_utf8.length()), child_var); 501 std::string(*name_utf8, name_utf8.length()), child_var);
502 DCHECK(success); 502 DCHECK(success);
503 } 503 }
504 } 504 }
505 } 505 }
506 resource_converter_->Flush(base::Bind(callback, root)); 506 resource_converter_->Flush(base::Bind(callback, root));
507 } 507 }
508 508
509 } // namespace content 509 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/message_channel.cc ('k') | content/renderer/render_view_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698