Summary: | MediaSessionManager shouldn't use std::map | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Eric Carlson <eric.carlson> | ||||||
Component: | Media | Assignee: | Eric Carlson <eric.carlson> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | CC: | commit-queue, glenn, jer.noble, sam | ||||||
Priority: | P2 | ||||||||
Version: | 528+ (Nightly build) | ||||||||
Hardware: | Unspecified | ||||||||
OS: | Unspecified | ||||||||
Attachments: |
|
Description
Eric Carlson
2014-01-14 13:26:27 PST
Created attachment 221195 [details]
Proposed patch
Comment on attachment 221195 [details] Proposed patch View in context: https://bugs.webkit.org/attachment.cgi?id=221195&action=review > Source/WebCore/platform/audio/MediaSessionManager.h:71 > + typedef HashMap<MediaSession::MediaType, SessionRestrictions, WTF::IntHash<unsigned>, WTF::HashTraits<unsigned>> RestrictionsMap; I think you can actually do much better than a HashMap. How about something like an array of SessionRestrictions of size == LagestValueOfMediaType + 1: SessionRestrictions[WebAudio + 1]; But, if you use the HashMap, you need to use traits that allow for a 0 value key (e.g. UnsignedWithZeroKeyHashTraits). Created attachment 221320 [details]
Another patch.
Comment on attachment 221320 [details]
Another patch.
Nice.
(In reply to comment #4) > (From update of attachment 221320 [details]) > Nice. Thanks for the suggestion, my first and second versions were definitely over engineered :-) Comment on attachment 221320 [details] Another patch. Clearing flags on attachment: 221320 Committed r162108: <http://trac.webkit.org/changeset/162108> All reviewed patches have been landed. Closing bug. |