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

Side by Side Diff: third_party/WebKit/Source/modules/mediasource/MediaSource.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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 if (isUpdating) { 62 if (isUpdating) {
63 MediaSource::logAndThrowDOMException(exceptionState, InvalidStateError, "The 'updating' attribute is true on one or more of this MediaSource's SourceBuf fers."); 63 MediaSource::logAndThrowDOMException(exceptionState, InvalidStateError, "The 'updating' attribute is true on one or more of this MediaSource's SourceBuf fers.");
64 return true; 64 return true;
65 } 65 }
66 66
67 return false; 67 return false;
68 } 68 }
69 69
70 const AtomicString& MediaSource::openKeyword() 70 const AtomicString& MediaSource::openKeyword()
71 { 71 {
72 DEFINE_STATIC_LOCAL(const AtomicString, open, ("open", AtomicString::Constru ctFromLiteral)); 72 DEFINE_STATIC_LOCAL(const AtomicString, open, ("open"));
73 return open; 73 return open;
74 } 74 }
75 75
76 const AtomicString& MediaSource::closedKeyword() 76 const AtomicString& MediaSource::closedKeyword()
77 { 77 {
78 DEFINE_STATIC_LOCAL(const AtomicString, closed, ("closed", AtomicString::Con structFromLiteral)); 78 DEFINE_STATIC_LOCAL(const AtomicString, closed, ("closed"));
79 return closed; 79 return closed;
80 } 80 }
81 81
82 const AtomicString& MediaSource::endedKeyword() 82 const AtomicString& MediaSource::endedKeyword()
83 { 83 {
84 DEFINE_STATIC_LOCAL(const AtomicString, ended, ("ended", AtomicString::Const ructFromLiteral)); 84 DEFINE_STATIC_LOCAL(const AtomicString, ended, ("ended"));
85 return ended; 85 return ended;
86 } 86 }
87 87
88 MediaSource* MediaSource::create(ExecutionContext* context) 88 MediaSource* MediaSource::create(ExecutionContext* context)
89 { 89 {
90 MediaSource* mediaSource = new MediaSource(context); 90 MediaSource* mediaSource = new MediaSource(context);
91 mediaSource->suspendIfNeeded(); 91 mediaSource->suspendIfNeeded();
92 return mediaSource; 92 return mediaSource;
93 } 93 }
94 94
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 if (oldState == state) 458 if (oldState == state)
459 return; 459 return;
460 460
461 m_readyState = state; 461 m_readyState = state;
462 462
463 onReadyStateChange(oldState, state); 463 onReadyStateChange(oldState, state);
464 } 464 }
465 465
466 void MediaSource::endOfStream(const AtomicString& error, ExceptionState& excepti onState) 466 void MediaSource::endOfStream(const AtomicString& error, ExceptionState& excepti onState)
467 { 467 {
468 DEFINE_STATIC_LOCAL(const AtomicString, network, ("network", AtomicString::C onstructFromLiteral)); 468 DEFINE_STATIC_LOCAL(const AtomicString, network, ("network"));
469 DEFINE_STATIC_LOCAL(const AtomicString, decode, ("decode", AtomicString::Con structFromLiteral)); 469 DEFINE_STATIC_LOCAL(const AtomicString, decode, ("decode"));
470 470
471 if (error == network) { 471 if (error == network) {
472 endOfStreamInternal(WebMediaSource::EndOfStreamStatusNetworkError, excep tionState); 472 endOfStreamInternal(WebMediaSource::EndOfStreamStatusNetworkError, excep tionState);
473 } else if (error == decode) { 473 } else if (error == decode) {
474 endOfStreamInternal(WebMediaSource::EndOfStreamStatusDecodeError, except ionState); 474 endOfStreamInternal(WebMediaSource::EndOfStreamStatusDecodeError, except ionState);
475 } else { 475 } else {
476 ASSERT_NOT_REACHED(); // IDL enforcement should prevent this case. 476 ASSERT_NOT_REACHED(); // IDL enforcement should prevent this case.
477 } 477 }
478 } 478 }
479 479
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 616
617 m_asyncEventQueue->enqueueEvent(event.release()); 617 m_asyncEventQueue->enqueueEvent(event.release());
618 } 618 }
619 619
620 URLRegistry& MediaSource::registry() const 620 URLRegistry& MediaSource::registry() const
621 { 621 {
622 return MediaSourceRegistry::registry(); 622 return MediaSourceRegistry::registry();
623 } 623 }
624 624
625 } // namespace blink 625 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698