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

Side by Side Diff: Source/bindings/core/v8/V8NPObject.cpp

Issue 1110433002: Make Isolate as the first argument. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix Compile error Created 5 years, 8 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 | « Source/bindings/core/v8/V8Binding.h ('k') | Source/bindings/core/v8/V8ValueCache.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 static v8::Eternal<v8::FunctionTemplate> npObjectDesc; 449 static v8::Eternal<v8::FunctionTemplate> npObjectDesc;
450 450
451 ASSERT(isolate->InContext()); 451 ASSERT(isolate->InContext());
452 452
453 // If this is a v8 object, just return it. 453 // If this is a v8 object, just return it.
454 V8NPObject* v8NPObject = npObjectToV8NPObject(object); 454 V8NPObject* v8NPObject = npObjectToV8NPObject(object);
455 if (v8NPObject) 455 if (v8NPObject)
456 return v8::Local<v8::Object>::New(isolate, v8NPObject->v8Object); 456 return v8::Local<v8::Object>::New(isolate, v8NPObject->v8Object);
457 457
458 // If we've already wrapped this object, just return it. 458 // If we've already wrapped this object, just return it.
459 v8::Local<v8::Object> wrapper = staticNPObjectMap().newLocal(object, isolate ); 459 v8::Local<v8::Object> wrapper = staticNPObjectMap().newLocal(isolate, object );
460 if (!wrapper.IsEmpty()) 460 if (!wrapper.IsEmpty())
461 return wrapper; 461 return wrapper;
462 462
463 // FIXME: we should create a Wrapper type as a subclass of JSObject. It has two internal fields, field 0 is the wrapped 463 // FIXME: we should create a Wrapper type as a subclass of JSObject. It has two internal fields, field 0 is the wrapped
464 // pointer, and field 1 is the type. There should be an api function that re turns unused type id. The same Wrapper type 464 // pointer, and field 1 is the type. There should be an api function that re turns unused type id. The same Wrapper type
465 // can be used by DOM bindings. 465 // can be used by DOM bindings.
466 if (npObjectDesc.IsEmpty()) { 466 if (npObjectDesc.IsEmpty()) {
467 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolat e); 467 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolat e);
468 templ->InstanceTemplate()->SetInternalFieldCount(npObjectInternalFieldCo unt); 468 templ->InstanceTemplate()->SetInternalFieldCount(npObjectInternalFieldCo unt);
469 templ->InstanceTemplate()->SetNamedPropertyHandler(npObjectNamedProperty Getter, npObjectNamedPropertySetter, npObjectQueryProperty, 0, npObjectNamedProp ertyEnumerator); 469 templ->InstanceTemplate()->SetNamedPropertyHandler(npObjectNamedProperty Getter, npObjectNamedPropertySetter, npObjectQueryProperty, 0, npObjectNamedProp ertyEnumerator);
(...skipping 21 matching lines...) Expand all
491 491
492 staticNPObjectMap().set(object, value, npObjectTypeInfo()); 492 staticNPObjectMap().set(object, value, npObjectTypeInfo());
493 ASSERT(V8DOMWrapper::hasInternalFieldsSet(value)); 493 ASSERT(V8DOMWrapper::hasInternalFieldsSet(value));
494 return value; 494 return value;
495 } 495 }
496 496
497 void forgetV8ObjectForNPObject(NPObject* object) 497 void forgetV8ObjectForNPObject(NPObject* object)
498 { 498 {
499 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 499 v8::Isolate* isolate = v8::Isolate::GetCurrent();
500 v8::HandleScope scope(isolate); 500 v8::HandleScope scope(isolate);
501 v8::Local<v8::Object> wrapper = staticNPObjectMap().newLocal(object, isolate ); 501 v8::Local<v8::Object> wrapper = staticNPObjectMap().newLocal(isolate, object );
502 if (!wrapper.IsEmpty()) { 502 if (!wrapper.IsEmpty()) {
503 V8DOMWrapper::clearNativeInfo(wrapper, npObjectTypeInfo()); 503 V8DOMWrapper::clearNativeInfo(wrapper, npObjectTypeInfo());
504 staticNPObjectMap().removeAndDispose(object); 504 staticNPObjectMap().removeAndDispose(object);
505 _NPN_ReleaseObject(object); 505 _NPN_ReleaseObject(object);
506 } 506 }
507 } 507 }
508 508
509 } // namespace blink 509 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/V8Binding.h ('k') | Source/bindings/core/v8/V8ValueCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698