]> git.saurik.com Git - iphone-api.git/blob - WebCore/WebCoreThread.h
Add support for new WinterBoard Settings features.
[iphone-api.git] / WebCore / WebCoreThread.h
1 /*
2 * WebCoreThread.h
3 * WebCore
4 *
5 * Copyright (C) 2006, 2007, Apple Inc. All rights reserved.
6 *
7 */
8
9 #import <GraphicsServices/GSEvent.h>
10
11 #ifndef WebCoreThread_h
12 #define WebCoreThread_h
13
14 #if defined(__cplusplus)
15 extern "C" {
16 #endif
17
18 typedef struct {
19 CGContextRef currentCGContext;
20 } WebThreadContext;
21
22 extern bool webThreadShouldYield;
23
24 // The lock is automatically freed at the bottom of the runloop. No need to unlock.
25 // Note that calling this function may hang your UI for several seconds. Don't use
26 // unless you have to.
27 void WebThreadLock(void);
28
29 // This is a no-op for compatibility only. It will go away. Please don't use.
30 void WebThreadUnlock(void);
31
32 // Please don't use anything below this line unless you know what you are doing. If unsure, ask.
33 // ---------------------------------------------------------------------------------------------
34 bool WebTryThreadLock(void);
35 bool WebThreadIsLocked(void);
36 bool WebThreadIsLockedOrDisabled(void);
37
38 void WebThreadLockPushModal(void);
39 void WebThreadLockPopModal(void);
40
41 void WebThreadEnable(void);
42 bool WebThreadIsEnabled(void);
43 bool WebThreadIsCurrent(void);
44 bool WebThreadNotCurrent(void);
45
46 // These are for <rdar://problem/6817341> Many apps crashing calling -[UIFieldEditor text] in secondary thread
47 // Don't use them to solve any random problems you might have.
48 void WebThreadLockFromAnyThread();
49 void WebThreadUnlockFromAnyThread();
50
51 static inline bool WebThreadShouldYield(void) { return webThreadShouldYield; }
52 static inline void WebThreadSetShouldYield() { webThreadShouldYield = true; }
53
54 CFRunLoopRef WebThreadRunLoop(void);
55 WebThreadContext *WebThreadCurrentContext(void);
56 bool WebThreadContextIsCurrent(void);
57
58 void WebThreadPrepareForDrawing(void);
59
60 #if defined(__cplusplus)
61 }
62 #endif
63
64 #endif // WebCoreThread_h