Bug 91302

Summary: [Mac] Do not try to update the cache model for every WebPreferences change
Product: WebKit Reporter: Benjamin Poulain <benjamin>
Component: WebKit Misc.Assignee: Benjamin Poulain <benjamin>
Status: RESOLVED FIXED    
Severity: Normal CC: joepeck, rniwa, webkit.review.bot
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 91321    
Bug Blocks:    
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description Benjamin Poulain 2012-07-13 17:29:33 PDT
Try lazier updates.
Comment 1 Benjamin Poulain 2012-07-13 17:42:05 PDT
Created attachment 152385 [details]
Patch
Comment 2 Benjamin Poulain 2012-07-13 18:52:56 PDT
Created attachment 152398 [details]
Patch
Comment 3 Joseph Pecoraro 2012-07-13 19:08:58 PDT
Comment on attachment 152398 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=152398&action=review

> Tools/TestWebKitAPI/Tests/mac/SetAndUpdateCacheModel.mm:63
> +    // On change, the cache model always take the highest value of any preference bound to a WebView.

The implementation of _cacheModelChangedNotification will take a higher cache model even if the WebPreferences object that is changing is not bound to a WebView. Weird, but that is legacy behavior. You could update this comment.
Comment 4 Benjamin Poulain 2012-07-14 02:03:36 PDT
Committed r122665: <http://trac.webkit.org/changeset/122665>
Comment 5 Ryosuke Niwa 2012-07-14 03:02:53 PDT
This patch broke builds:

/Volumes/Data/slave/snowleopard-release/build/WebKitBuild/WebKit.build/Release/WebKit.build/Objects-normal/x86_64/WebPreferences.o
/Volumes/Data/slave/snowleopard-release/build/Source/WebKit/mac/WebView/WebPreferences.mm:226:5:{226:5-226:46}: error: instance method '-_postCacheModelChangedNotification' not found (return type defaults to 'id') [-Werror,3]
     [self _postCacheModelChangedNotification];
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
Comment 6 Ryosuke Niwa 2012-07-14 03:48:15 PDT
Sorry but I'm rolling out this patch since I don't know how to fix this build failure.
Comment 7 WebKit Review Bot 2012-07-14 03:49:06 PDT
Re-opened since this is blocked by 91321
Comment 8 Joseph Pecoraro 2012-07-14 12:11:16 PDT
(In reply to comment #5)
> This patch broke builds:
> 
> /Volumes/Data/slave/snowleopard-release/build/WebKitBuild/WebKit.build/Release/WebKit.build/Objects-normal/x86_64/WebPreferences.o
> /Volumes/Data/slave/snowleopard-release/build/Source/WebKit/mac/WebView/WebPreferences.mm:226:5:{226:5-226:46}: error: instance method '-_postCacheModelChangedNotification' not found (return type defaults to 'id') [-Werror,3]
>      [self _postCacheModelChangedNotification];
>      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 1 error generated.

My guess is to fix this issue you probably just need to reorder (or forward declare) the method. WebPreferences.mm:226 calls the method which is defined later in the file. Newer compilers just get this right, but in older compilers the order matters.
Comment 9 Benjamin Poulain 2012-07-14 14:06:54 PDT
(In reply to comment #6)
> Sorry but I'm rolling out this patch since I don't know how to fix this build failure.

Thank you for reverting. I went to bed before the bots went red.

(In reply to comment #8)
> My guess is to fix this issue you probably just need to reorder (or forward declare) the method. WebPreferences.mm:226 calls the method which is defined later in the file. Newer compilers just get this right, but in older compilers the order matters.

Yep, that is why that worked locally.
I'll fix that...
Comment 10 Benjamin Poulain 2012-07-14 15:08:33 PDT
Created attachment 152435 [details]
Patch
Comment 11 Benjamin Poulain 2012-07-14 16:31:22 PDT
Committed r122675: <http://trac.webkit.org/changeset/122675>
Comment 12 Benjamin Poulain 2012-07-14 17:28:36 PDT
<rdar://problem/11872809>