OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. | |
3 * Copyright (C) 2014 Opera Software ASA. All rights reserved. | |
4 * | |
5 * Redistribution and use in source and binary forms, with or without | |
6 * modification, are permitted provided that the following conditions are | |
7 * met: | |
8 * | |
9 * * Redistributions of source code must retain the above copyright | |
10 * notice, this list of conditions and the following disclaimer. | |
11 * * Redistributions in binary form must reproduce the above | |
12 * copyright notice, this list of conditions and the following disclaimer | |
13 * in the documentation and/or other materials provided with the | |
14 * distribution. | |
15 * * Neither the name of Google Inc. nor the names of its | |
16 * contributors may be used to endorse or promote products derived from | |
17 * this software without specific prior written permission. | |
18 * | |
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
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. | |
30 */ | |
31 #ifndef NPV8Object_h | |
32 #define NPV8Object_h | |
33 | |
34 #include "bindings/core/v8/V8DOMWrapper.h" | |
35 #include "core/CoreExport.h" | |
36 | |
37 #include "platform/heap/Handle.h" | |
38 | |
39 // Chromium uses npruntime.h from the Chromium source repository under | |
40 // third_party/npapi/bindings. | |
41 #include <bindings/npruntime.h> | |
42 #include <v8.h> | |
43 | |
44 namespace blink { | |
45 | |
46 class LocalDOMWindow; | |
47 class ScriptWrappable; | |
48 | |
49 static const int npObjectInternalFieldCount = v8DefaultWrapperInternalFieldCount
+ 0; | |
50 | |
51 const WrapperTypeInfo* npObjectTypeInfo(); | |
52 | |
53 // A V8NPObject is a NPObject which carries additional V8-specific information. | |
54 // It is created with npCreateV8ScriptObject() and deallocated via the deallocat
e | |
55 // method in the same way as other NPObjects. | |
56 struct V8NPObject { | |
57 WTF_MAKE_NONCOPYABLE(V8NPObject); | |
58 public: | |
59 NPObject object; | |
60 v8::Persistent<v8::Object> v8Object; | |
61 RawPtrWillBeUntracedMember<LocalDOMWindow> rootObject; | |
62 }; | |
63 | |
64 struct PrivateIdentifier { | |
65 union { | |
66 const NPUTF8* string; | |
67 int32_t number; | |
68 } value; | |
69 bool isString; | |
70 }; | |
71 | |
72 CORE_EXPORT NPObject* npCreateV8ScriptObject(v8::Isolate*, NPP, v8::Local<v8::Ob
ject>, LocalDOMWindow*); | |
73 | |
74 NPObject* v8ObjectToNPObject(v8::Local<v8::Object>); | |
75 | |
76 bool isWrappedNPObject(v8::Local<v8::Object>); | |
77 | |
78 CORE_EXPORT V8NPObject* npObjectToV8NPObject(NPObject*); | |
79 | |
80 ScriptWrappable* npObjectToScriptWrappable(NPObject*); | |
81 | |
82 void disposeUnderlyingV8Object(v8::Isolate*, NPObject*); | |
83 | |
84 } // namespace blink | |
85 | |
86 #endif // NPV8Object_h | |
OLD | NEW |