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

Side by Side Diff: third_party/WebKit/Source/core/html/track/TextTrack.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 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 30 matching lines...) Expand all
41 #include "core/html/track/vtt/VTTRegion.h" 41 #include "core/html/track/vtt/VTTRegion.h"
42 #include "core/html/track/vtt/VTTRegionList.h" 42 #include "core/html/track/vtt/VTTRegionList.h"
43 #include "platform/RuntimeEnabledFeatures.h" 43 #include "platform/RuntimeEnabledFeatures.h"
44 44
45 namespace blink { 45 namespace blink {
46 46
47 static const int invalidTrackIndex = -1; 47 static const int invalidTrackIndex = -1;
48 48
49 const AtomicString& TextTrack::subtitlesKeyword() 49 const AtomicString& TextTrack::subtitlesKeyword()
50 { 50 {
51 DEFINE_STATIC_LOCAL(const AtomicString, subtitles, ("subtitles", AtomicStrin g::ConstructFromLiteral)); 51 DEFINE_STATIC_LOCAL(const AtomicString, subtitles, ("subtitles"));
52 return subtitles; 52 return subtitles;
53 } 53 }
54 54
55 const AtomicString& TextTrack::captionsKeyword() 55 const AtomicString& TextTrack::captionsKeyword()
56 { 56 {
57 DEFINE_STATIC_LOCAL(const AtomicString, captions, ("captions", AtomicString: :ConstructFromLiteral)); 57 DEFINE_STATIC_LOCAL(const AtomicString, captions, ("captions"));
58 return captions; 58 return captions;
59 } 59 }
60 60
61 const AtomicString& TextTrack::descriptionsKeyword() 61 const AtomicString& TextTrack::descriptionsKeyword()
62 { 62 {
63 DEFINE_STATIC_LOCAL(const AtomicString, descriptions, ("descriptions", Atomi cString::ConstructFromLiteral)); 63 DEFINE_STATIC_LOCAL(const AtomicString, descriptions, ("descriptions"));
64 return descriptions; 64 return descriptions;
65 } 65 }
66 66
67 const AtomicString& TextTrack::chaptersKeyword() 67 const AtomicString& TextTrack::chaptersKeyword()
68 { 68 {
69 DEFINE_STATIC_LOCAL(const AtomicString, chapters, ("chapters", AtomicString: :ConstructFromLiteral)); 69 DEFINE_STATIC_LOCAL(const AtomicString, chapters, ("chapters"));
70 return chapters; 70 return chapters;
71 } 71 }
72 72
73 const AtomicString& TextTrack::metadataKeyword() 73 const AtomicString& TextTrack::metadataKeyword()
74 { 74 {
75 DEFINE_STATIC_LOCAL(const AtomicString, metadata, ("metadata", AtomicString: :ConstructFromLiteral)); 75 DEFINE_STATIC_LOCAL(const AtomicString, metadata, ("metadata"));
76 return metadata; 76 return metadata;
77 } 77 }
78 78
79 const AtomicString& TextTrack::disabledKeyword() 79 const AtomicString& TextTrack::disabledKeyword()
80 { 80 {
81 DEFINE_STATIC_LOCAL(const AtomicString, open, ("disabled", AtomicString::Con structFromLiteral)); 81 DEFINE_STATIC_LOCAL(const AtomicString, open, ("disabled"));
82 return open; 82 return open;
83 } 83 }
84 84
85 const AtomicString& TextTrack::hiddenKeyword() 85 const AtomicString& TextTrack::hiddenKeyword()
86 { 86 {
87 DEFINE_STATIC_LOCAL(const AtomicString, closed, ("hidden", AtomicString::Con structFromLiteral)); 87 DEFINE_STATIC_LOCAL(const AtomicString, closed, ("hidden"));
88 return closed; 88 return closed;
89 } 89 }
90 90
91 const AtomicString& TextTrack::showingKeyword() 91 const AtomicString& TextTrack::showingKeyword()
92 { 92 {
93 DEFINE_STATIC_LOCAL(const AtomicString, ended, ("showing", AtomicString::Con structFromLiteral)); 93 DEFINE_STATIC_LOCAL(const AtomicString, ended, ("showing"));
94 return ended; 94 return ended;
95 } 95 }
96 96
97 TextTrack::TextTrack(const AtomicString& kind, const AtomicString& label, const AtomicString& language, const AtomicString& id, TextTrackType type) 97 TextTrack::TextTrack(const AtomicString& kind, const AtomicString& label, const AtomicString& language, const AtomicString& id, TextTrackType type)
98 : TrackBase(TrackBase::TextTrack, label, language, id) 98 : TrackBase(TrackBase::TextTrack, label, language, id)
99 , m_cues(nullptr) 99 , m_cues(nullptr)
100 , m_regions(nullptr) 100 , m_regions(nullptr)
101 , m_trackList(nullptr) 101 , m_trackList(nullptr)
102 , m_mode(disabledKeyword()) 102 , m_mode(disabledKeyword())
103 , m_trackType(type) 103 , m_trackType(type)
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 { 473 {
474 visitor->trace(m_cues); 474 visitor->trace(m_cues);
475 visitor->trace(m_activeCues); 475 visitor->trace(m_activeCues);
476 visitor->trace(m_regions); 476 visitor->trace(m_regions);
477 visitor->trace(m_trackList); 477 visitor->trace(m_trackList);
478 TrackBase::trace(visitor); 478 TrackBase::trace(visitor);
479 RefCountedGarbageCollectedEventTargetWithInlineData<TextTrack>::trace(visito r); 479 RefCountedGarbageCollectedEventTargetWithInlineData<TextTrack>::trace(visito r);
480 } 480 }
481 481
482 } // namespace blink 482 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698