OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |