Changes between Version 25 and Version 26 of Modules
- Timestamp:
- Feb 28, 2012 12:22:48 AM (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Modules
v25 v26 23 23 Sometimes 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 core state 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 these objects using [http://trac.webkit.org/browser/trunk/Source/WebCore/platform/Supplementable.h Supplementable]. 24 24 25 For example, the [http://trac.webkit.org/browser/trunk/Source/WebCore/Modules/gamepad/ Gam pad] 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 a `NavigatorGamepad` in [http://trac.webkit.org/browser/trunk/Source/WebCore/platform/Supplementable.h Navigator's m_supplements HashMap].25 For example, the [http://trac.webkit.org/browser/trunk/Source/WebCore/Modules/gamepad/ Gamepad] 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 a `NavigatorGamepad` in [http://trac.webkit.org/browser/trunk/Source/WebCore/platform/Supplementable.h Navigator's m_supplements HashMap].