Bug 130919

Summary: [MSE][Mac] Support lease-renewal.
Product: WebKit Reporter: Jer Noble <jer.noble>
Component: New BugsAssignee: Jer Noble <jer.noble>
Severity: Normal CC: commit-queue, eric.carlson, glenn, philipj, sergio
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Description Flags
Patch none

Description Jer Noble 2014-03-28 16:50:07 PDT
[MSE][Mac] Support lease-renewal.
Comment 1 Jer Noble 2014-03-28 16:54:58 PDT
Created attachment 228093 [details]
Comment 2 WebKit Commit Bot 2014-03-31 09:43:58 PDT
Comment on attachment 228093 [details]

Clearing flags on attachment: 228093

Committed r166509: <http://trac.webkit.org/changeset/166509>
Comment 3 WebKit Commit Bot 2014-03-31 09:44:01 PDT
All reviewed patches have been landed.  Closing bug.
Comment 4 Darin Adler 2014-03-31 10:01:26 PDT
Comment on attachment 228093 [details]

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

> Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm:116
> +    static NeverDestroyed<String> renewMessage("renew");
> +    String keyAsString(key->data(), key->length());
> +
> +    if (keyAsString == renewMessage) {

This is a tortured way to check if the key is "renew". I suggest writing a function to do it without memory allocation. Maybe put it in a header somewhere, but at least do it within this file for now:

    static bool isEqual(const uint8_t* data, unsigned length, const char* literal)
        for (unsigned i = 0; i < length; ++i) {
            if (data[i] != static_cast<uint8_t>(literal[i]))
                return false;
        return !literal[length];

Then get rid of the renewMessage and keyAsStringLocal variables. And write:

    if (isEqual(key->data(), key->length(), "renew") {