Changeset 159059 in webkit
- Timestamp:
- Nov 11, 2013 11:18:32 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r159042 r159059 1 2013-11-11 Anders Carlsson <andersca@apple.com> 2 3 Remove block based APIs from the WebKit2 C API 4 https://bugs.webkit.org/show_bug.cgi?id=124157 5 6 Reviewed by Sam Weinig. 7 8 Remove most of the block based C APIs from WebKit2. We want to discourage people from using 9 them since any C API "objects" captured by blocks won't be implicitly retained which 10 can lead to dangling pointer bugs. 11 12 * UIProcess/API/C/WKDatabaseManager.cpp: 13 * UIProcess/API/C/WKDatabaseManager.h: 14 * UIProcess/API/C/WKFrame.cpp: 15 * UIProcess/API/C/WKFrame.h: 16 * UIProcess/API/C/WKPage.cpp: 17 * UIProcess/API/C/WKPage.h: 18 * UIProcess/API/C/WKPagePrivate.h: 19 1 20 2013-11-11 Carlos Garcia Campos <cgarcia@igalia.com> 2 21 -
trunk/Source/WebKit2/UIProcess/API/C/WKDatabaseManager.cpp
r123315 r159059 29 29 #include "WebDatabaseManagerProxy.h" 30 30 #include "WKAPICast.h" 31 32 #ifdef __BLOCKS__33 #include <Block.h>34 #endif35 31 36 32 using namespace WebKit; … … 141 137 } 142 138 143 #ifdef __BLOCKS__144 static void callGetDatabasesByOriginBlockAndDispose(WKArrayRef resultValue, WKErrorRef errorRef, void* context)145 {146 #if ENABLE(SQL_DATABASE)147 WKDatabaseManagerGetDatabasesByOriginBlock block = (WKDatabaseManagerGetDatabasesByOriginBlock)context;148 block(resultValue, errorRef);149 Block_release(block);150 #endif151 }152 153 void WKDatabaseManagerGetDatabasesByOrigin_b(WKDatabaseManagerRef databaseManagerRef, WKDatabaseManagerGetDatabasesByOriginBlock block)154 {155 #if ENABLE(SQL_DATABASE)156 WKDatabaseManagerGetDatabasesByOrigin(databaseManagerRef, Block_copy(block), callGetDatabasesByOriginBlockAndDispose);157 #endif158 }159 #endif // __BLOCKS__160 161 139 void WKDatabaseManagerGetDatabaseOrigins(WKDatabaseManagerRef databaseManagerRef, void* context, WKDatabaseManagerGetDatabaseOriginsFunction callback) 162 140 { … … 165 143 #endif 166 144 } 167 168 #ifdef __BLOCKS__169 static void callGetDatabaseOriginsBlockBlockAndDispose(WKArrayRef resultValue, WKErrorRef errorRef, void* context)170 {171 #if ENABLE(SQL_DATABASE)172 WKDatabaseManagerGetDatabaseOriginsBlock block = (WKDatabaseManagerGetDatabaseOriginsBlock)context;173 block(resultValue, errorRef);174 Block_release(block);175 #endif176 }177 178 void WKDatabaseManagerGetDatabaseOrigins_b(WKDatabaseManagerRef databaseManagerRef, WKDatabaseManagerGetDatabaseOriginsBlock block)179 {180 #if ENABLE(SQL_DATABASE)181 WKDatabaseManagerGetDatabaseOrigins(databaseManagerRef, Block_copy(block), callGetDatabaseOriginsBlockBlockAndDispose);182 #endif183 }184 #endif // __BLOCKS__185 145 186 146 void WKDatabaseManagerDeleteDatabasesWithNameForOrigin(WKDatabaseManagerRef databaseManagerRef, WKStringRef databaseNameRef, WKSecurityOriginRef originRef) -
trunk/Source/WebKit2/UIProcess/API/C/WKDatabaseManager.h
r95901 r159059 84 84 typedef void (*WKDatabaseManagerGetDatabasesByOriginFunction)(WKArrayRef, WKErrorRef, void*); 85 85 WK_EXPORT void WKDatabaseManagerGetDatabasesByOrigin(WKDatabaseManagerRef databaseManager, void* context, WKDatabaseManagerGetDatabasesByOriginFunction function); 86 #ifdef __BLOCKS__87 typedef void (^WKDatabaseManagerGetDatabasesByOriginBlock)(WKArrayRef, WKErrorRef);88 WK_EXPORT void WKDatabaseManagerGetDatabasesByOrigin_b(WKDatabaseManagerRef databaseManager, WKDatabaseManagerGetDatabasesByOriginBlock block);89 #endif90 86 91 87 typedef void (*WKDatabaseManagerGetDatabaseOriginsFunction)(WKArrayRef, WKErrorRef, void*); 92 88 WK_EXPORT void WKDatabaseManagerGetDatabaseOrigins(WKDatabaseManagerRef contextRef, void* context, WKDatabaseManagerGetDatabaseOriginsFunction function); 93 #ifdef __BLOCKS__94 typedef void (^WKDatabaseManagerGetDatabaseOriginsBlock)(WKArrayRef, WKErrorRef);95 WK_EXPORT void WKDatabaseManagerGetDatabaseOrigins_b(WKDatabaseManagerRef databaseManager, WKDatabaseManagerGetDatabaseOriginsBlock block);96 #endif97 89 98 90 WK_EXPORT void WKDatabaseManagerDeleteDatabasesWithNameForOrigin(WKDatabaseManagerRef databaseManager, WKStringRef databaseName, WKSecurityOriginRef origin); -
trunk/Source/WebKit2/UIProcess/API/C/WKFrame.cpp
r141708 r159059 29 29 #include "WKAPICast.h" 30 30 #include "WebFrameProxy.h" 31 32 #ifdef __BLOCKS__33 #include <Block.h>34 #endif35 31 36 32 using namespace WebKit; … … 137 133 } 138 134 139 #ifdef __BLOCKS__140 static void callGetResourceDataBlockAndDispose(WKDataRef data, WKErrorRef error, void* context)141 {142 WKFrameGetResourceDataBlock block = (WKFrameGetResourceDataBlock)context;143 block(data, error);144 Block_release(block);145 }146 147 void WKFrameGetMainResourceData_b(WKFrameRef frameRef, WKFrameGetResourceDataBlock block)148 {149 WKFrameGetMainResourceData(frameRef, callGetResourceDataBlockAndDispose, Block_copy(block));150 }151 152 void WKFrameGetResourceData_b(WKFrameRef frameRef, WKURLRef resourceURL, WKFrameGetResourceDataBlock block)153 {154 WKFrameGetResourceData(frameRef, resourceURL, callGetResourceDataBlockAndDispose, Block_copy(block));155 }156 #endif157 158 135 void WKFrameGetWebArchive(WKFrameRef frameRef, WKFrameGetWebArchiveFunction callback, void* context) 159 136 { 160 137 toImpl(frameRef)->getWebArchive(DataCallback::create(context, callback)); 161 138 } 162 163 #ifdef __BLOCKS__164 static void callGetWebArchiveBlockAndDispose(WKDataRef archiveData, WKErrorRef error, void* context)165 {166 WKFrameGetWebArchiveBlock block = (WKFrameGetWebArchiveBlock)context;167 block(archiveData, error);168 Block_release(block);169 }170 171 void WKFrameGetWebArchive_b(WKFrameRef frameRef, WKFrameGetWebArchiveBlock block)172 {173 WKFrameGetWebArchive(frameRef, callGetWebArchiveBlockAndDispose, Block_copy(block));174 }175 #endif176 177 139 178 140 // NOTE: These are deprecated and should be removed. They currently do nothing. -
trunk/Source/WebKit2/UIProcess/API/C/WKFrame.h
r141708 r159059 72 72 WK_EXPORT void WKFrameGetMainResourceData(WKFrameRef frame, WKFrameGetResourceDataFunction function, void* functionContext); 73 73 WK_EXPORT void WKFrameGetResourceData(WKFrameRef frame, WKURLRef resourceURL, WKFrameGetResourceDataFunction function, void* functionContext); 74 #ifdef __BLOCKS__75 typedef void (^WKFrameGetResourceDataBlock)(WKDataRef data, WKErrorRef error);76 WK_EXPORT void WKFrameGetMainResourceData_b(WKFrameRef frame, WKFrameGetResourceDataBlock block);77 WK_EXPORT void WKFrameGetResourceData_b(WKFrameRef frame, WKURLRef resourceURL, WKFrameGetResourceDataBlock block);78 #endif79 74 80 75 typedef void (*WKFrameGetWebArchiveFunction)(WKDataRef archiveData, WKErrorRef error, void* functionContext); 81 76 WK_EXPORT void WKFrameGetWebArchive(WKFrameRef frame, WKFrameGetWebArchiveFunction function, void* functionContext); 82 #ifdef __BLOCKS__83 typedef void (^WKFrameGetWebArchiveBlock)(WKDataRef archiveData, WKErrorRef error);84 WK_EXPORT void WKFrameGetWebArchive_b(WKFrameRef frame, WKFrameGetWebArchiveBlock block);85 #endif86 87 77 88 78 // NOTE: These are deprecated and should be removed. They currently do nothing. -
trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp
r158759 r159059 690 690 } 691 691 692 #ifdef __BLOCKS__693 static void callRenderTreeExternalRepresentationBlockAndDispose(WKStringRef resultValue, WKErrorRef error, void* context)694 {695 WKPageRenderTreeExternalRepresentationBlock block = (WKPageRenderTreeExternalRepresentationBlock)context;696 block(resultValue, error);697 Block_release(block);698 }699 700 void WKPageRenderTreeExternalRepresentation_b(WKPageRef pageRef, WKPageRenderTreeExternalRepresentationBlock block)701 {702 WKPageRenderTreeExternalRepresentation(pageRef, Block_copy(block), callRenderTreeExternalRepresentationBlockAndDispose);703 }704 #endif705 706 692 void WKPageGetSourceForFrame(WKPageRef pageRef, WKFrameRef frameRef, void* context, WKPageGetSourceForFrameFunction callback) 707 693 { … … 709 695 } 710 696 711 #ifdef __BLOCKS__712 static void callGetSourceForFrameBlockBlockAndDispose(WKStringRef resultValue, WKErrorRef error, void* context)713 {714 WKPageGetSourceForFrameBlock block = (WKPageGetSourceForFrameBlock)context;715 block(resultValue, error);716 Block_release(block);717 }718 719 void WKPageGetSourceForFrame_b(WKPageRef pageRef, WKFrameRef frameRef, WKPageGetSourceForFrameBlock block)720 {721 WKPageGetSourceForFrame(pageRef, frameRef, Block_copy(block), callGetSourceForFrameBlockBlockAndDispose);722 }723 #endif724 725 697 void WKPageGetContentsAsString(WKPageRef pageRef, void* context, WKPageGetContentsAsStringFunction callback) 726 698 { 727 699 toImpl(pageRef)->getContentsAsString(StringCallback::create(context, callback)); 728 700 } 729 730 #ifdef __BLOCKS__731 static void callContentsAsStringBlockBlockAndDispose(WKStringRef resultValue, WKErrorRef error, void* context)732 {733 WKPageGetContentsAsStringBlock block = (WKPageGetContentsAsStringBlock)context;734 block(resultValue, error);735 Block_release(block);736 }737 738 void WKPageGetContentsAsString_b(WKPageRef pageRef, WKPageGetSourceForFrameBlock block)739 {740 WKPageGetContentsAsString(pageRef, Block_copy(block), callContentsAsStringBlockBlockAndDispose);741 }742 #endif743 701 744 702 void WKPageGetSelectionAsWebArchiveData(WKPageRef pageRef, void* context, WKPageGetSelectionAsWebArchiveDataFunction callback) -
trunk/Source/WebKit2/UIProcess/API/C/WKPage.h
r156924 r159059 511 511 typedef void (*WKPageGetSourceForFrameFunction)(WKStringRef, WKErrorRef, void*); 512 512 WK_EXPORT void WKPageGetSourceForFrame(WKPageRef page, WKFrameRef frame, void* context, WKPageGetSourceForFrameFunction function); 513 #ifdef __BLOCKS__514 typedef void (^WKPageGetSourceForFrameBlock)(WKStringRef, WKErrorRef);515 WK_EXPORT void WKPageGetSourceForFrame_b(WKPageRef page, WKFrameRef frame, WKPageGetSourceForFrameBlock block);516 #endif517 513 518 514 typedef void (*WKPageGetContentsAsStringFunction)(WKStringRef, WKErrorRef, void*); 519 515 WK_EXPORT void WKPageGetContentsAsString(WKPageRef page, void* context, WKPageGetContentsAsStringFunction function); 520 #ifdef __BLOCKS__521 typedef void (^WKPageGetContentsAsStringBlock)(WKStringRef, WKErrorRef);522 WK_EXPORT void WKPageGetContentsAsString_b(WKPageRef page, WKPageGetContentsAsStringBlock block);523 #endif524 516 525 517 typedef void (*WKPageGetContentsAsMHTMLDataFunction)(WKDataRef, WKErrorRef, void*); -
trunk/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h
r152425 r159059 36 36 typedef void (*WKPageRenderTreeExternalRepresentationFunction)(WKStringRef, WKErrorRef, void*); 37 37 WK_EXPORT void WKPageRenderTreeExternalRepresentation(WKPageRef page, void *context, WKPageRenderTreeExternalRepresentationFunction function); 38 39 #ifdef __BLOCKS__40 typedef void (^WKPageRenderTreeExternalRepresentationBlock)(WKStringRef, WKErrorRef);41 WK_EXPORT void WKPageRenderTreeExternalRepresentation_b(WKPageRef page, WKPageRenderTreeExternalRepresentationBlock block);42 #endif43 38 44 39 enum { -
trunk/Tools/ChangeLog
r159052 r159059 1 2013-11-11 Anders Carlsson <andersca@apple.com> 2 3 Remove block based APIs from the WebKit2 C API 4 https://bugs.webkit.org/show_bug.cgi?id=124157 5 6 Reviewed by Sam Weinig. 7 8 Update for WK2 changes. 9 10 * MiniBrowser/mac/WK2BrowserWindowController.m: 11 (dumpSource): 12 (-[WK2BrowserWindowController dumpSourceToConsole:]): 13 1 14 2013-11-11 Tamas Gergely <gertom@inf.u-szeged.hu> 2 15 -
trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m
r153956 r159059 282 282 } 283 283 284 static void dumpSource(WKStringRef source, WKErrorRef error, void* context) 285 { 286 if (!source) 287 return; 288 289 LOG(@"Main frame source\n \"%@\"", CFBridgingRelease(WKStringCopyCFString(0, source))); 290 } 291 284 292 - (IBAction)dumpSourceToConsole:(id)sender 285 293 { 286 WKPageGetSourceForFrame_b(_webView.pageRef, WKPageGetMainFrame(_webView.pageRef), ^(WKStringRef result, WKErrorRef error) { 287 if (!result) 288 return; 289 290 CFStringRef cfResult = WKStringCopyCFString(0, result); 291 LOG(@"Main frame source\n \"%@\"", (NSString *)cfResult); 292 CFRelease(cfResult); 293 }); 294 WKPageGetSourceForFrame(_webView.pageRef, WKPageGetMainFrame(_webView.pageRef), NULL, dumpSource); 294 295 } 295 296
Note: See TracChangeset
for help on using the changeset viewer.