Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(348)

Side by Side Diff: third_party/WebKit/Source/core/html/track/VideoTrack.cpp

Issue 1844223002: Literal AtomicString construction can rely on strlen optimization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/html/track/VideoTrack.h" 5 #include "core/html/track/VideoTrack.h"
6 6
7 #include "core/html/HTMLMediaElement.h" 7 #include "core/html/HTMLMediaElement.h"
8 8
9 namespace blink { 9 namespace blink {
10 10
(...skipping 21 matching lines...) Expand all
32 m_selected = selected; 32 m_selected = selected;
33 33
34 if (mediaElement()) { 34 if (mediaElement()) {
35 WebMediaPlayer::TrackId selectedTrackId = trackId(); 35 WebMediaPlayer::TrackId selectedTrackId = trackId();
36 mediaElement()->selectedVideoTrackChanged(selected ? &selectedTrackId : 0); 36 mediaElement()->selectedVideoTrackChanged(selected ? &selectedTrackId : 0);
37 } 37 }
38 } 38 }
39 39
40 const AtomicString& VideoTrack::alternativeKeyword() 40 const AtomicString& VideoTrack::alternativeKeyword()
41 { 41 {
42 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("alternative", AtomicStrin g::ConstructFromLiteral)); 42 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("alternative"));
43 return keyword; 43 return keyword;
44 } 44 }
45 45
46 const AtomicString& VideoTrack::captionsKeyword() 46 const AtomicString& VideoTrack::captionsKeyword()
47 { 47 {
48 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("captions", AtomicString:: ConstructFromLiteral)); 48 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("captions"));
49 return keyword; 49 return keyword;
50 } 50 }
51 51
52 const AtomicString& VideoTrack::mainKeyword() 52 const AtomicString& VideoTrack::mainKeyword()
53 { 53 {
54 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("main", AtomicString::Cons tructFromLiteral)); 54 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("main"));
55 return keyword; 55 return keyword;
56 } 56 }
57 57
58 const AtomicString& VideoTrack::signKeyword() 58 const AtomicString& VideoTrack::signKeyword()
59 { 59 {
60 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("sign", AtomicString::Cons tructFromLiteral)); 60 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("sign"));
61 return keyword; 61 return keyword;
62 } 62 }
63 63
64 const AtomicString& VideoTrack::subtitlesKeyword() 64 const AtomicString& VideoTrack::subtitlesKeyword()
65 { 65 {
66 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("subtitles", AtomicString: :ConstructFromLiteral)); 66 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("subtitles"));
67 return keyword; 67 return keyword;
68 } 68 }
69 69
70 const AtomicString& VideoTrack::commentaryKeyword() 70 const AtomicString& VideoTrack::commentaryKeyword()
71 { 71 {
72 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("commentary", AtomicString ::ConstructFromLiteral)); 72 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("commentary"));
73 return keyword; 73 return keyword;
74 } 74 }
75 75
76 bool VideoTrack::isValidKindKeyword(const String& kind) 76 bool VideoTrack::isValidKindKeyword(const String& kind)
77 { 77 {
78 return (kind == alternativeKeyword()) 78 return (kind == alternativeKeyword())
79 || (kind == captionsKeyword()) 79 || (kind == captionsKeyword())
80 || (kind == mainKeyword()) 80 || (kind == mainKeyword())
81 || (kind == signKeyword()) 81 || (kind == signKeyword())
82 || (kind == subtitlesKeyword()) 82 || (kind == subtitlesKeyword())
83 || (kind == commentaryKeyword()) 83 || (kind == commentaryKeyword())
84 || (kind == emptyAtom); 84 || (kind == emptyAtom);
85 } 85 }
86 86
87 AtomicString VideoTrack::defaultKind() const 87 AtomicString VideoTrack::defaultKind() const
88 { 88 {
89 return emptyAtom; 89 return emptyAtom;
90 } 90 }
91 91
92 } // namespace blink 92 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698