| | 1 | == WebKit2 - High Level Document == |
| | 2 | |
| | 3 | WebKit2 is a new C-based non-blocking API to WebKit. This allows WebCore, and all the heavy lifting it does, to be done in a separate context, be that a background-thread or background-process. |
| | 4 | |
| | 5 | |
| | 6 | == API: == |
| | 7 | |
| | 8 | In order to achieve the goal of a non-blocking API, several techniques are used to make the API usable while still providing a comprehensive set of features to the embedder. These techniques include: |
| | 9 | - Notification style client callbacks (e.g. didFinishLoadForFrame) |
| | 10 | These inform the embedder that something has happened, but do not give |
| | 11 | them the chance to do anything about it. |
| | 12 | - Policy style clients callbacks (e.g. decidePolicyForNavigationAction) |
| | 13 | These allow the embedder to decide on an action at their leisure, |
| | 14 | notifying the page through a listener object. |
| | 15 | - Policy settings (e.g. WKContextSetCacheModel, WKContextSetPopupPolicy) |
| | 16 | These allow the embedder to opt into a predefined policy without any |
| | 17 | callbacks into the UIProcess. These can either be an enumerated set of |
| | 18 | specific policies, or something more fine-grained, such as a list of |
| | 19 | strings with wildcards. |
| | 20 | - Injected code (e.g. WebBundle) |
| | 21 | Code can be loaded into the WebProcess for cases where all the other |
| | 22 | options fail. This can useful when access to the DOM is required. |
| | 23 | [Planned, but not currently implemented] |
| | 24 | |
| | 25 | The major API classes are: |
| | 26 | |
| | 27 | WKContextRef |
| | 28 | - Encapsulates all pages related to specific use of WebKit. All pages in |
| | 29 | this context share the same visited link set, local storage set, and |
| | 30 | preferences. |
| | 31 | |
| | 32 | WKPageNamespaceRef |
| | 33 | - Encapsulates all pages that can script each other. |
| | 34 | |
| | 35 | WKPageRef |
| | 36 | - Basic unit of browsing. Stays the same as the main frame changes. |
| | 37 | |
| | 38 | WKView[Ref] |
| | 39 | - Native view that hooks into the platform's toolkit. On Windows, this wraps |
| | 40 | a HWND. On the Mac, it inherits from NSView. |