[webkit-reviews] review granted: [Bug 116112] AX: Use caching when requesting children object on iOS : [Attachment 201736] patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue May 14 16:20:49 PDT 2013


David Kilzer (:ddkilzer) <ddkilzer at webkit.org> has granted chris fleizach
<cfleizach at apple.com>'s request for review:
Bug 116112: AX: Use caching when requesting children object on iOS
https://bugs.webkit.org/show_bug.cgi?id=116112

Attachment 201736: patch 
https://bugs.webkit.org/attachment.cgi?id=201736&action=review

------- Additional Comments from David Kilzer (:ddkilzer) <ddkilzer at webkit.org>
View in context: https://bugs.webkit.org/attachment.cgi?id=201736&action=review


r=me, but please consider using the stack-allocated C++ object to start/stop
the cache.

> Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:307
> +    [self startCachingAttributes];
>      RefPtr<AccessibilityObject> axObject =
m_object->accessibilityHitTest(IntPoint(point));
> +    [self stopCachingAttributes];

Can we use the stack-allocated C++ object pattern to turn the caching on and
off (rather than the Objective-C start/stop calls)?

Basically you just declare the object on the stack (usually in its own block to
isolate the code that uses the cache).	The constructor would call the
-startCachingAttributes method and the destructor would call the
-stopCachingAttributes method.

This also makes it easier to change the implementation later without changing
all the call sites where the cache is used.  And if the cache is slightly
different on iOS and Mac, that could be abstracted into this locking object so
that (maybe) more code could be shared.


More information about the webkit-reviews mailing list