OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved. | |
3 * | |
4 * Redistribution and use in source and binary forms, with or without | |
5 * modification, are permitted provided that the following conditions | |
6 * are met: | |
7 * 1. Redistributions of source code must retain the above copyright | |
8 * notice, this list of conditions and the following disclaimer. | |
9 * 2. Redistributions in binary form must reproduce the above copyright | |
10 * notice, this list of conditions and the following disclaimer in the | |
11 * documentation and/or other materials provided with the distribution. | |
12 * | |
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | |
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | |
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | |
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
24 */ | |
25 | |
26 #ifndef npruntime_priv_h | |
27 #define npruntime_priv_h | |
28 | |
29 #include "core/CoreExport.h" | |
30 #include <bindings/npruntime.h> | |
31 | |
32 #ifdef __cplusplus | |
33 extern "C" { | |
34 #endif | |
35 | |
36 /* | |
37 _NPN_InitializeVariantWithStringCopy() will copy string data. The string da
ta | |
38 will be deallocated by calls to NPReleaseVariantValue(). | |
39 */ | |
40 CORE_EXPORT void _NPN_InitializeVariantWithStringCopy(NPVariant*, const NPString
*); | |
41 void _NPN_DeallocateObject(NPObject*); | |
42 | |
43 // The following routines allow the browser to aggressively cleanup NPObjects | |
44 // on a per plugin basis. All NPObjects used through the NPRuntime API should | |
45 // be "registered" while they are alive. After an object has been | |
46 // deleted, it is possible for Javascript to have a reference to that object | |
47 // which has not yet been garbage collected. Javascript access to NPObjects | |
48 // will reference this registry to determine if the object is accessible or | |
49 // not. | |
50 | |
51 // Windows introduces an additional complication for objects created by the | |
52 // plugin. Plugins load inside of a DLL. Each DLL has it's own heap. If | |
53 // the browser unloads the plugin DLL, all objects created within the DLL's | |
54 // heap instantly become invalid. Normally, when WebKit drops the reference | |
55 // on the top-level plugin object, it tells the plugin manager that the | |
56 // plugin can be destroyed, which can unload the DLL. So, we must eliminate | |
57 // all pointers to any object ever created by the plugin. | |
58 | |
59 // We generally associate NPObjects with an owner. The owner of an NPObject | |
60 // is an NPObject which, when destroyed, also destroys all objects it owns. | |
61 // For example, if an NPAPI plugin creates 10 sub-NPObjects, all 11 objects | |
62 // (the NPAPI plugin + its 10 sub-objects) should become inaccessible | |
63 // simultaneously. | |
64 | |
65 // The ownership hierarchy is flat, and not a tree. Imagine the following | |
66 // object creation: | |
67 // PluginObject | |
68 // | | |
69 // +-- Creates -----> Object1 | |
70 // | | |
71 // +-- Creates -----> Object2 | |
72 // | |
73 // PluginObject will be the "owner" for both Object1 and Object2. | |
74 | |
75 // Register an NPObject with the runtime. If the owner is NULL, the | |
76 // object is treated as an owning object. If owner is not NULL, | |
77 // this object will be registered as owned by owner's top-level owner. | |
78 void _NPN_RegisterObject(NPObject*, NPObject* owner); | |
79 | |
80 // Unregister an NPObject with the runtime. If obj is an owning | |
81 // object, this call will also unregister all of the owned objects. | |
82 CORE_EXPORT void _NPN_UnregisterObject(NPObject*); | |
83 | |
84 // Check to see if an object is registered with the runtime. | |
85 // Return true if registered, false otherwise. | |
86 bool _NPN_IsAlive(NPObject*); | |
87 | |
88 #ifdef __cplusplus | |
89 } /* end extern "C" */ | |
90 #endif | |
91 | |
92 #endif // npruntime_priv_h | |
OLD | NEW |