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

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

Issue 664023002: Avoid entering an empty V8 context in PPB_Var_Deprecated IsInstanceOfDeprecated (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « no previous file | 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) 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 #include "content/renderer/pepper/ppb_var_deprecated_impl.h" 5 #include "content/renderer/pepper/ppb_var_deprecated_impl.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "content/renderer/pepper/host_globals.h" 9 #include "content/renderer/pepper/host_globals.h"
10 #include "content/renderer/pepper/message_channel.h" 10 #include "content/renderer/pepper/message_channel.h"
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 } 296 }
297 297
298 bool IsInstanceOfDeprecated(PP_Var var, 298 bool IsInstanceOfDeprecated(PP_Var var,
299 const PPP_Class_Deprecated* ppp_class, 299 const PPP_Class_Deprecated* ppp_class,
300 void** ppp_class_data) { 300 void** ppp_class_data) {
301 scoped_refptr<V8ObjectVar> object(V8ObjectVar::FromPPVar(var)); 301 scoped_refptr<V8ObjectVar> object(V8ObjectVar::FromPPVar(var));
302 if (!object.get()) 302 if (!object.get())
303 return false; // Not an object at all. 303 return false; // Not an object at all.
304 304
305 v8::HandleScope handle_scope(object->instance()->GetIsolate()); 305 v8::HandleScope handle_scope(object->instance()->GetIsolate());
306 v8::Context::Scope context_scope(object->instance()->GetMainWorldContext()); 306 v8::Handle<v8::Context> context = object->instance()->GetMainWorldContext();
307 if (context.IsEmpty())
308 return false;
309 v8::Context::Scope context_scope(context);
307 PluginObject* plugin_object = PluginObject::FromV8Object( 310 PluginObject* plugin_object = PluginObject::FromV8Object(
308 object->instance()->GetIsolate(), object->GetHandle()); 311 object->instance()->GetIsolate(), object->GetHandle());
309 if (plugin_object && plugin_object->ppp_class() == ppp_class) { 312 if (plugin_object && plugin_object->ppp_class() == ppp_class) {
310 if (ppp_class_data) 313 if (ppp_class_data)
311 *ppp_class_data = plugin_object->ppp_class_data(); 314 *ppp_class_data = plugin_object->ppp_class_data();
312 return true; 315 return true;
313 } 316 }
314 317
315 return false; 318 return false;
316 } 319 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 &CallDeprecated, 358 &CallDeprecated,
356 &Construct, 359 &Construct,
357 &IsInstanceOfDeprecated, 360 &IsInstanceOfDeprecated,
358 &CreateObjectDeprecated, 361 &CreateObjectDeprecated,
359 &CreateObjectWithModuleDeprecated, }; 362 &CreateObjectWithModuleDeprecated, };
360 363
361 return &var_deprecated_interface; 364 return &var_deprecated_interface;
362 } 365 }
363 366
364 } // namespace content 367 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698