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

Side by Side Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2668903003: Replace WTF::emptyString{16Bit}() with a static global (Closed)
Patch Set: Replace WTF::emptyString{16Bit}() with a static global Created 3 years, 10 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All
7 * rights reserved. 7 * rights reserved.
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 return HTMLElementFactory::createHTMLElement(localName, *this, 670 return HTMLElementFactory::createHTMLElement(localName, *this,
671 CreatedByCreateElement); 671 CreatedByCreateElement);
672 } 672 }
673 return Element::create(QualifiedName(nullAtom, name, nullAtom), this); 673 return Element::create(QualifiedName(nullAtom, name, nullAtom), this);
674 } 674 }
675 675
676 String getTypeExtension(Document* document, 676 String getTypeExtension(Document* document,
677 const StringOrDictionary& stringOrOptions, 677 const StringOrDictionary& stringOrOptions,
678 ExceptionState& exceptionState) { 678 ExceptionState& exceptionState) {
679 if (stringOrOptions.isNull()) 679 if (stringOrOptions.isNull())
680 return emptyString(); 680 return emptyString;
681 681
682 if (stringOrOptions.isString()) { 682 if (stringOrOptions.isString()) {
683 UseCounter::count(document, 683 UseCounter::count(document,
684 UseCounter::DocumentCreateElement2ndArgStringHandling); 684 UseCounter::DocumentCreateElement2ndArgStringHandling);
685 return stringOrOptions.getAsString(); 685 return stringOrOptions.getAsString();
686 } 686 }
687 687
688 if (stringOrOptions.isDictionary()) { 688 if (stringOrOptions.isDictionary()) {
689 Dictionary dict = stringOrOptions.getAsDictionary(); 689 Dictionary dict = stringOrOptions.getAsDictionary();
690 ElementCreationOptions impl; 690 ElementCreationOptions impl;
691 V8ElementCreationOptions::toImpl(dict.isolate(), dict.v8Value(), impl, 691 V8ElementCreationOptions::toImpl(dict.isolate(), dict.v8Value(), impl,
692 exceptionState); 692 exceptionState);
693 if (impl.hasIs()) 693 if (impl.hasIs())
694 return impl.is(); 694 return impl.is();
695 695
696 return toCoreString(dict.v8Value()->ToString()); 696 return toCoreString(dict.v8Value()->ToString());
697 } 697 }
698 698
699 return emptyString(); 699 return emptyString;
700 } 700 }
701 701
702 // https://dom.spec.whatwg.org/#dom-document-createelement 702 // https://dom.spec.whatwg.org/#dom-document-createelement
703 Element* Document::createElement(const AtomicString& localName, 703 Element* Document::createElement(const AtomicString& localName,
704 const StringOrDictionary& stringOrOptions, 704 const StringOrDictionary& stringOrOptions,
705 ExceptionState& exceptionState) { 705 ExceptionState& exceptionState) {
706 // 1. If localName does not match Name production, throw InvalidCharacterError 706 // 1. If localName does not match Name production, throw InvalidCharacterError
707 if (!isValidName(localName)) { 707 if (!isValidName(localName)) {
708 exceptionState.throwDOMException( 708 exceptionState.throwDOMException(
709 InvalidCharacterError, 709 InvalidCharacterError,
(...skipping 4669 matching lines...) Expand 10 before | Expand all | Expand 10 after
5379 5379
5380 return 0; 5380 return 0;
5381 } 5381 }
5382 5382
5383 void Document::initSecurityContext(const DocumentInit& initializer) { 5383 void Document::initSecurityContext(const DocumentInit& initializer) {
5384 DCHECK(!getSecurityOrigin()); 5384 DCHECK(!getSecurityOrigin());
5385 5385
5386 if (!initializer.hasSecurityContext()) { 5386 if (!initializer.hasSecurityContext()) {
5387 // No source for a security context. 5387 // No source for a security context.
5388 // This can occur via document.implementation.createDocument(). 5388 // This can occur via document.implementation.createDocument().
5389 m_cookieURL = KURL(ParsedURLString, emptyString()); 5389 m_cookieURL = KURL(ParsedURLString, emptyString);
5390 setSecurityOrigin(SecurityOrigin::createUnique()); 5390 setSecurityOrigin(SecurityOrigin::createUnique());
5391 initContentSecurityPolicy(); 5391 initContentSecurityPolicy();
5392 // Unique security origins cannot have a suborigin 5392 // Unique security origins cannot have a suborigin
5393 return; 5393 return;
5394 } 5394 }
5395 5395
5396 // In the common case, create the security context from the currently 5396 // In the common case, create the security context from the currently
5397 // loading URL with a fresh content security policy. 5397 // loading URL with a fresh content security policy.
5398 enforceSandboxFlags(initializer.getSandboxFlags()); 5398 enforceSandboxFlags(initializer.getSandboxFlags());
5399 setInsecureRequestPolicy(initializer.getInsecureRequestPolicy()); 5399 setInsecureRequestPolicy(initializer.getInsecureRequestPolicy());
(...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after
6569 } 6569 }
6570 6570
6571 void showLiveDocumentInstances() { 6571 void showLiveDocumentInstances() {
6572 WeakDocumentSet& set = liveDocumentSet(); 6572 WeakDocumentSet& set = liveDocumentSet();
6573 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6573 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6574 for (blink::Document* document : set) 6574 for (blink::Document* document : set)
6575 fprintf(stderr, "- Document %p URL: %s\n", document, 6575 fprintf(stderr, "- Document %p URL: %s\n", document,
6576 document->url().getString().utf8().data()); 6576 document->url().getString().utf8().data());
6577 } 6577 }
6578 #endif 6578 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.h ('k') | third_party/WebKit/Source/core/dom/Element.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698