Changes between Version 19 and Version 20 of Modules


Ignore:
Timestamp:
Feb 27, 2012, 11:43:58 PM (13 years ago)
Author:
abarth@webkit.org
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Modules

    v19 v20  
    2323Sometimes a module needs to associate state with a core object, such as Page or Navigator.  Typically, this state doesn't interact with any of the other state associated with this object and simply piggybacks on the lifetime of the core object.  Rather than bloating the core objects with your feature-specific state, you can associate your feature's data with the core object using [http://trac.webkit.org/browser/trunk/Source/WebCore/platform/Supplementable.h Supplementable.h].  This mechanism allocates your data lazily, which saves memory on pages that don't use your feature.
    2424
    25 For example, the Gampad module...
     25For example, the [http://trac.webkit.org/browser/trunk/Source/WebCore/Modules/gamepad/ Gampad] module needs to associate a GamepadList with Navigator.  Notice that in the [http://trac.webkit.org/browser/trunk/Source/WebCore/Modules/gamepad/NavigatorGamepad.h implementation] of its [http://trac.webkit.org/browser/trunk/Source/WebCore/Modules/gamepad/NavigatorGamepad.idl supplemental interface], the Gamepad module declares that NavigatorGamepad inherits from Supplement<Navigator>, which lets us store NavigatorGamepad in [http://trac.webkit.org/browser/trunk/Source/WebCore/platform/Supplementable.h Navigator's m_supplements HashMap].
    2626
    2727== Observing the lifecycle of "core" objects ==