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

Side by Side Diff: third_party/WebKit/Source/modules/presentation/PresentationConnection.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 "modules/presentation/PresentationConnection.h" 5 #include "modules/presentation/PresentationConnection.h"
6 6
7 #include "bindings/core/v8/ScriptPromiseResolver.h" 7 #include "bindings/core/v8/ScriptPromiseResolver.h"
8 #include "core/dom/DOMArrayBuffer.h" 8 #include "core/dom/DOMArrayBuffer.h"
9 #include "core/dom/DOMArrayBufferView.h" 9 #include "core/dom/DOMArrayBufferView.h"
10 #include "core/dom/Document.h" 10 #include "core/dom/Document.h"
(...skipping 27 matching lines...) Expand all
38 38
39 Document* document = toDocument(executionContext); 39 Document* document = toDocument(executionContext);
40 if (!document->frame()) 40 if (!document->frame())
41 return nullptr; 41 return nullptr;
42 PresentationController* controller = PresentationController::from(*document- >frame()); 42 PresentationController* controller = PresentationController::from(*document- >frame());
43 return controller ? controller->client() : nullptr; 43 return controller ? controller->client() : nullptr;
44 } 44 }
45 45
46 const AtomicString& connectionStateToString(WebPresentationConnectionState state ) 46 const AtomicString& connectionStateToString(WebPresentationConnectionState state )
47 { 47 {
48 DEFINE_STATIC_LOCAL(const AtomicString, connectedValue, ("connected", Atomic String::ConstructFromLiteral)); 48 DEFINE_STATIC_LOCAL(const AtomicString, connectedValue, ("connected"));
49 DEFINE_STATIC_LOCAL(const AtomicString, closedValue, ("closed", AtomicString ::ConstructFromLiteral)); 49 DEFINE_STATIC_LOCAL(const AtomicString, closedValue, ("closed"));
50 DEFINE_STATIC_LOCAL(const AtomicString, terminatedValue, ("terminated", Atom icString::ConstructFromLiteral)); 50 DEFINE_STATIC_LOCAL(const AtomicString, terminatedValue, ("terminated"));
51 51
52 switch (state) { 52 switch (state) {
53 case WebPresentationConnectionState::Connected: 53 case WebPresentationConnectionState::Connected:
54 return connectedValue; 54 return connectedValue;
55 case WebPresentationConnectionState::Closed: 55 case WebPresentationConnectionState::Closed:
56 return closedValue; 56 return closedValue;
57 case WebPresentationConnectionState::Terminated: 57 case WebPresentationConnectionState::Terminated:
58 return terminatedValue; 58 return terminatedValue;
59 } 59 }
60 60
61 ASSERT_NOT_REACHED(); 61 ASSERT_NOT_REACHED();
62 return terminatedValue; 62 return terminatedValue;
63 } 63 }
64 64
65 const AtomicString& connectionCloseReasonToString(WebPresentationConnectionClose Reason reason) 65 const AtomicString& connectionCloseReasonToString(WebPresentationConnectionClose Reason reason)
66 { 66 {
67 DEFINE_STATIC_LOCAL(const AtomicString, errorValue, ("error", AtomicString:: ConstructFromLiteral)); 67 DEFINE_STATIC_LOCAL(const AtomicString, errorValue, ("error"));
68 DEFINE_STATIC_LOCAL(const AtomicString, closedValue, ("closed", AtomicString ::ConstructFromLiteral)); 68 DEFINE_STATIC_LOCAL(const AtomicString, closedValue, ("closed"));
69 DEFINE_STATIC_LOCAL(const AtomicString, wentAwayValue, ("wentaway", AtomicSt ring::ConstructFromLiteral)); 69 DEFINE_STATIC_LOCAL(const AtomicString, wentAwayValue, ("wentaway"));
70 70
71 switch (reason) { 71 switch (reason) {
72 case WebPresentationConnectionCloseReason::Error: 72 case WebPresentationConnectionCloseReason::Error:
73 return errorValue; 73 return errorValue;
74 case WebPresentationConnectionCloseReason::Closed: 74 case WebPresentationConnectionCloseReason::Closed:
75 return closedValue; 75 return closedValue;
76 case WebPresentationConnectionCloseReason::WentAway: 76 case WebPresentationConnectionCloseReason::WentAway:
77 return wentAwayValue; 77 return wentAwayValue;
78 } 78 }
79 79
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 m_blobLoader->cancel(); 428 m_blobLoader->cancel();
429 m_blobLoader.clear(); 429 m_blobLoader.clear();
430 } 430 }
431 431
432 // Clear message queue. 432 // Clear message queue.
433 Deque<OwnPtr<Message>> empty; 433 Deque<OwnPtr<Message>> empty;
434 m_messages.swap(empty); 434 m_messages.swap(empty);
435 } 435 }
436 436
437 } // namespace blink 437 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698