| OLD | NEW |
| 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 * Copyright (C) 2014 Opera Software ASA. All rights reserved. | 3 * Copyright (C) 2014 Opera Software ASA. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 */ | 30 */ |
| 31 #ifndef NPV8Object_h | 31 #ifndef NPV8Object_h |
| 32 #define NPV8Object_h | 32 #define NPV8Object_h |
| 33 | 33 |
| 34 #include "bindings/core/v8/V8DOMWrapper.h" | 34 #include "bindings/core/v8/V8DOMWrapper.h" |
| 35 #include "core/CoreExport.h" | 35 #include "core/CoreExport.h" |
| 36 | 36 |
| 37 #include "platform/heap/Handle.h" |
| 38 |
| 37 // Chromium uses npruntime.h from the Chromium source repository under | 39 // Chromium uses npruntime.h from the Chromium source repository under |
| 38 // third_party/npapi/bindings. | 40 // third_party/npapi/bindings. |
| 39 #include <bindings/npruntime.h> | 41 #include <bindings/npruntime.h> |
| 40 #include <v8.h> | 42 #include <v8.h> |
| 41 | 43 |
| 42 namespace blink { | 44 namespace blink { |
| 43 | 45 |
| 44 class LocalDOMWindow; | 46 class LocalDOMWindow; |
| 45 class ScriptWrappable; | 47 class ScriptWrappable; |
| 46 | 48 |
| 47 static const int npObjectInternalFieldCount = v8DefaultWrapperInternalFieldCount
+ 0; | 49 static const int npObjectInternalFieldCount = v8DefaultWrapperInternalFieldCount
+ 0; |
| 48 | 50 |
| 49 const WrapperTypeInfo* npObjectTypeInfo(); | 51 const WrapperTypeInfo* npObjectTypeInfo(); |
| 50 | 52 |
| 51 // A V8NPObject is a NPObject which carries additional V8-specific information. | 53 // A V8NPObject is a NPObject which carries additional V8-specific information. |
| 52 // It is created with npCreateV8ScriptObject() and deallocated via the deallocat
e | 54 // It is created with npCreateV8ScriptObject() and deallocated via the deallocat
e |
| 53 // method in the same way as other NPObjects. | 55 // method in the same way as other NPObjects. |
| 54 struct V8NPObject { | 56 struct V8NPObject { |
| 55 WTF_MAKE_NONCOPYABLE(V8NPObject); | 57 WTF_MAKE_NONCOPYABLE(V8NPObject); |
| 56 public: | 58 public: |
| 57 NPObject object; | 59 NPObject object; |
| 58 v8::Persistent<v8::Object> v8Object; | 60 v8::Persistent<v8::Object> v8Object; |
| 59 LocalDOMWindow* rootObject; | 61 RawPtrWillBeUntracedMember<LocalDOMWindow> rootObject; |
| 60 }; | 62 }; |
| 61 | 63 |
| 62 struct PrivateIdentifier { | 64 struct PrivateIdentifier { |
| 63 union { | 65 union { |
| 64 const NPUTF8* string; | 66 const NPUTF8* string; |
| 65 int32_t number; | 67 int32_t number; |
| 66 } value; | 68 } value; |
| 67 bool isString; | 69 bool isString; |
| 68 }; | 70 }; |
| 69 | 71 |
| 70 CORE_EXPORT NPObject* npCreateV8ScriptObject(v8::Isolate*, NPP, v8::Local<v8::Ob
ject>, LocalDOMWindow*); | 72 CORE_EXPORT NPObject* npCreateV8ScriptObject(v8::Isolate*, NPP, v8::Local<v8::Ob
ject>, LocalDOMWindow*); |
| 71 | 73 |
| 72 NPObject* v8ObjectToNPObject(v8::Local<v8::Object>); | 74 NPObject* v8ObjectToNPObject(v8::Local<v8::Object>); |
| 73 | 75 |
| 74 bool isWrappedNPObject(v8::Local<v8::Object>); | 76 bool isWrappedNPObject(v8::Local<v8::Object>); |
| 75 | 77 |
| 76 CORE_EXPORT V8NPObject* npObjectToV8NPObject(NPObject*); | 78 CORE_EXPORT V8NPObject* npObjectToV8NPObject(NPObject*); |
| 77 | 79 |
| 78 ScriptWrappable* npObjectToScriptWrappable(NPObject*); | 80 ScriptWrappable* npObjectToScriptWrappable(NPObject*); |
| 79 | 81 |
| 80 void disposeUnderlyingV8Object(v8::Isolate*, NPObject*); | 82 void disposeUnderlyingV8Object(v8::Isolate*, NPObject*); |
| 81 | 83 |
| 82 } // namespace blink | 84 } // namespace blink |
| 83 | 85 |
| 84 #endif // NPV8Object_h | 86 #endif // NPV8Object_h |
| OLD | NEW |