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

Side by Side Diff: third_party/WebKit/Source/platform/weborigin/SecurityOrigin.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) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 if (isUnique()) 428 if (isUnique())
429 return "null"; 429 return "null";
430 if (isLocal() && m_blockLocalAccessFromLocalOrigin) 430 if (isLocal() && m_blockLocalAccessFromLocalOrigin)
431 return "null"; 431 return "null";
432 return toRawString(); 432 return toRawString();
433 } 433 }
434 434
435 AtomicString SecurityOrigin::toAtomicString() const 435 AtomicString SecurityOrigin::toAtomicString() const
436 { 436 {
437 if (isUnique()) 437 if (isUnique())
438 return AtomicString("null", AtomicString::ConstructFromLiteral); 438 return AtomicString("null");
439 if (isLocal() && m_blockLocalAccessFromLocalOrigin) 439 if (isLocal() && m_blockLocalAccessFromLocalOrigin)
440 return AtomicString("null", AtomicString::ConstructFromLiteral); 440 return AtomicString("null");
441 return toRawAtomicString(); 441 return toRawAtomicString();
442 } 442 }
443 443
444 String SecurityOrigin::toPhysicalOriginString() const 444 String SecurityOrigin::toPhysicalOriginString() const
445 { 445 {
446 if (isUnique()) 446 if (isUnique())
447 return "null"; 447 return "null";
448 if (isLocal() && m_blockLocalAccessFromLocalOrigin) 448 if (isLocal() && m_blockLocalAccessFromLocalOrigin)
449 return "null"; 449 return "null";
450 return toRawStringIgnoreSuborigin(); 450 return toRawStringIgnoreSuborigin();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 suboriginName = oldHost.substring(0, suboriginEnd); 485 suboriginName = oldHost.substring(0, suboriginEnd);
486 newHost = oldHost.substring(suboriginEnd + 1); 486 newHost = oldHost.substring(suboriginEnd + 1);
487 487
488 return true; 488 return true;
489 } 489 }
490 490
491 491
492 AtomicString SecurityOrigin::toRawAtomicString() const 492 AtomicString SecurityOrigin::toRawAtomicString() const
493 { 493 {
494 if (m_protocol == "file") 494 if (m_protocol == "file")
495 return AtomicString("file://", AtomicString::ConstructFromLiteral); 495 return AtomicString("file://");
496 496
497 StringBuilder result; 497 StringBuilder result;
498 buildRawString(result, true); 498 buildRawString(result, true);
499 return result.toAtomicString(); 499 return result.toAtomicString();
500 } 500 }
501 501
502 void SecurityOrigin::buildRawString(StringBuilder& builder, bool includeSuborigi n) const 502 void SecurityOrigin::buildRawString(StringBuilder& builder, bool includeSuborigi n) const
503 { 503 {
504 builder.append(m_protocol); 504 builder.append(m_protocol);
505 builder.appendLiteral("://"); 505 builder.appendLiteral("://");
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 m_blockLocalAccessFromLocalOrigin = privilegeData->m_blockLocalAccessFromLoc alOrigin; 575 m_blockLocalAccessFromLocalOrigin = privilegeData->m_blockLocalAccessFromLoc alOrigin;
576 } 576 }
577 577
578 void SecurityOrigin::setUniqueOriginIsPotentiallyTrustworthy(bool isUniqueOrigin PotentiallyTrustworthy) 578 void SecurityOrigin::setUniqueOriginIsPotentiallyTrustworthy(bool isUniqueOrigin PotentiallyTrustworthy)
579 { 579 {
580 ASSERT(!isUniqueOriginPotentiallyTrustworthy || isUnique()); 580 ASSERT(!isUniqueOriginPotentiallyTrustworthy || isUnique());
581 m_isUniqueOriginPotentiallyTrustworthy = isUniqueOriginPotentiallyTrustworth y; 581 m_isUniqueOriginPotentiallyTrustworthy = isUniqueOriginPotentiallyTrustworth y;
582 } 582 }
583 583
584 } // namespace blink 584 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698