| OLD | NEW |
| 1 // Copyright (c) 2008, Google Inc. | 1 // Copyright (c) 2008, Google Inc. |
| 2 // All rights reserved. | 2 // 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 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 #define max max | 32 #define max max |
| 33 #define min min | 33 #define min min |
| 34 #include "v8_helpers.h" | 34 #include "v8_helpers.h" |
| 35 #include "v8_proxy.h" | 35 #include "v8_proxy.h" |
| 36 #include "v8_index.h" | 36 #include "v8_index.h" |
| 37 #include "np_v8object.h" | 37 #include "np_v8object.h" |
| 38 | 38 |
| 39 #include "DOMWindow.h" | 39 #include "DOMWindow.h" |
| 40 | 40 |
| 41 using WebCore::V8Custom; |
| 42 |
| 41 void WrapNPObject(v8::Handle<v8::Object> obj, NPObject* npobj) { | 43 void WrapNPObject(v8::Handle<v8::Object> obj, NPObject* npobj) { |
| 42 ASSERT(obj->InternalFieldCount() >= 3); | |
| 43 | |
| 44 WebCore::V8Proxy::SetDOMWrapper(obj, WebCore::V8ClassIndex::NPOBJECT, npobj); | 44 WebCore::V8Proxy::SetDOMWrapper(obj, WebCore::V8ClassIndex::NPOBJECT, npobj); |
| 45 | |
| 46 // Create a JS object as a hash map for functions | |
| 47 obj->SetInternalField(2, v8::Object::New()); | |
| 48 } | 45 } |
| 49 | 46 |
| 50 v8::Local<v8::Context> GetV8Context(NPP npp, NPObject* npobj) { | 47 v8::Local<v8::Context> GetV8Context(NPP npp, NPObject* npobj) { |
| 51 V8NPObject* object = reinterpret_cast<V8NPObject*>(npobj); | 48 V8NPObject* object = reinterpret_cast<V8NPObject*>(npobj); |
| 52 return WebCore::V8Proxy::GetContext(object->root_object->frame()); | 49 return WebCore::V8Proxy::GetContext(object->root_object->frame()); |
| 53 } | 50 } |
| 54 | 51 |
| 55 WebCore::V8Proxy* GetV8Proxy(NPObject* npobj) { | 52 WebCore::V8Proxy* GetV8Proxy(NPObject* npobj) { |
| 56 V8NPObject* object = reinterpret_cast<V8NPObject*>(npobj); | 53 V8NPObject* object = reinterpret_cast<V8NPObject*>(npobj); |
| 57 WebCore::Frame* frame = object->root_object->frame(); | 54 WebCore::Frame* frame = object->root_object->frame(); |
| 58 return WebCore::V8Proxy::retrieve(frame); | 55 return WebCore::V8Proxy::retrieve(frame); |
| 59 } | 56 } |
| OLD | NEW |