/platform/external/webkit/WebCore/bindings/v8/npruntime_priv.h

https://github.com/aharish/totoro-gb-opensource-update2 · C Header · 95 lines · 19 code · 13 blank · 63 comment · 0 complexity · 813d38d5a94cd76c3860fe560ff12db6 MD5 · raw file

  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. #ifndef npruntime_priv_h
  26. #define npruntime_priv_h
  27. #if PLATFORM(CHROMIUM)
  28. #include <bindings/npruntime.h>
  29. #else
  30. #include "npruntime.h"
  31. #endif
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35. /*
  36. _NPN_InitializeVariantWithStringCopy() will copy string data. The string data
  37. will be deallocated by calls to NPReleaseVariantValue().
  38. */
  39. void _NPN_InitializeVariantWithStringCopy(NPVariant*, const NPString*);
  40. void _NPN_DeallocateObject(NPObject*);
  41. // The following routines allow the browser to aggressively cleanup NPObjects
  42. // on a per plugin basis. All NPObjects used through the NPRuntime API should
  43. // be "registered" while they are alive. After an object has been
  44. // deleted, it is possible for Javascript to have a reference to that object
  45. // which has not yet been garbage collected. Javascript access to NPObjects
  46. // will reference this registry to determine if the object is accessible or
  47. // not.
  48. // Windows introduces an additional complication for objects created by the
  49. // plugin. Plugins load inside of a DLL. Each DLL has it's own heap. If
  50. // the browser unloads the plugin DLL, all objects created within the DLL's
  51. // heap instantly become invalid. Normally, when WebKit drops the reference
  52. // on the top-level plugin object, it tells the plugin manager that the
  53. // plugin can be destroyed, which can unload the DLL. So, we must eliminate
  54. // all pointers to any object ever created by the plugin.
  55. // We generally associate NPObjects with an owner. The owner of an NPObject
  56. // is an NPObject which, when destroyed, also destroys all objects it owns.
  57. // For example, if an NPAPI plugin creates 10 sub-NPObjects, all 11 objects
  58. // (the NPAPI plugin + its 10 sub-objects) should become inaccessible
  59. // simultaneously.
  60. // The ownership hierarchy is flat, and not a tree. Imagine the following
  61. // object creation:
  62. // PluginObject
  63. // |
  64. // +-- Creates -----> Object1
  65. // |
  66. // +-- Creates -----> Object2
  67. //
  68. // PluginObject will be the "owner" for both Object1 and Object2.
  69. // Register an NPObject with the runtime. If the owner is NULL, the
  70. // object is treated as an owning object. If owner is not NULL,
  71. // this object will be registered as owned by owner's top-level owner.
  72. void _NPN_RegisterObject(NPObject*, NPObject* owner);
  73. // Unregister an NPObject with the runtime. If obj is an owning
  74. // object, this call will also unregister all of the owned objects.
  75. void _NPN_UnregisterObject(NPObject*);
  76. // Check to see if an object is registered with the runtime.
  77. // Return true if registered, false otherwise.
  78. bool _NPN_IsAlive(NPObject*);
  79. #ifdef __cplusplus
  80. } /* end extern "C" */
  81. #endif
  82. #endif // npruntime_priv_h