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

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

Issue 668333002: Avoid entering an empty V8 context in PPB_Var_Deprecated IsInstanceOfDeprecated (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2171
Patch Set: Created 6 years, 1 month 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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 } 283 }
284 284
285 bool IsInstanceOfDeprecated(PP_Var var, 285 bool IsInstanceOfDeprecated(PP_Var var,
286 const PPP_Class_Deprecated* ppp_class, 286 const PPP_Class_Deprecated* ppp_class,
287 void** ppp_class_data) { 287 void** ppp_class_data) {
288 scoped_refptr<V8ObjectVar> object(V8ObjectVar::FromPPVar(var)); 288 scoped_refptr<V8ObjectVar> object(V8ObjectVar::FromPPVar(var));
289 if (!object.get()) 289 if (!object.get())
290 return false; // Not an object at all. 290 return false; // Not an object at all.
291 291
292 v8::HandleScope handle_scope(object->instance()->GetIsolate()); 292 v8::HandleScope handle_scope(object->instance()->GetIsolate());
293 v8::Context::Scope context_scope(object->instance()->GetMainWorldContext()); 293 v8::Handle<v8::Context> context = object->instance()->GetMainWorldContext();
294 if (context.IsEmpty())
295 return false;
296 v8::Context::Scope context_scope(context);
294 PluginObject* plugin_object = PluginObject::FromV8Object( 297 PluginObject* plugin_object = PluginObject::FromV8Object(
295 object->instance()->GetIsolate(), object->GetHandle()); 298 object->instance()->GetIsolate(), object->GetHandle());
296 if (plugin_object && plugin_object->ppp_class() == ppp_class) { 299 if (plugin_object && plugin_object->ppp_class() == ppp_class) {
297 if (ppp_class_data) 300 if (ppp_class_data)
298 *ppp_class_data = plugin_object->ppp_class_data(); 301 *ppp_class_data = plugin_object->ppp_class_data();
299 return true; 302 return true;
300 } 303 }
301 304
302 return false; 305 return false;
303 } 306 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 &CallDeprecated, 345 &CallDeprecated,
343 &Construct, 346 &Construct,
344 &IsInstanceOfDeprecated, 347 &IsInstanceOfDeprecated,
345 &CreateObjectDeprecated, 348 &CreateObjectDeprecated,
346 &CreateObjectWithModuleDeprecated, }; 349 &CreateObjectWithModuleDeprecated, };
347 350
348 return &var_deprecated_interface; 351 return &var_deprecated_interface;
349 } 352 }
350 353
351 } // namespace content 354 } // 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